DebugInfo: Drop rest of DIDescriptor subclasses
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 21 Apr 2015 18:44:06 +0000 (18:44 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 21 Apr 2015 18:44:06 +0000 (18:44 +0000)
Delete the remaining subclasses of (the already deleted) `DIDescriptor`.
Part of PR23080.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235404 91177308-0d34-0410-b5e6-96231b3b80d8

28 files changed:
bindings/go/llvm/DIBuilderBindings.cpp
include/llvm/CodeGen/MachineInstr.h
include/llvm/CodeGen/MachineInstrBuilder.h
include/llvm/IR/DebugInfo.h
lib/Analysis/ModuleDebugInfoPrinter.cpp
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
lib/CodeGen/AsmPrinter/DebugLocEntry.h
lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h
lib/CodeGen/AsmPrinter/DwarfExpression.cpp
lib/CodeGen/AsmPrinter/DwarfExpression.h
lib/CodeGen/AsmPrinter/DwarfFile.cpp
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
lib/CodeGen/AsmPrinter/DwarfUnit.h
lib/CodeGen/LiveDebugVariables.cpp
lib/CodeGen/MachineInstr.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/Transforms/IPO/StripSymbols.cpp
lib/Transforms/Scalar/SROA.cpp
lib/Transforms/Scalar/SampleProfile.cpp
lib/Transforms/Scalar/ScalarReplAggregates.cpp
lib/Transforms/Utils/AddDiscriminators.cpp
lib/Transforms/Utils/Local.cpp
tools/llvm-dis/llvm-dis.cpp
unittests/Transforms/Utils/Cloning.cpp

index 8d62a96d2f3f21b7f8c3c105f8de3cda49323ae2..d31c5850389761158e027b7b380737d9b422534f 100644 (file)
@@ -88,10 +88,9 @@ LLVMMetadataRef LLVMDIBuilderCreateLocalVariable(
     const char *Name, LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty,
     int AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
   DIBuilder *D = unwrap(Dref);
     const char *Name, LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty,
     int AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
   DIBuilder *D = unwrap(Dref);
-  DIVariable V = D->createLocalVariable(
+  return wrap(D->createLocalVariable(
       Tag, unwrap<MDScope>(Scope), Name, unwrap<MDFile>(File), Line,
       Tag, unwrap<MDScope>(Scope), Name, unwrap<MDFile>(File), Line,
-      unwrap<MDType>(Ty), AlwaysPreserve, Flags, ArgNo);
-  return wrap(V);
+      unwrap<MDType>(Ty), AlwaysPreserve, Flags, ArgNo));
 }
 
 LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Dref,
 }
 
 LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Dref,
@@ -182,8 +181,7 @@ LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Dref,
 LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Dref,
                                                  int64_t Lo, int64_t Count) {
   DIBuilder *D = unwrap(Dref);
 LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Dref,
                                                  int64_t Lo, int64_t Count) {
   DIBuilder *D = unwrap(Dref);
-  DISubrange S = D->getOrCreateSubrange(Lo, Count);
-  return wrap(S);
+  return wrap(D->getOrCreateSubrange(Lo, Count));
 }
 
 LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Dref,
 }
 
 LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Dref,
@@ -209,8 +207,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
 LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Dref,
                                               int64_t *Addr, size_t Length) {
   DIBuilder *D = unwrap(Dref);
 LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Dref,
                                               int64_t *Addr, size_t Length) {
   DIBuilder *D = unwrap(Dref);
-  DIExpression Expr = D->createExpression(ArrayRef<int64_t>(Addr, Length));
-  return wrap(Expr);
+  return wrap(D->createExpression(ArrayRef<int64_t>(Addr, Length)));
 }
 
 LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Dref,
 }
 
 LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Dref,
index 9097150ab6260f4d49ef18f5e61c7a2056d2be46..5a28c1bceafdbb489e455df61e60e088135b3eb6 100644 (file)
@@ -246,14 +246,14 @@ public:
 
   /// \brief Return the debug variable referenced by
   /// this DBG_VALUE instruction.
 
   /// \brief Return the debug variable referenced by
   /// this DBG_VALUE instruction.
-  DIVariable getDebugVariable() const {
+  const MDLocalVariable *getDebugVariable() const {
     assert(isDebugValue() && "not a DBG_VALUE");
     return cast<MDLocalVariable>(getOperand(2).getMetadata());
   }
 
   /// \brief Return the complex address expression referenced by
   /// this DBG_VALUE instruction.
     assert(isDebugValue() && "not a DBG_VALUE");
     return cast<MDLocalVariable>(getOperand(2).getMetadata());
   }
 
   /// \brief Return the complex address expression referenced by
   /// this DBG_VALUE instruction.
-  DIExpression getDebugExpression() const {
+  const MDExpression *getDebugExpression() const {
     assert(isDebugValue() && "not a DBG_VALUE");
     return cast<MDExpression>(getOperand(3).getMetadata());
   }
     assert(isDebugValue() && "not a DBG_VALUE");
     return cast<MDExpression>(getOperand(3).getMetadata());
   }
index 0574ebc40ce73f1847371d232020e2aab13f37df..8825452b251b8ee9a3d6bfeb2c2d38aa25682f4e 100644 (file)
@@ -176,7 +176,7 @@ public:
     MI->addOperand(*MF, MachineOperand::CreateMetadata(MD));
     assert((MI->isDebugValue() ? static_cast<bool>(MI->getDebugVariable())
                                : true) &&
     MI->addOperand(*MF, MachineOperand::CreateMetadata(MD));
     assert((MI->isDebugValue() ? static_cast<bool>(MI->getDebugVariable())
                                : true) &&
-           "first MDNode argument of a DBG_VALUE not a DIVariable");
+           "first MDNode argument of a DBG_VALUE not a variable");
     return *this;
   }
 
     return *this;
   }
 
@@ -356,8 +356,8 @@ inline MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL,
                                    const MCInstrDesc &MCID, bool IsIndirect,
                                    unsigned Reg, unsigned Offset,
                                    const MDNode *Variable, const MDNode *Expr) {
                                    const MCInstrDesc &MCID, bool IsIndirect,
                                    unsigned Reg, unsigned Offset,
                                    const MDNode *Variable, const MDNode *Expr) {
-  assert(isa<MDLocalVariable>(Variable) && "not a DIVariable");
-  assert(cast<MDExpression>(Expr)->isValid() && "not a DIExpression");
+  assert(isa<MDLocalVariable>(Variable) && "not a variable");
+  assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
   assert(cast<MDLocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
          "Expected inlined-at fields to agree");
   if (IsIndirect)
   assert(cast<MDLocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
          "Expected inlined-at fields to agree");
   if (IsIndirect)
@@ -385,8 +385,8 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB,
                                    const MCInstrDesc &MCID, bool IsIndirect,
                                    unsigned Reg, unsigned Offset,
                                    const MDNode *Variable, const MDNode *Expr) {
                                    const MCInstrDesc &MCID, bool IsIndirect,
                                    unsigned Reg, unsigned Offset,
                                    const MDNode *Variable, const MDNode *Expr) {
-  assert(isa<MDLocalVariable>(Variable) && "not a DIVariable");
-  assert(cast<MDExpression>(Expr)->isValid() && "not a DIExpression");
+  assert(isa<MDLocalVariable>(Variable) && "not a variable");
+  assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
   MachineFunction &MF = *BB.getParent();
   MachineInstr *MI =
       BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, Variable, Expr);
   MachineFunction &MF = *BB.getParent();
   MachineInstr *MI =
       BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, Variable, Expr);
index d49239cd2628715d59bceb1548e4fe787911a00e..5a53f26c78d9d39e6682510285981e1f474fc93a 100644 (file)
@@ -46,167 +46,12 @@ class NamedMDNode;
 class LLVMContext;
 class raw_ostream;
 
 class LLVMContext;
 class raw_ostream;
 
-class DIVariable;
-class DIObjCProperty;
-
 /// \brief Maps from type identifier to the actual MDNode.
 typedef DenseMap<const MDString *, MDNode *> DITypeIdentifierMap;
 
 /// \brief Maps from type identifier to the actual MDNode.
 typedef DenseMap<const MDString *, MDNode *> DITypeIdentifierMap;
 
-#define DECLARE_SIMPLIFY_DESCRIPTOR(DESC)                                      \
-  class DESC;                                                                  \
-  template <> struct simplify_type<const DESC>;                                \
-  template <> struct simplify_type<DESC>;
-DECLARE_SIMPLIFY_DESCRIPTOR(DISubrange)
-DECLARE_SIMPLIFY_DESCRIPTOR(DIEnumerator)
-DECLARE_SIMPLIFY_DESCRIPTOR(DITemplateTypeParameter)
-DECLARE_SIMPLIFY_DESCRIPTOR(DITemplateValueParameter)
-DECLARE_SIMPLIFY_DESCRIPTOR(DIGlobalVariable)
-DECLARE_SIMPLIFY_DESCRIPTOR(DIVariable)
-DECLARE_SIMPLIFY_DESCRIPTOR(DIExpression)
-DECLARE_SIMPLIFY_DESCRIPTOR(DILocation)
-DECLARE_SIMPLIFY_DESCRIPTOR(DIObjCProperty)
-DECLARE_SIMPLIFY_DESCRIPTOR(DIImportedEntity)
-#undef DECLARE_SIMPLIFY_DESCRIPTOR
-
 typedef DebugNodeArray DIArray;
 typedef MDTypeRefArray DITypeArray;
 
 typedef DebugNodeArray DIArray;
 typedef MDTypeRefArray DITypeArray;
 
-class DISubrange {
-  MDSubrange *N;
-
-public:
-  DISubrange(const MDSubrange *N = nullptr) : N(const_cast<MDSubrange *>(N)) {}
-
-  operator MDSubrange *() const { return N; }
-  MDSubrange *operator->() const { return N; }
-  MDSubrange &operator*() const { return *N; }
-};
-
-class DIEnumerator {
-  MDEnumerator *N;
-
-public:
-  DIEnumerator(const MDEnumerator *N = nullptr)
-      : N(const_cast<MDEnumerator *>(N)) {}
-
-  operator MDEnumerator *() const { return N; }
-  MDEnumerator *operator->() const { return N; }
-  MDEnumerator &operator*() const { return *N; }
-};
-
-class DITemplateTypeParameter {
-  MDTemplateTypeParameter *N;
-
-public:
-  DITemplateTypeParameter(const MDTemplateTypeParameter *N = nullptr)
-      : N(const_cast<MDTemplateTypeParameter *>(N)) {}
-
-  operator MDTemplateTypeParameter *() const { return N; }
-  MDTemplateTypeParameter *operator->() const { return N; }
-  MDTemplateTypeParameter &operator*() const { return *N; }
-};
-
-class DITemplateValueParameter {
-  MDTemplateValueParameter *N;
-
-public:
-  DITemplateValueParameter(const MDTemplateValueParameter *N = nullptr)
-      : N(const_cast<MDTemplateValueParameter *>(N)) {}
-
-  operator MDTemplateValueParameter *() const { return N; }
-  MDTemplateValueParameter *operator->() const { return N; }
-  MDTemplateValueParameter &operator*() const { return *N; }
-};
-
-class DIGlobalVariable {
-  MDGlobalVariable *N;
-
-public:
-  DIGlobalVariable(const MDGlobalVariable *N = nullptr)
-      : N(const_cast<MDGlobalVariable *>(N)) {}
-
-  operator MDGlobalVariable *() const { return N; }
-  MDGlobalVariable *operator->() const { return N; }
-  MDGlobalVariable &operator*() const { return *N; }
-};
-
-class DIVariable {
-  MDLocalVariable *N;
-
-public:
-  DIVariable(const MDLocalVariable *N = nullptr)
-      : N(const_cast<MDLocalVariable *>(N)) {}
-
-  operator MDLocalVariable *() const { return N; }
-  MDLocalVariable *operator->() const { return N; }
-  MDLocalVariable &operator*() const { return *N; }
-};
-
-class DIExpression {
-  MDExpression *N;
-
-public:
-  DIExpression(const MDExpression *N = nullptr)
-      : N(const_cast<MDExpression *>(N)) {}
-
-  operator MDExpression *() const { return N; }
-  MDExpression *operator->() const { return N; }
-  MDExpression &operator*() const { return *N; }
-};
-
-class DILocation {
-  MDLocation *N;
-
-public:
-  DILocation(const MDLocation *N = nullptr) : N(const_cast<MDLocation *>(N)) {}
-
-  operator MDLocation *() const { return N; }
-  MDLocation *operator->() const { return N; }
-  MDLocation &operator*() const { return *N; }
-};
-
-class DIObjCProperty {
-  MDObjCProperty *N;
-
-public:
-  DIObjCProperty(const MDObjCProperty *N = nullptr)
-      : N(const_cast<MDObjCProperty *>(N)) {}
-
-  operator MDObjCProperty *() const { return N; }
-  MDObjCProperty *operator->() const { return N; }
-  MDObjCProperty &operator*() const { return *N; }
-};
-
-class DIImportedEntity {
-  MDImportedEntity *N;
-
-public:
-  DIImportedEntity(const MDImportedEntity *N = nullptr)
-      : N(const_cast<MDImportedEntity *>(N)) {}
-
-  operator MDImportedEntity *() const { return N; }
-  MDImportedEntity *operator->() const { return N; }
-  MDImportedEntity &operator*() const { return *N; }
-};
-
-#define SIMPLIFY_DESCRIPTOR(DESC)                                              \
-  template <> struct simplify_type<const DESC> {                               \
-    typedef Metadata *SimpleType;                                              \
-    static SimpleType getSimplifiedValue(const DESC &DI) { return DI; }        \
-  };                                                                           \
-  template <> struct simplify_type<DESC> : simplify_type<const DESC> {};
-SIMPLIFY_DESCRIPTOR(DISubrange)
-SIMPLIFY_DESCRIPTOR(DIEnumerator)
-SIMPLIFY_DESCRIPTOR(DITemplateTypeParameter)
-SIMPLIFY_DESCRIPTOR(DITemplateValueParameter)
-SIMPLIFY_DESCRIPTOR(DIGlobalVariable)
-SIMPLIFY_DESCRIPTOR(DIVariable)
-SIMPLIFY_DESCRIPTOR(DIExpression)
-SIMPLIFY_DESCRIPTOR(DILocation)
-SIMPLIFY_DESCRIPTOR(DIObjCProperty)
-SIMPLIFY_DESCRIPTOR(DIImportedEntity)
-#undef SIMPLIFY_DESCRIPTOR
-
 /// \brief Find subprogram that is enclosing this scope.
 MDSubprogram *getDISubprogram(const MDNode *Scope);
 
 /// \brief Find subprogram that is enclosing this scope.
 MDSubprogram *getDISubprogram(const MDNode *Scope);
 
@@ -251,7 +96,7 @@ public:
   void processDeclare(const Module &M, const DbgDeclareInst *DDI);
   /// \brief Process DbgValueInst.
   void processValue(const Module &M, const DbgValueInst *DVI);
   void processDeclare(const Module &M, const DbgDeclareInst *DDI);
   /// \brief Process DbgValueInst.
   void processValue(const Module &M, const DbgValueInst *DVI);
-  /// \brief Process DILocation.
+  /// \brief Process debug info location.
   void processLocation(const Module &M, const MDLocation *Loc);
 
   /// \brief Clear all lists.
   void processLocation(const Module &M, const MDLocation *Loc);
 
   /// \brief Clear all lists.
index f2a11cb461f600313b6e043a47a3231f8984dfbf..7ee2f9d6e59df148c7e99f501c7b5f3664b2d0ad 100644 (file)
@@ -90,7 +90,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
     O << '\n';
   }
 
     O << '\n';
   }
 
-  for (DIGlobalVariable GV : Finder.global_variables()) {
+  for (const MDGlobalVariable *GV : Finder.global_variables()) {
     O << "Global variable: " << GV->getName();
     printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine());
     if (!GV->getLinkageName().empty())
     O << "Global variable: " << GV->getName();
     printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine());
     if (!GV->getLinkageName().empty())
index 43d7a38e04aed79aa94fe14c015fb9267cc0a29d..ec76cd613768f5b65e976193d306375a71b303b4 100644 (file)
@@ -670,7 +670,7 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
   raw_svector_ostream OS(Str);
   OS << "DEBUG_VALUE: ";
 
   raw_svector_ostream OS(Str);
   OS << "DEBUG_VALUE: ";
 
-  DIVariable V = MI->getDebugVariable();
+  const MDLocalVariable *V = MI->getDebugVariable();
   if (auto *SP = dyn_cast<MDSubprogram>(V->getScope())) {
     StringRef Name = SP->getDisplayName();
     if (!Name.empty())
   if (auto *SP = dyn_cast<MDSubprogram>(V->getScope())) {
     StringRef Name = SP->getDisplayName();
     if (!Name.empty())
@@ -678,7 +678,7 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
   }
   OS << V->getName();
 
   }
   OS << V->getName();
 
-  DIExpression Expr = MI->getDebugExpression();
+  const MDExpression *Expr = MI->getDebugExpression();
   if (Expr->isBitPiece())
     OS << " [bit_piece offset=" << Expr->getBitPieceOffset()
        << " size=" << Expr->getBitPieceSize() << "]";
   if (Expr->isBitPiece())
     OS << " [bit_piece offset=" << Expr->getBitPieceOffset()
        << " size=" << Expr->getBitPieceSize() << "]";
index 1e3c5d769f15071fcaefa19375a173bbc1433050..9cb0aab77055b47b31eae9235d57bc557dec42c2 100644 (file)
@@ -204,7 +204,7 @@ void llvm::calculateDbgValueHistory(const MachineFunction *MF,
       // Use the base variable (without any DW_OP_piece expressions)
       // as index into History. The full variables including the
       // piece expressions are attached to the MI.
       // Use the base variable (without any DW_OP_piece expressions)
       // as index into History. The full variables including the
       // piece expressions are attached to the MI.
-      MDLocalVariable *RawVar = MI.getDebugVariable();
+      const MDLocalVariable *RawVar = MI.getDebugVariable();
       assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
              "Expected inlined-at fields to agree");
       InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt());
       assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
              "Expected inlined-at fields to agree");
       InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt());
index a2f6ae1eb738322e34fee75b7f97a2dd22df1f1b..ff3eb030a65cd6ec8465db822ac1977e6bd58182 100644 (file)
@@ -72,7 +72,7 @@ public:
     const ConstantInt *getConstantInt() const { return Constant.CIP; }
     MachineLocation getLoc() const { return Loc; }
     bool isBitPiece() const { return getExpression()->isBitPiece(); }
     const ConstantInt *getConstantInt() const { return Constant.CIP; }
     MachineLocation getLoc() const { return Loc; }
     bool isBitPiece() const { return getExpression()->isBitPiece(); }
-    DIExpression getExpression() const { return Expression; }
+    const MDExpression *getExpression() const { return Expression; }
     friend bool operator==(const Value &, const Value &);
     friend bool operator<(const Value &, const Value &);
   };
     friend bool operator==(const Value &, const Value &);
     friend bool operator<(const Value &, const Value &);
   };
@@ -94,9 +94,8 @@ public:
   /// Return true if the merge was successful.
   bool MergeValues(const DebugLocEntry &Next) {
     if (Begin == Next.Begin) {
   /// Return true if the merge was successful.
   bool MergeValues(const DebugLocEntry &Next) {
     if (Begin == Next.Begin) {
-      DIExpression Expr = cast_or_null<MDExpression>(Values[0].Expression);
-      DIExpression NextExpr =
-          cast_or_null<MDExpression>(Next.Values[0].Expression);
+      auto *Expr = cast_or_null<MDExpression>(Values[0].Expression);
+      auto *NextExpr = cast_or_null<MDExpression>(Next.Values[0].Expression);
       if (Expr->isBitPiece() && NextExpr->isBitPiece()) {
         addValues(Next.Values);
         End = Next.End;
       if (Expr->isBitPiece() && NextExpr->isBitPiece()) {
         addValues(Next.Values);
         End = Next.End;
index 3f22070acea95580364a2162578244c72ed00e4a..e661ddcd5672367cda99b208dbd8418165bd0f7b 100644 (file)
@@ -97,7 +97,8 @@ static const ConstantExpr *getMergedGlobalExpr(const Value *V) {
 }
 
 /// getOrCreateGlobalVariableDIE - get or create global variable DIE.
 }
 
 /// getOrCreateGlobalVariableDIE - get or create global variable DIE.
-DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(DIGlobalVariable GV) {
+DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
+    const MDGlobalVariable *GV) {
   // Check for pre-existence.
   if (DIE *Die = getDIE(GV))
     return Die;
   // Check for pre-existence.
   if (DIE *Die = getDIE(GV))
     return Die;
@@ -632,7 +633,7 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
 }
 
 std::unique_ptr<DIE>
 }
 
 std::unique_ptr<DIE>
-DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity &Module) {
+DwarfCompileUnit::constructImportedEntityDIE(const MDImportedEntity *Module) {
   std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module->getTag());
   insertDIE(Module, IMDie.get());
   DIE *EntityDie;
   std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module->getTag());
   insertDIE(Module, IMDie.get());
   DIE *EntityDie;
@@ -687,8 +688,8 @@ void DwarfCompileUnit::collectDeadVariables(const MDSubprogram *SP) {
   if (!SPDIE)
     SPDIE = getDIE(SP);
   assert(SPDIE);
   if (!SPDIE)
     SPDIE = getDIE(SP);
   assert(SPDIE);
-  for (DIVariable DV : Variables) {
-    DbgVariable NewVar(DV, nullptr, DIExpression(), DD);
+  for (const MDLocalVariable *DV : Variables) {
+    DbgVariable NewVar(DV, /* IA */ nullptr, /* Expr */ nullptr, DD);
     auto VariableDie = constructVariableDIE(NewVar);
     applyVariableAttributes(NewVar, *VariableDie);
     SPDIE->addChild(std::move(VariableDie));
     auto VariableDie = constructVariableDIE(NewVar);
     applyVariableAttributes(NewVar, *VariableDie);
     SPDIE->addChild(std::move(VariableDie));
@@ -763,7 +764,7 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,
   DIELoc *Loc = new (DIEValueAllocator) DIELoc();
   DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
   assert(DV.getExpression().size() == 1);
   DIELoc *Loc = new (DIEValueAllocator) DIELoc();
   DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
   assert(DV.getExpression().size() == 1);
-  DIExpression Expr = DV.getExpression().back();
+  const MDExpression *Expr = DV.getExpression().back();
   bool ValidReg;
   if (Location.getOffset()) {
     ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(),
   bool ValidReg;
   if (Location.getOffset()) {
     ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(),
index 6ea43c3f615c7e7ba6561e25f833810c361fbb5e..76811d9401c2b3832739ddf651c5aa5f73973e4f 100644 (file)
@@ -79,7 +79,7 @@ public:
   void applyStmtList(DIE &D);
 
   /// getOrCreateGlobalVariableDIE - get or create global variable DIE.
   void applyStmtList(DIE &D);
 
   /// getOrCreateGlobalVariableDIE - get or create global variable DIE.
-  DIE *getOrCreateGlobalVariableDIE(DIGlobalVariable GV);
+  DIE *getOrCreateGlobalVariableDIE(const MDGlobalVariable *GV);
 
   /// addLabelAddress - Add a dwarf label attribute data and value using
   /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
 
   /// addLabelAddress - Add a dwarf label attribute data and value using
   /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
@@ -156,7 +156,7 @@ public:
 
   /// \brief Construct import_module DIE.
   std::unique_ptr<DIE>
 
   /// \brief Construct import_module DIE.
   std::unique_ptr<DIE>
-  constructImportedEntityDIE(const DIImportedEntity &Module);
+  constructImportedEntityDIE(const MDImportedEntity *Module);
 
   void finishSubprogramDefinition(const MDSubprogram *SP);
 
 
   void finishSubprogramDefinition(const MDSubprogram *SP);
 
index 8226e1fe9aac0c635ab8e55ace591593040a1386..fdea05e50a2cca0970fdd2d9461eaa6ece4e637d 100644 (file)
@@ -422,10 +422,9 @@ DwarfDebug::constructDwarfCompileUnit(const MDCompileUnit *DIUnit) {
 }
 
 void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
 }
 
 void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
-                                                  const MDNode *N) {
-  DIImportedEntity Module = cast<MDImportedEntity>(N);
-  if (DIE *D = TheCU.getOrCreateContextDIE(Module->getScope()))
-    D->addChild(TheCU.constructImportedEntityDIE(Module));
+                                                  const MDImportedEntity *N) {
+  if (DIE *D = TheCU.getOrCreateContextDIE(N->getScope()))
+    D->addChild(TheCU.constructImportedEntityDIE(N));
 }
 
 // Emit all Dwarf sections that should come prior to the content. Create
 }
 
 // Emit all Dwarf sections that should come prior to the content. Create
@@ -661,8 +660,9 @@ void DwarfDebug::endModule() {
 }
 
 // Find abstract variable, if any, associated with Var.
 }
 
 // Find abstract variable, if any, associated with Var.
-DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV,
-                                                     DIVariable &Cleansed) {
+DbgVariable *
+DwarfDebug::getExistingAbstractVariable(InlinedVariable IV,
+                                        const MDLocalVariable *&Cleansed) {
   // More then one inlined variable corresponds to one abstract variable.
   Cleansed = IV.first;
   auto I = AbstractVariables.find(Cleansed);
   // More then one inlined variable corresponds to one abstract variable.
   Cleansed = IV.first;
   auto I = AbstractVariables.find(Cleansed);
@@ -672,21 +672,21 @@ DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV,
 }
 
 DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV) {
 }
 
 DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV) {
-  DIVariable Cleansed;
+  const MDLocalVariable *Cleansed;
   return getExistingAbstractVariable(IV, Cleansed);
 }
 
   return getExistingAbstractVariable(IV, Cleansed);
 }
 
-void DwarfDebug::createAbstractVariable(const DIVariable &Var,
+void DwarfDebug::createAbstractVariable(const MDLocalVariable *Var,
                                         LexicalScope *Scope) {
   auto AbsDbgVariable =
                                         LexicalScope *Scope) {
   auto AbsDbgVariable =
-      make_unique<DbgVariable>(Var, nullptr, DIExpression(), this);
+      make_unique<DbgVariable>(Var, /* IA */ nullptr, /* Expr */ nullptr, this);
   InfoHolder.addScopeVariable(Scope, AbsDbgVariable.get());
   AbstractVariables[Var] = std::move(AbsDbgVariable);
 }
 
 void DwarfDebug::ensureAbstractVariableIsCreated(InlinedVariable IV,
                                                  const MDNode *ScopeNode) {
   InfoHolder.addScopeVariable(Scope, AbsDbgVariable.get());
   AbstractVariables[Var] = std::move(AbsDbgVariable);
 }
 
 void DwarfDebug::ensureAbstractVariableIsCreated(InlinedVariable IV,
                                                  const MDNode *ScopeNode) {
-  DIVariable Cleansed;
+  const MDLocalVariable *Cleansed = nullptr;
   if (getExistingAbstractVariable(IV, Cleansed))
     return;
 
   if (getExistingAbstractVariable(IV, Cleansed))
     return;
 
@@ -696,7 +696,7 @@ void DwarfDebug::ensureAbstractVariableIsCreated(InlinedVariable IV,
 
 void DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(
     InlinedVariable IV, const MDNode *ScopeNode) {
 
 void DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(
     InlinedVariable IV, const MDNode *ScopeNode) {
-  DIVariable Cleansed;
+  const MDLocalVariable *Cleansed = nullptr;
   if (getExistingAbstractVariable(IV, Cleansed))
     return;
 
   if (getExistingAbstractVariable(IV, Cleansed))
     return;
 
@@ -722,7 +722,7 @@ void DwarfDebug::collectVariableInfoFromMMITable(
     if (!Scope)
       continue;
 
     if (!Scope)
       continue;
 
-    DIExpression Expr = cast_or_null<MDExpression>(VI.Expr);
+    const MDExpression *Expr = cast_or_null<MDExpression>(VI.Expr);
     ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode());
     auto RegVar =
         make_unique<DbgVariable>(Var.first, Var.second, Expr, this, VI.Slot);
     ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode());
     auto RegVar =
         make_unique<DbgVariable>(Var.first, Var.second, Expr, this, VI.Slot);
@@ -757,7 +757,7 @@ static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) {
 }
 
 /// Determine whether two variable pieces overlap.
 }
 
 /// Determine whether two variable pieces overlap.
-static bool piecesOverlap(DIExpression P1, DIExpression P2) {
+static bool piecesOverlap(const MDExpression *P1, const MDExpression *P2) {
   if (!P1->isBitPiece() || !P2->isBitPiece())
     return true;
   unsigned l1 = P1->getBitPieceOffset();
   if (!P1->isBitPiece() || !P2->isBitPiece())
     return true;
   unsigned l1 = P1->getBitPieceOffset();
@@ -809,7 +809,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
     }
 
     // If this piece overlaps with any open ranges, truncate them.
     }
 
     // If this piece overlaps with any open ranges, truncate them.
-    DIExpression DIExpr = Begin->getDebugExpression();
+    const MDExpression *DIExpr = Begin->getDebugExpression();
     auto Last = std::remove_if(OpenRanges.begin(), OpenRanges.end(),
                                [&](DebugLocEntry::Value R) {
       return piecesOverlap(DIExpr, R.getExpression());
     auto Last = std::remove_if(OpenRanges.begin(), OpenRanges.end(),
                                [&](DebugLocEntry::Value R) {
       return piecesOverlap(DIExpr, R.getExpression());
@@ -930,15 +930,14 @@ void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU,
   }
 
   // Collect info for variables that were optimized out.
   }
 
   // Collect info for variables that were optimized out.
-  for (DIVariable DV : SP->getVariables()) {
+  for (const MDLocalVariable *DV : SP->getVariables()) {
     if (!Processed.insert(InlinedVariable(DV, nullptr)).second)
       continue;
     if (LexicalScope *Scope = LScopes.findLexicalScope(DV->getScope())) {
       ensureAbstractVariableIsCreatedIfScoped(InlinedVariable(DV, nullptr),
                                               Scope->getScopeNode());
     if (!Processed.insert(InlinedVariable(DV, nullptr)).second)
       continue;
     if (LexicalScope *Scope = LScopes.findLexicalScope(DV->getScope())) {
       ensureAbstractVariableIsCreatedIfScoped(InlinedVariable(DV, nullptr),
                                               Scope->getScopeNode());
-      DIExpression NoExpr;
-      ConcreteVariables.push_back(
-          make_unique<DbgVariable>(DV, nullptr, NoExpr, this));
+      ConcreteVariables.push_back(make_unique<DbgVariable>(
+          DV, /* IA */ nullptr, /* Expr */ nullptr, this));
       InfoHolder.addScopeVariable(Scope, ConcreteVariables.back().get());
     }
   }
       InfoHolder.addScopeVariable(Scope, ConcreteVariables.back().get());
     }
   }
@@ -1129,14 +1128,14 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
 
     // The first mention of a function argument gets the CurrentFnBegin
     // label, so arguments are visible when breaking at function entry.
 
     // The first mention of a function argument gets the CurrentFnBegin
     // label, so arguments are visible when breaking at function entry.
-    DIVariable DIVar = Ranges.front().first->getDebugVariable();
+    const MDLocalVariable *DIVar = Ranges.front().first->getDebugVariable();
     if (DIVar->getTag() == dwarf::DW_TAG_arg_variable &&
         getDISubprogram(DIVar->getScope())->describes(MF->getFunction())) {
       LabelsBeforeInsn[Ranges.front().first] = Asm->getFunctionBegin();
       if (Ranges.front().first->getDebugExpression()->isBitPiece()) {
         // Mark all non-overlapping initial pieces.
         for (auto I = Ranges.begin(); I != Ranges.end(); ++I) {
     if (DIVar->getTag() == dwarf::DW_TAG_arg_variable &&
         getDISubprogram(DIVar->getScope())->describes(MF->getFunction())) {
       LabelsBeforeInsn[Ranges.front().first] = Asm->getFunctionBegin();
       if (Ranges.front().first->getDebugExpression()->isBitPiece()) {
         // Mark all non-overlapping initial pieces.
         for (auto I = Ranges.begin(); I != Ranges.end(); ++I) {
-          DIExpression Piece = I->first->getDebugExpression();
+          const MDExpression *Piece = I->first->getDebugExpression();
           if (std::all_of(Ranges.begin(), I,
                           [&](DbgValueHistoryMap::InstrRange Pred) {
                 return !piecesOverlap(Piece, Pred.first->getDebugExpression());
           if (std::all_of(Ranges.begin(), I,
                           [&](DbgValueHistoryMap::InstrRange Pred) {
                 return !piecesOverlap(Piece, Pred.first->getDebugExpression());
@@ -1219,7 +1218,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
   for (LexicalScope *AScope : LScopes.getAbstractScopesList()) {
     auto *SP = cast<MDSubprogram>(AScope->getScopeNode());
     // Collect info for variables that were optimized out.
   for (LexicalScope *AScope : LScopes.getAbstractScopesList()) {
     auto *SP = cast<MDSubprogram>(AScope->getScopeNode());
     // Collect info for variables that were optimized out.
-    for (DIVariable DV : SP->getVariables()) {
+    for (const MDLocalVariable *DV : SP->getVariables()) {
       if (!ProcessedVars.insert(InlinedVariable(DV, nullptr)).second)
         continue;
       ensureAbstractVariableIsCreated(InlinedVariable(DV, nullptr),
       if (!ProcessedVars.insert(InlinedVariable(DV, nullptr)).second)
         continue;
       ensureAbstractVariableIsCreated(InlinedVariable(DV, nullptr),
@@ -1488,7 +1487,7 @@ static void emitDebugLocValue(const AsmPrinter &AP, const MDBasicType *BT,
       DwarfExpr.AddUnsignedConstant(Value.getInt());
   } else if (Value.isLocation()) {
     MachineLocation Loc = Value.getLoc();
       DwarfExpr.AddUnsignedConstant(Value.getInt());
   } else if (Value.isLocation()) {
     MachineLocation Loc = Value.getLoc();
-    DIExpression Expr = Value.getExpression();
+    const MDExpression *Expr = Value.getExpression();
     if (!Expr || !Expr->getNumElements())
       // Regular entry.
       AP.EmitDwarfRegOp(Streamer, Loc);
     if (!Expr || !Expr->getNumElements())
       // Regular entry.
       AP.EmitDwarfRegOp(Streamer, Loc);
@@ -1523,7 +1522,7 @@ void DebugLocEntry::finalize(const AsmPrinter &AP, DebugLocStream &Locs,
    
     unsigned Offset = 0;
     for (auto Piece : Values) {
    
     unsigned Offset = 0;
     for (auto Piece : Values) {
-      DIExpression Expr = Piece.getExpression();
+      const MDExpression *Expr = Piece.getExpression();
       unsigned PieceOffset = Expr->getBitPieceOffset();
       unsigned PieceSize = Expr->getBitPieceSize();
       assert(Offset <= PieceOffset && "overlapping or duplicate pieces");
       unsigned PieceOffset = Expr->getBitPieceOffset();
       unsigned PieceSize = Expr->getBitPieceSize();
       assert(Offset <= PieceOffset && "overlapping or duplicate pieces");
index c33a07b0b4267821aa2bf3e31222eab94ce1d693..708fb8f01e5fb1745cfc62cd3d8506b3ff44c79f 100644 (file)
@@ -75,9 +75,10 @@ public:
 /// - Variables that are described by multiple MMI table entries have multiple
 ///   expressions and frame indices.
 class DbgVariable {
 /// - Variables that are described by multiple MMI table entries have multiple
 ///   expressions and frame indices.
 class DbgVariable {
-  DIVariable Var;                    /// Variable Descriptor.
-  DILocation IA;                     /// Inlined at location.
-  SmallVector<DIExpression, 1> Expr; /// Complex address location expression.
+  const MDLocalVariable *Var; /// Variable Descriptor.
+  const MDLocation *IA;       /// Inlined at location.
+  SmallVector<const MDExpression *, 1>
+      Expr;                          /// Complex address location expression.
   DIE *TheDIE;                /// Variable DIE.
   unsigned DebugLocListIndex;        /// Offset in DebugLocs.
   const MachineInstr *MInsn;  /// DBG_VALUE instruction of the variable.
   DIE *TheDIE;                /// Variable DIE.
   unsigned DebugLocListIndex;        /// Offset in DebugLocs.
   const MachineInstr *MInsn;  /// DBG_VALUE instruction of the variable.
@@ -85,9 +86,9 @@ class DbgVariable {
   DwarfDebug *DD;
 
 public:
   DwarfDebug *DD;
 
 public:
-  /// Construct a DbgVariable from a DIVariable.
-  DbgVariable(DIVariable V, DILocation IA, DIExpression E, DwarfDebug *DD,
-              int FI = ~0)
+  /// Construct a DbgVariable from a variable.
+  DbgVariable(const MDLocalVariable *V, const MDLocation *IA,
+              const MDExpression *E, DwarfDebug *DD, int FI = ~0)
       : Var(V), IA(IA), Expr(1, E), TheDIE(nullptr), DebugLocListIndex(~0U),
         MInsn(nullptr), DD(DD) {
     FrameIndex.push_back(FI);
       : Var(V), IA(IA), Expr(1, E), TheDIE(nullptr), DebugLocListIndex(~0U),
         MInsn(nullptr), DD(DD) {
     FrameIndex.push_back(FI);
@@ -105,9 +106,9 @@ public:
   }
 
   // Accessors.
   }
 
   // Accessors.
-  DIVariable getVariable() const { return Var; }
-  DILocation getInlinedAt() const { return IA; }
-  const ArrayRef<DIExpression> getExpression() const { return Expr; }
+  const MDLocalVariable *getVariable() const { return Var; }
+  const MDLocation *getInlinedAt() const { return IA; }
+  const ArrayRef<const MDExpression *> getExpression() const { return Expr; }
   void setDIE(DIE &D) { TheDIE = &D; }
   DIE *getDIE() const { return TheDIE; }
   void setDebugLocListIndex(unsigned O) { DebugLocListIndex = O; }
   void setDIE(DIE &D) { TheDIE = &D; }
   DIE *getDIE() const { return TheDIE; }
   void setDebugLocListIndex(unsigned O) { DebugLocListIndex = O; }
@@ -119,7 +120,7 @@ public:
   void addMMIEntry(const DbgVariable &V) {
     assert(DebugLocListIndex == ~0U && !MInsn && "not an MMI entry");
     assert(V.DebugLocListIndex == ~0U && !V.MInsn && "not an MMI entry");
   void addMMIEntry(const DbgVariable &V) {
     assert(DebugLocListIndex == ~0U && !MInsn && "not an MMI entry");
     assert(V.DebugLocListIndex == ~0U && !V.MInsn && "not an MMI entry");
-    assert(V.Var == Var && "conflicting DIVariable");
+    assert(V.Var == Var && "conflicting variable");
     assert(V.IA == IA && "conflicting inlined-at location");
 
     if (V.getFrameIndex().back() != ~0) {
     assert(V.IA == IA && "conflicting inlined-at location");
 
     if (V.getFrameIndex().back() != ~0) {
@@ -128,10 +129,11 @@ public:
       Expr.append(E.begin(), E.end());
       FrameIndex.append(FI.begin(), FI.end());
     }
       Expr.append(E.begin(), E.end());
       FrameIndex.append(FI.begin(), FI.end());
     }
-    assert(Expr.size() > 1
-               ? std::all_of(Expr.begin(), Expr.end(),
-                             [](DIExpression &E) { return E->isBitPiece(); })
-               : (true && "conflicting locations for variable"));
+    assert(Expr.size() > 1 ? std::all_of(Expr.begin(), Expr.end(),
+                                         [](const MDExpression *E) {
+                                           return E->isBitPiece();
+                                         })
+                           : (true && "conflicting locations for variable"));
   }
 
   // Translate tag to proper Dwarf tag.
   }
 
   // Translate tag to proper Dwarf tag.
@@ -334,9 +336,9 @@ class DwarfDebug : public AsmPrinterHandler {
 
   /// \brief Find abstract variable associated with Var.
   DbgVariable *getExistingAbstractVariable(InlinedVariable IV,
 
   /// \brief Find abstract variable associated with Var.
   DbgVariable *getExistingAbstractVariable(InlinedVariable IV,
-                                           DIVariable &Cleansed);
+                                           const MDLocalVariable *&Cleansed);
   DbgVariable *getExistingAbstractVariable(InlinedVariable IV);
   DbgVariable *getExistingAbstractVariable(InlinedVariable IV);
-  void createAbstractVariable(const DIVariable &DV, LexicalScope *Scope);
+  void createAbstractVariable(const MDLocalVariable *DV, LexicalScope *Scope);
   void ensureAbstractVariableIsCreated(InlinedVariable Var,
                                        const MDNode *Scope);
   void ensureAbstractVariableIsCreatedIfScoped(InlinedVariable Var,
   void ensureAbstractVariableIsCreated(InlinedVariable Var,
                                        const MDNode *Scope);
   void ensureAbstractVariableIsCreatedIfScoped(InlinedVariable Var,
@@ -455,7 +457,7 @@ class DwarfDebug : public AsmPrinterHandler {
 
   /// \brief Construct imported_module or imported_declaration DIE.
   void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
 
   /// \brief Construct imported_module or imported_declaration DIE.
   void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
-                                        const MDNode *N);
+                                        const MDImportedEntity *N);
 
   /// \brief Register a source line with debug info. Returns the unique
   /// label that was emitted and which provides correspondence to the
 
   /// \brief Register a source line with debug info. Returns the unique
   /// label that was emitted and which provides correspondence to the
index e576c93035e379c290256a73f4158c20a871d6f2..fbe209a6663d7c4fb50313d2d433a6488609bf34 100644 (file)
@@ -192,7 +192,7 @@ static unsigned getOffsetOrZero(unsigned OffsetInBits,
   return OffsetInBits;
 }
 
   return OffsetInBits;
 }
 
-bool DwarfExpression::AddMachineRegExpression(DIExpression Expr,
+bool DwarfExpression::AddMachineRegExpression(const MDExpression *Expr,
                                               unsigned MachineReg,
                                               unsigned PieceOffsetInBits) {
   auto I = Expr->expr_op_begin();
                                               unsigned MachineReg,
                                               unsigned PieceOffsetInBits) {
   auto I = Expr->expr_op_begin();
@@ -259,7 +259,7 @@ void DwarfExpression::AddExpression(MDExpression::expr_op_iterator I,
       EmitOp(dwarf::DW_OP_deref);
       break;
     default:
       EmitOp(dwarf::DW_OP_deref);
       break;
     default:
-      llvm_unreachable("unhandled opcode found in DIExpression");
+      llvm_unreachable("unhandled opcode found in expression");
     }
   }
 }
     }
   }
 }
index a8b65f504346ea2f63063cc1a0dc9ab8b347c771..3b77a44c28aaddaff32f67e13e1fb8bcc541c341 100644 (file)
@@ -88,11 +88,12 @@ public:
   /// Emit an unsigned constant.
   void AddUnsignedConstant(unsigned Value);
 
   /// Emit an unsigned constant.
   void AddUnsignedConstant(unsigned Value);
 
-  /// Emit an entire DIExpression on top of a machine register location.
+  /// \brief Emit an entire expression on top of a machine register location.
+  ///
   /// \param PieceOffsetInBits If this is one piece out of a fragmented
   /// location, this is the offset of the piece inside the entire variable.
   /// \return false if no DWARF register exists for MachineReg.
   /// \param PieceOffsetInBits If this is one piece out of a fragmented
   /// location, this is the offset of the piece inside the entire variable.
   /// \return false if no DWARF register exists for MachineReg.
-  bool AddMachineRegExpression(DIExpression Expr, unsigned MachineReg,
+  bool AddMachineRegExpression(const MDExpression *Expr, unsigned MachineReg,
                                unsigned PieceOffsetInBits = 0);
   /// Emit a the operations remaining the DIExpressionIterator I.
   /// \param PieceOffsetInBits If this is one piece out of a fragmented
                                unsigned PieceOffsetInBits = 0);
   /// Emit a the operations remaining the DIExpressionIterator I.
   /// \param PieceOffsetInBits If this is one piece out of a fragmented
index 32adb40f5a2ad5713674d6ae4c249b3178aa9a38..29a163b8f060d84879ff68fea5db9d341126cb15 100644 (file)
@@ -137,7 +137,7 @@ void DwarfFile::emitStrings(const MCSection *StrSection,
 
 bool DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) {
   SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS];
 
 bool DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) {
   SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS];
-  DIVariable DV = Var->getVariable();
+  const MDLocalVariable *DV = Var->getVariable();
   // Variables with positive arg numbers are parameters.
   if (unsigned ArgNum = DV->getArg()) {
     // Keep all parameters in order at the start of the variable list to ensure
   // Variables with positive arg numbers are parameters.
   if (unsigned ArgNum = DV->getArg()) {
     // Keep all parameters in order at the start of the variable list to ensure
index 750b8525695b925551f3739f7e8cd481b1577636..ad1ef544b01b3c0546750ef4447f586ed796ac90 100644 (file)
@@ -354,14 +354,14 @@ void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, StringRef File,
   addUInt(Die, dwarf::DW_AT_decl_line, None, Line);
 }
 
   addUInt(Die, dwarf::DW_AT_decl_line, None, Line);
 }
 
-void DwarfUnit::addSourceLine(DIE &Die, DIVariable V) {
+void DwarfUnit::addSourceLine(DIE &Die, const MDLocalVariable *V) {
   assert(V);
 
   addSourceLine(Die, V->getLine(), V->getScope()->getFilename(),
                 V->getScope()->getDirectory());
 }
 
   assert(V);
 
   addSourceLine(Die, V->getLine(), V->getScope()->getFilename(),
                 V->getScope()->getDirectory());
 }
 
-void DwarfUnit::addSourceLine(DIE &Die, DIGlobalVariable G) {
+void DwarfUnit::addSourceLine(DIE &Die, const MDGlobalVariable *G) {
   assert(G);
 
   addSourceLine(Die, G->getLine(), G->getFilename(), G->getDirectory());
   assert(G);
 
   addSourceLine(Die, G->getLine(), G->getFilename(), G->getDirectory());
@@ -379,7 +379,7 @@ void DwarfUnit::addSourceLine(DIE &Die, const MDType *Ty) {
   addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory());
 }
 
   addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory());
 }
 
-void DwarfUnit::addSourceLine(DIE &Die, DIObjCProperty Ty) {
+void DwarfUnit::addSourceLine(DIE &Die, const MDObjCProperty *Ty) {
   assert(Ty);
 
   addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory());
   assert(Ty);
 
   addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory());
@@ -976,7 +976,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
         } else {
           constructMemberDIE(Buffer, DDTy);
         }
         } else {
           constructMemberDIE(Buffer, DDTy);
         }
-      } else if (DIObjCProperty Property = dyn_cast<MDObjCProperty>(Element)) {
+      } else if (auto *Property = dyn_cast<MDObjCProperty>(Element)) {
         DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer);
         StringRef PropertyName = Property->getName();
         addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
         DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer);
         StringRef PropertyName = Property->getName();
         addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
@@ -1057,8 +1057,8 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
   }
 }
 
   }
 }
 
-void DwarfUnit::constructTemplateTypeParameterDIE(DIE &Buffer,
-                                                  DITemplateTypeParameter TP) {
+void DwarfUnit::constructTemplateTypeParameterDIE(
+    DIE &Buffer, const MDTemplateTypeParameter *TP) {
   DIE &ParamDIE =
       createAndAddDIE(dwarf::DW_TAG_template_type_parameter, Buffer);
   // Add the type if it exists, it could be void and therefore no type.
   DIE &ParamDIE =
       createAndAddDIE(dwarf::DW_TAG_template_type_parameter, Buffer);
   // Add the type if it exists, it could be void and therefore no type.
@@ -1068,9 +1068,8 @@ void DwarfUnit::constructTemplateTypeParameterDIE(DIE &Buffer,
     addString(ParamDIE, dwarf::DW_AT_name, TP->getName());
 }
 
     addString(ParamDIE, dwarf::DW_AT_name, TP->getName());
 }
 
-void
-DwarfUnit::constructTemplateValueParameterDIE(DIE &Buffer,
-                                              DITemplateValueParameter VP) {
+void DwarfUnit::constructTemplateValueParameterDIE(
+    DIE &Buffer, const MDTemplateValueParameter *VP) {
   DIE &ParamDIE = createAndAddDIE(VP->getTag(), Buffer);
 
   // Add the type if there is one, template template and template parameter
   DIE &ParamDIE = createAndAddDIE(VP->getTag(), Buffer);
 
   // Add the type if there is one, template template and template parameter
@@ -1270,7 +1269,8 @@ void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie,
     addFlag(SPDie, dwarf::DW_AT_explicit);
 }
 
     addFlag(SPDie, dwarf::DW_AT_explicit);
 }
 
-void DwarfUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy) {
+void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const MDSubrange *SR,
+                                     DIE *IndexTy) {
   DIE &DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer);
   addDIEEntry(DW_Subrange, dwarf::DW_AT_type, *IndexTy);
 
   DIE &DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer);
   addDIEEntry(DW_Subrange, dwarf::DW_AT_type, *IndexTy);
 
index a236a4a7a97b16d7eebf471a70460c59238ef3c5..7041f376ef4b996fa7a8ecd1535f74a5a0ef66af 100644 (file)
@@ -246,12 +246,12 @@ public:
   /// \brief Add location information to specified debug information entry.
   void addSourceLine(DIE &Die, unsigned Line, StringRef File,
                      StringRef Directory);
   /// \brief Add location information to specified debug information entry.
   void addSourceLine(DIE &Die, unsigned Line, StringRef File,
                      StringRef Directory);
-  void addSourceLine(DIE &Die, DIVariable V);
-  void addSourceLine(DIE &Die, DIGlobalVariable G);
+  void addSourceLine(DIE &Die, const MDLocalVariable *V);
+  void addSourceLine(DIE &Die, const MDGlobalVariable *G);
   void addSourceLine(DIE &Die, const MDSubprogram *SP);
   void addSourceLine(DIE &Die, const MDType *Ty);
   void addSourceLine(DIE &Die, const MDNamespace *NS);
   void addSourceLine(DIE &Die, const MDSubprogram *SP);
   void addSourceLine(DIE &Die, const MDType *Ty);
   void addSourceLine(DIE &Die, const MDNamespace *NS);
-  void addSourceLine(DIE &Die, DIObjCProperty Ty);
+  void addSourceLine(DIE &Die, const MDObjCProperty *Ty);
 
   /// \brief Add constant value entry in variable DIE.
   void addConstantValue(DIE &Die, const MachineOperand &MO, const MDType *Ty);
 
   /// \brief Add constant value entry in variable DIE.
   void addConstantValue(DIE &Die, const MachineOperand &MO, const MDType *Ty);
@@ -355,14 +355,14 @@ private:
   void constructTypeDIE(DIE &Buffer, const MDBasicType *BTy);
   void constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy);
   void constructTypeDIE(DIE &Buffer, const MDSubroutineType *DTy);
   void constructTypeDIE(DIE &Buffer, const MDBasicType *BTy);
   void constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy);
   void constructTypeDIE(DIE &Buffer, const MDSubroutineType *DTy);
-  void constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy);
+  void constructSubrangeDIE(DIE &Buffer, const MDSubrange *SR, DIE *IndexTy);
   void constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
   void constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
   void constructMemberDIE(DIE &Buffer, const MDDerivedType *DT);
   void constructTemplateTypeParameterDIE(DIE &Buffer,
   void constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
   void constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
   void constructMemberDIE(DIE &Buffer, const MDDerivedType *DT);
   void constructTemplateTypeParameterDIE(DIE &Buffer,
-                                         DITemplateTypeParameter TP);
+                                         const MDTemplateTypeParameter *TP);
   void constructTemplateValueParameterDIE(DIE &Buffer,
   void constructTemplateValueParameterDIE(DIE &Buffer,
-                                          DITemplateValueParameter TVP);
+                                          const MDTemplateValueParameter *TVP);
 
   /// \brief Return the default lower bound for an array.
   ///
 
   /// \brief Return the default lower bound for an array.
   ///
index c2993db6c5ac24d44d9089d8a0f69d17f33b9046..df48c53f16bcf206107812b2d9dccc2d7b01897b 100644 (file)
@@ -394,7 +394,7 @@ static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V,
 }
 
 void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) {
 }
 
 void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) {
-  DIVariable DV = cast<MDLocalVariable>(Variable);
+  auto *DV = cast<MDLocalVariable>(Variable);
   OS << "!\"";
   printExtendedName(OS, DV, dl);
 
   OS << "!\"";
   printExtendedName(OS, DV, dl);
 
index d15411026cbd9d0baa4bacb5701574475ec75775..86d33b0c0b0908f92fad0819024283ff31be053e 100644 (file)
@@ -1619,7 +1619,7 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
     }
     if (isDebugValue() && MO.isMetadata()) {
       // Pretty print DBG_VALUE instructions.
     }
     if (isDebugValue() && MO.isMetadata()) {
       // Pretty print DBG_VALUE instructions.
-      DIVariable DIV = dyn_cast<MDLocalVariable>(MO.getMetadata());
+      auto *DIV = dyn_cast<MDLocalVariable>(MO.getMetadata());
       if (DIV && !DIV->getName().empty())
         OS << "!\"" << DIV->getName() << '\"';
       else
       if (DIV && !DIV->getName().empty())
         OS << "!\"" << DIV->getName() << '\"';
       else
@@ -1710,7 +1710,7 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
   // Print debug location information.
   if (isDebugValue() && getOperand(e - 2).isMetadata()) {
     if (!HaveSemi) OS << ";";
   // Print debug location information.
   if (isDebugValue() && getOperand(e - 2).isMetadata()) {
     if (!HaveSemi) OS << ";";
-    DIVariable DV = cast<MDLocalVariable>(getOperand(e - 2).getMetadata());
+    auto *DV = cast<MDLocalVariable>(getOperand(e - 2).getMetadata());
     OS << " line no:" <<  DV->getLine();
     if (auto *InlinedAt = debugLoc->getInlinedAt()) {
       DebugLoc InlinedAtDL(InlinedAt);
     OS << " line no:" <<  DV->getLine();
     if (auto *InlinedAt = debugLoc->getInlinedAt()) {
       DebugLoc InlinedAtDL(InlinedAt);
index 49ea4b4b5a363335329050b7a6c8e5f998d356ad..746a9efaa4d1eaa50b3abfda7c735637f1c4cb65 100644 (file)
@@ -4463,8 +4463,7 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
   // Ignore inlined function arguments here.
   //
   // FIXME: Should we be checking DL->inlinedAt() to determine this?
   // Ignore inlined function arguments here.
   //
   // FIXME: Should we be checking DL->inlinedAt() to determine this?
-  DIVariable DV(Variable);
-  if (!DV->getScope()->getSubprogram()->describes(MF.getFunction()))
+  if (!Variable->getScope()->getSubprogram()->describes(MF.getFunction()))
     return false;
 
   Optional<MachineOperand> Op;
     return false;
 
   Optional<MachineOperand> Op;
@@ -4672,9 +4671,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
       if (const BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
         Address = BCI->getOperand(0);
       // Parameters are handled specially.
       if (const BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
         Address = BCI->getOperand(0);
       // Parameters are handled specially.
-      bool isParameter =
-        (DIVariable(Variable)->getTag() == dwarf::DW_TAG_arg_variable ||
-         isa<Argument>(Address));
+      bool isParameter = Variable->getTag() == dwarf::DW_TAG_arg_variable ||
+                         isa<Argument>(Address);
 
       const AllocaInst *AI = dyn_cast<AllocaInst>(Address);
 
 
       const AllocaInst *AI = dyn_cast<AllocaInst>(Address);
 
index ef43dd2d37b9989649d3318ac6c9a464ea092189..bcead02d80a2c6a649482583cbe96c0cfd282f77 100644 (file)
@@ -321,11 +321,8 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
     }
 
     // Create our live global variable list.
     }
 
     // Create our live global variable list.
-    MDGlobalVariableArray GVs = DIC->getGlobalVariables();
     bool GlobalVariableChange = false;
     bool GlobalVariableChange = false;
-    for (unsigned i = 0, e = GVs.size(); i != e; ++i) {
-      DIGlobalVariable DIG = GVs[i];
-
+    for (MDGlobalVariable *DIG : DIC->getGlobalVariables()) {
       // Make sure we only visit each global variable only once.
       if (!VisitedSet.insert(DIG).second)
         continue;
       // Make sure we only visit each global variable only once.
       if (!VisitedSet.insert(DIG).second)
         continue;
index 59dc52811c96547d6ee13946e3663992c8e53642..e11ab33b0fb8fc50950cdc02cd595d5279f554d5 100644 (file)
@@ -1166,9 +1166,9 @@ public:
       } else {
         continue;
       }
       } else {
         continue;
       }
-      DIB.insertDbgValueIntrinsic(Arg, 0, DIVariable(DVI->getVariable()),
-                                  DIExpression(DVI->getExpression()),
-                                  DVI->getDebugLoc(), Inst);
+      DIB.insertDbgValueIntrinsic(Arg, 0, DVI->getVariable(),
+                                  DVI->getExpression(), DVI->getDebugLoc(),
+                                  Inst);
     }
   }
 };
     }
   }
 };
@@ -4181,15 +4181,15 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &AS) {
   // Migrate debug information from the old alloca to the new alloca(s)
   // and the individial partitions.
   if (DbgDeclareInst *DbgDecl = FindAllocaDbgDeclare(&AI)) {
   // Migrate debug information from the old alloca to the new alloca(s)
   // and the individial partitions.
   if (DbgDeclareInst *DbgDecl = FindAllocaDbgDeclare(&AI)) {
-    DIVariable Var(DbgDecl->getVariable());
-    DIExpression Expr(DbgDecl->getExpression());
+    auto *Var = DbgDecl->getVariable();
+    auto *Expr = DbgDecl->getExpression();
     DIBuilder DIB(*AI.getParent()->getParent()->getParent(),
                   /*AllowUnresolved*/ false);
     bool IsSplit = Pieces.size() > 1;
     for (auto Piece : Pieces) {
       // Create a piece expression describing the new partition or reuse AI's
       // expression if there is only one partition.
     DIBuilder DIB(*AI.getParent()->getParent()->getParent(),
                   /*AllowUnresolved*/ false);
     bool IsSplit = Pieces.size() > 1;
     for (auto Piece : Pieces) {
       // Create a piece expression describing the new partition or reuse AI's
       // expression if there is only one partition.
-      DIExpression PieceExpr = Expr;
+      auto *PieceExpr = Expr;
       if (IsSplit || Expr->isBitPiece()) {
         // If this alloca is already a scalar replacement of a larger aggregate,
         // Piece.Offset describes the offset inside the scalar.
       if (IsSplit || Expr->isBitPiece()) {
         // If this alloca is already a scalar replacement of a larger aggregate,
         // Piece.Offset describes the offset inside the scalar.
index f99fe3f5512120156154d6fa4128e357a6ec803f..f4936b5706213169ba9a73d4e748fd7b53dc8a37 100644 (file)
@@ -224,7 +224,7 @@ unsigned SampleProfileLoader::getInstWeight(Instruction &Inst) {
   if (Lineno < HeaderLineno)
     return 0;
 
   if (Lineno < HeaderLineno)
     return 0;
 
-  DILocation DIL = DLoc.get();
+  const MDLocation *DIL = DLoc;
   int LOffset = Lineno - HeaderLineno;
   unsigned Discriminator = DIL->getDiscriminator();
   unsigned Weight = Samples->samplesAt(LOffset, Discriminator);
   int LOffset = Lineno - HeaderLineno;
   unsigned Discriminator = DIL->getDiscriminator();
   unsigned Weight = Samples->samplesAt(LOffset, Discriminator);
index 693c5ae9708c1fdcaed055a9b3be4c06969e184a..03fff1df5d95dee108def21ce0e9286b99ec2bb7 100644 (file)
@@ -1117,9 +1117,9 @@ public:
       } else {
         continue;
       }
       } else {
         continue;
       }
-      DIB->insertDbgValueIntrinsic(Arg, 0, DIVariable(DVI->getVariable()),
-                                   DIExpression(DVI->getExpression()),
-                                   DVI->getDebugLoc(), Inst);
+      DIB->insertDbgValueIntrinsic(Arg, 0, DVI->getVariable(),
+                                   DVI->getExpression(), DVI->getDebugLoc(),
+                                   Inst);
     }
   }
 };
     }
   }
 };
index dd88f3d0a266a45f2ca5b565d466be3c71c719ba..125aab2fe880eafab1bdfccc83bd1ab2f3586501 100644 (file)
@@ -174,14 +174,14 @@ bool AddDiscriminators::runOnFunction(Function &F) {
   for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
     BasicBlock *B = I;
     TerminatorInst *Last = B->getTerminator();
   for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
     BasicBlock *B = I;
     TerminatorInst *Last = B->getTerminator();
-    DILocation LastDIL = Last->getDebugLoc().get();
+    const MDLocation *LastDIL = Last->getDebugLoc();
     if (!LastDIL)
       continue;
 
     for (unsigned I = 0; I < Last->getNumSuccessors(); ++I) {
       BasicBlock *Succ = Last->getSuccessor(I);
       Instruction *First = Succ->getFirstNonPHIOrDbgOrLifetime();
     if (!LastDIL)
       continue;
 
     for (unsigned I = 0; I < Last->getNumSuccessors(); ++I) {
       BasicBlock *Succ = Last->getSuccessor(I);
       Instruction *First = Succ->getFirstNonPHIOrDbgOrLifetime();
-      DILocation FirstDIL = First->getDebugLoc().get();
+      const MDLocation *FirstDIL = First->getDebugLoc();
       if (!FirstDIL)
         continue;
 
       if (!FirstDIL)
         continue;
 
index 5672a36a45838a665e702c81f359f65b0b02db63..492dc07d1eb8991d998be4316eada2d8f9359068 100644 (file)
@@ -978,7 +978,7 @@ unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
 ///
 
 /// See if there is a dbg.value intrinsic for DIVar before I.
 ///
 
 /// See if there is a dbg.value intrinsic for DIVar before I.
-static bool LdStHasDebugValue(DIVariable &DIVar, Instruction *I) {
+static bool LdStHasDebugValue(const MDLocalVariable *DIVar, Instruction *I) {
   // Since we can't guarantee that the original dbg.declare instrinsic
   // is removed by LowerDbgDeclare(), we need to make sure that we are
   // not inserting the same dbg.value intrinsic over and over.
   // Since we can't guarantee that the original dbg.declare instrinsic
   // is removed by LowerDbgDeclare(), we need to make sure that we are
   // not inserting the same dbg.value intrinsic over and over.
@@ -998,8 +998,8 @@ static bool LdStHasDebugValue(DIVariable &DIVar, Instruction *I) {
 /// that has an associated llvm.dbg.decl intrinsic.
 bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
                                            StoreInst *SI, DIBuilder &Builder) {
 /// that has an associated llvm.dbg.decl intrinsic.
 bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
                                            StoreInst *SI, DIBuilder &Builder) {
-  DIVariable DIVar = DDI->getVariable();
-  DIExpression DIExpr = DDI->getExpression();
+  auto *DIVar = DDI->getVariable();
+  auto *DIExpr = DDI->getExpression();
   assert(DIVar && "Missing variable");
 
   if (LdStHasDebugValue(DIVar, SI))
   assert(DIVar && "Missing variable");
 
   if (LdStHasDebugValue(DIVar, SI))
@@ -1025,8 +1025,8 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
 /// that has an associated llvm.dbg.decl intrinsic.
 bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
                                            LoadInst *LI, DIBuilder &Builder) {
 /// that has an associated llvm.dbg.decl intrinsic.
 bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
                                            LoadInst *LI, DIBuilder &Builder) {
-  DIVariable DIVar = DDI->getVariable();
-  DIExpression DIExpr = DDI->getExpression();
+  auto *DIVar = DDI->getVariable();
+  auto *DIExpr = DDI->getExpression();
   assert(DIVar && "Missing variable");
 
   if (LdStHasDebugValue(DIVar, LI))
   assert(DIVar && "Missing variable");
 
   if (LdStHasDebugValue(DIVar, LI))
@@ -1075,9 +1075,9 @@ bool llvm::LowerDbgDeclare(Function &F) {
           // This is a call by-value or some other instruction that
           // takes a pointer to the variable. Insert a *value*
           // intrinsic that describes the alloca.
           // This is a call by-value or some other instruction that
           // takes a pointer to the variable. Insert a *value*
           // intrinsic that describes the alloca.
-          DIB.insertDbgValueIntrinsic(AI, 0, DIVariable(DDI->getVariable()),
-                                      DIExpression(DDI->getExpression()),
-                                      DDI->getDebugLoc(), CI);
+          DIB.insertDbgValueIntrinsic(AI, 0, DDI->getVariable(),
+                                      DDI->getExpression(), DDI->getDebugLoc(),
+                                      CI);
         }
       DDI->eraseFromParent();
     }
         }
       DDI->eraseFromParent();
     }
@@ -1103,8 +1103,8 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
   if (!DDI)
     return false;
   DebugLoc Loc = DDI->getDebugLoc();
   if (!DDI)
     return false;
   DebugLoc Loc = DDI->getDebugLoc();
-  DIVariable DIVar = DDI->getVariable();
-  DIExpression DIExpr = DDI->getExpression();
+  auto *DIVar = DDI->getVariable();
+  auto *DIExpr = DDI->getExpression();
   assert(DIVar && "Missing variable");
 
   if (Deref) {
   assert(DIVar && "Missing variable");
 
   if (Deref) {
index 1ff23027e161aaf1f587614c349fcd90912bf377..08580faeba35bc0a9e8a65b80b6da379d95ad50b 100644 (file)
@@ -94,20 +94,18 @@ public:
         OS << "]";
       }
       if (const DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(I)) {
         OS << "]";
       }
       if (const DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(I)) {
-        DIVariable Var(DDI->getVariable());
         if (!Padded) {
           OS.PadToColumn(50);
           OS << ";";
         }
         if (!Padded) {
           OS.PadToColumn(50);
           OS << ";";
         }
-        OS << " [debug variable = " << Var->getName() << "]";
+        OS << " [debug variable = " << DDI->getVariable()->getName() << "]";
       }
       else if (const DbgValueInst *DVI = dyn_cast<DbgValueInst>(I)) {
       }
       else if (const DbgValueInst *DVI = dyn_cast<DbgValueInst>(I)) {
-        DIVariable Var(DVI->getVariable());
         if (!Padded) {
           OS.PadToColumn(50);
           OS << ";";
         }
         if (!Padded) {
           OS.PadToColumn(50);
           OS << ";";
         }
-        OS << " [debug variable = " << Var->getName() << "]";
+        OS << " [debug variable = " << DVI->getVariable()->getName() << "]";
       }
     }
   }
       }
     }
   }
index d778903cbae8d3dc3ae915880d338b920fca1a12..35bdd3684ab4b105f96a38d5ff912583f4f546f5 100644 (file)
@@ -254,9 +254,9 @@ protected:
     // Create a local variable around the alloca
     auto *IntType =
         DBuilder.createBasicType("int", 32, 0, dwarf::DW_ATE_signed);
     // Create a local variable around the alloca
     auto *IntType =
         DBuilder.createBasicType("int", 32, 0, dwarf::DW_ATE_signed);
-    DIExpression E = DBuilder.createExpression();
-    DIVariable Variable = DBuilder.createLocalVariable(
-      dwarf::DW_TAG_auto_variable, Subprogram, "x", File, 5, IntType, true);
+    auto *E = DBuilder.createExpression();
+    auto *Variable = DBuilder.createLocalVariable(
+        dwarf::DW_TAG_auto_variable, Subprogram, "x", File, 5, IntType, true);
     auto *DL = MDLocation::get(Subprogram->getContext(), 5, 0, Subprogram);
     DBuilder.insertDeclare(Alloca, Variable, E, DL, Store);
     DBuilder.insertDbgValueIntrinsic(AllocaContent, 0, Variable, E, DL,
     auto *DL = MDLocation::get(Subprogram->getContext(), 5, 0, Subprogram);
     DBuilder.insertDeclare(Alloca, Variable, E, DL, Store);
     DBuilder.insertDbgValueIntrinsic(AllocaContent, 0, Variable, E, DL,