From: Duncan P. N. Exon Smith Date: Tue, 21 Apr 2015 18:44:06 +0000 (+0000) Subject: DebugInfo: Drop rest of DIDescriptor subclasses X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7f892716df57263dabb4063a563975b0a296c737;p=oota-llvm.git DebugInfo: Drop rest of DIDescriptor subclasses 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 --- diff --git a/bindings/go/llvm/DIBuilderBindings.cpp b/bindings/go/llvm/DIBuilderBindings.cpp index 8d62a96d2f3..d31c5850389 100644 --- a/bindings/go/llvm/DIBuilderBindings.cpp +++ b/bindings/go/llvm/DIBuilderBindings.cpp @@ -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); - DIVariable V = D->createLocalVariable( + return wrap(D->createLocalVariable( Tag, unwrap(Scope), Name, unwrap(File), Line, - unwrap(Ty), AlwaysPreserve, Flags, ArgNo); - return wrap(V); + unwrap(Ty), AlwaysPreserve, Flags, ArgNo)); } 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); - DISubrange S = D->getOrCreateSubrange(Lo, Count); - return wrap(S); + return wrap(D->getOrCreateSubrange(Lo, Count)); } 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); - DIExpression Expr = D->createExpression(ArrayRef(Addr, Length)); - return wrap(Expr); + return wrap(D->createExpression(ArrayRef(Addr, Length))); } LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Dref, diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 9097150ab62..5a28c1bceaf 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -246,14 +246,14 @@ public: /// \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(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(getOperand(3).getMetadata()); } diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h index 0574ebc40ce..8825452b251 100644 --- a/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/include/llvm/CodeGen/MachineInstrBuilder.h @@ -176,7 +176,7 @@ public: MI->addOperand(*MF, MachineOperand::CreateMetadata(MD)); assert((MI->isDebugValue() ? static_cast(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; } @@ -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) { - assert(isa(Variable) && "not a DIVariable"); - assert(cast(Expr)->isValid() && "not a DIExpression"); + assert(isa(Variable) && "not a variable"); + assert(cast(Expr)->isValid() && "not an expression"); assert(cast(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) { - assert(isa(Variable) && "not a DIVariable"); - assert(cast(Expr)->isValid() && "not a DIExpression"); + assert(isa(Variable) && "not a variable"); + assert(cast(Expr)->isValid() && "not an expression"); MachineFunction &MF = *BB.getParent(); MachineInstr *MI = BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, Variable, Expr); diff --git a/include/llvm/IR/DebugInfo.h b/include/llvm/IR/DebugInfo.h index d49239cd262..5a53f26c78d 100644 --- a/include/llvm/IR/DebugInfo.h +++ b/include/llvm/IR/DebugInfo.h @@ -46,167 +46,12 @@ class NamedMDNode; class LLVMContext; class raw_ostream; -class DIVariable; -class DIObjCProperty; - /// \brief Maps from type identifier to the actual MDNode. typedef DenseMap DITypeIdentifierMap; -#define DECLARE_SIMPLIFY_DESCRIPTOR(DESC) \ - class DESC; \ - template <> struct simplify_type; \ - template <> struct simplify_type; -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; -class DISubrange { - MDSubrange *N; - -public: - DISubrange(const MDSubrange *N = nullptr) : N(const_cast(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(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(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(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(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(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(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(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(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(N)) {} - - operator MDImportedEntity *() const { return N; } - MDImportedEntity *operator->() const { return N; } - MDImportedEntity &operator*() const { return *N; } -}; - -#define SIMPLIFY_DESCRIPTOR(DESC) \ - template <> struct simplify_type { \ - typedef Metadata *SimpleType; \ - static SimpleType getSimplifiedValue(const DESC &DI) { return DI; } \ - }; \ - template <> struct simplify_type : simplify_type {}; -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); @@ -251,7 +96,7 @@ public: 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. diff --git a/lib/Analysis/ModuleDebugInfoPrinter.cpp b/lib/Analysis/ModuleDebugInfoPrinter.cpp index f2a11cb461f..7ee2f9d6e59 100644 --- a/lib/Analysis/ModuleDebugInfoPrinter.cpp +++ b/lib/Analysis/ModuleDebugInfoPrinter.cpp @@ -90,7 +90,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const { 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()) diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 43d7a38e04a..ec76cd61376 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -670,7 +670,7 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) { raw_svector_ostream OS(Str); OS << "DEBUG_VALUE: "; - DIVariable V = MI->getDebugVariable(); + const MDLocalVariable *V = MI->getDebugVariable(); if (auto *SP = dyn_cast(V->getScope())) { StringRef Name = SP->getDisplayName(); if (!Name.empty()) @@ -678,7 +678,7 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) { } OS << V->getName(); - DIExpression Expr = MI->getDebugExpression(); + const MDExpression *Expr = MI->getDebugExpression(); if (Expr->isBitPiece()) OS << " [bit_piece offset=" << Expr->getBitPieceOffset() << " size=" << Expr->getBitPieceSize() << "]"; diff --git a/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp b/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp index 1e3c5d769f1..9cb0aab7705 100644 --- a/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp +++ b/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp @@ -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. - 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()); diff --git a/lib/CodeGen/AsmPrinter/DebugLocEntry.h b/lib/CodeGen/AsmPrinter/DebugLocEntry.h index a2f6ae1eb73..ff3eb030a65 100644 --- a/lib/CodeGen/AsmPrinter/DebugLocEntry.h +++ b/lib/CodeGen/AsmPrinter/DebugLocEntry.h @@ -72,7 +72,7 @@ public: 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 &); }; @@ -94,9 +94,8 @@ public: /// Return true if the merge was successful. bool MergeValues(const DebugLocEntry &Next) { if (Begin == Next.Begin) { - DIExpression Expr = cast_or_null(Values[0].Expression); - DIExpression NextExpr = - cast_or_null(Next.Values[0].Expression); + auto *Expr = cast_or_null(Values[0].Expression); + auto *NextExpr = cast_or_null(Next.Values[0].Expression); if (Expr->isBitPiece() && NextExpr->isBitPiece()) { addValues(Next.Values); End = Next.End; diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 3f22070acea..e661ddcd567 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -97,7 +97,8 @@ static const ConstantExpr *getMergedGlobalExpr(const Value *V) { } /// 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; @@ -632,7 +633,7 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) { } std::unique_ptr -DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity &Module) { +DwarfCompileUnit::constructImportedEntityDIE(const MDImportedEntity *Module) { std::unique_ptr IMDie = make_unique((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); - 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)); @@ -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); - DIExpression Expr = DV.getExpression().back(); + const MDExpression *Expr = DV.getExpression().back(); bool ValidReg; if (Location.getOffset()) { ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(), diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index 6ea43c3f615..76811d9401c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -79,7 +79,7 @@ public: 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. @@ -156,7 +156,7 @@ public: /// \brief Construct import_module DIE. std::unique_ptr - constructImportedEntityDIE(const DIImportedEntity &Module); + constructImportedEntityDIE(const MDImportedEntity *Module); void finishSubprogramDefinition(const MDSubprogram *SP); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 8226e1fe9aa..fdea05e50a2 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -422,10 +422,9 @@ DwarfDebug::constructDwarfCompileUnit(const MDCompileUnit *DIUnit) { } void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU, - const MDNode *N) { - DIImportedEntity Module = cast(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 @@ -661,8 +660,9 @@ void DwarfDebug::endModule() { } // 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); @@ -672,21 +672,21 @@ DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV, } DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV) { - DIVariable Cleansed; + const MDLocalVariable *Cleansed; return getExistingAbstractVariable(IV, Cleansed); } -void DwarfDebug::createAbstractVariable(const DIVariable &Var, +void DwarfDebug::createAbstractVariable(const MDLocalVariable *Var, LexicalScope *Scope) { auto AbsDbgVariable = - make_unique(Var, nullptr, DIExpression(), this); + make_unique(Var, /* IA */ nullptr, /* Expr */ nullptr, this); 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; @@ -696,7 +696,7 @@ void DwarfDebug::ensureAbstractVariableIsCreated(InlinedVariable IV, void DwarfDebug::ensureAbstractVariableIsCreatedIfScoped( InlinedVariable IV, const MDNode *ScopeNode) { - DIVariable Cleansed; + const MDLocalVariable *Cleansed = nullptr; if (getExistingAbstractVariable(IV, Cleansed)) return; @@ -722,7 +722,7 @@ void DwarfDebug::collectVariableInfoFromMMITable( if (!Scope) continue; - DIExpression Expr = cast_or_null(VI.Expr); + const MDExpression *Expr = cast_or_null(VI.Expr); ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode()); auto RegVar = make_unique(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. -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(); @@ -809,7 +809,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl &DebugLoc, } // 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()); @@ -930,15 +930,14 @@ void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, } // 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()); - DIExpression NoExpr; - ConcreteVariables.push_back( - make_unique(DV, nullptr, NoExpr, this)); + ConcreteVariables.push_back(make_unique( + DV, /* IA */ nullptr, /* Expr */ nullptr, this)); 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. - 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) { - 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()); @@ -1219,7 +1218,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { for (LexicalScope *AScope : LScopes.getAbstractScopesList()) { auto *SP = cast(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), @@ -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(); - DIExpression Expr = Value.getExpression(); + const MDExpression *Expr = Value.getExpression(); 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) { - DIExpression Expr = Piece.getExpression(); + const MDExpression *Expr = Piece.getExpression(); unsigned PieceOffset = Expr->getBitPieceOffset(); unsigned PieceSize = Expr->getBitPieceSize(); assert(Offset <= PieceOffset && "overlapping or duplicate pieces"); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index c33a07b0b42..708fb8f01e5 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -75,9 +75,10 @@ public: /// - 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 Expr; /// Complex address location expression. + const MDLocalVariable *Var; /// Variable Descriptor. + const MDLocation *IA; /// Inlined at location. + SmallVector + Expr; /// Complex address location expression. 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: - /// 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); @@ -105,9 +106,9 @@ public: } // Accessors. - DIVariable getVariable() const { return Var; } - DILocation getInlinedAt() const { return IA; } - const ArrayRef getExpression() const { return Expr; } + const MDLocalVariable *getVariable() const { return Var; } + const MDLocation *getInlinedAt() const { return IA; } + const ArrayRef getExpression() const { return Expr; } 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"); - 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) { @@ -128,10 +129,11 @@ public: 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. @@ -334,9 +336,9 @@ class DwarfDebug : public AsmPrinterHandler { /// \brief Find abstract variable associated with Var. DbgVariable *getExistingAbstractVariable(InlinedVariable IV, - DIVariable &Cleansed); + const MDLocalVariable *&Cleansed); 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, @@ -455,7 +457,7 @@ class DwarfDebug : public AsmPrinterHandler { /// \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 diff --git a/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index e576c93035e..fbe209a6663 100644 --- a/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -192,7 +192,7 @@ static unsigned getOffsetOrZero(unsigned OffsetInBits, return OffsetInBits; } -bool DwarfExpression::AddMachineRegExpression(DIExpression Expr, +bool DwarfExpression::AddMachineRegExpression(const MDExpression *Expr, 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: - llvm_unreachable("unhandled opcode found in DIExpression"); + llvm_unreachable("unhandled opcode found in expression"); } } } diff --git a/lib/CodeGen/AsmPrinter/DwarfExpression.h b/lib/CodeGen/AsmPrinter/DwarfExpression.h index a8b65f50434..3b77a44c28a 100644 --- a/lib/CodeGen/AsmPrinter/DwarfExpression.h +++ b/lib/CodeGen/AsmPrinter/DwarfExpression.h @@ -88,11 +88,12 @@ public: /// 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. - 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 diff --git a/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/lib/CodeGen/AsmPrinter/DwarfFile.cpp index 32adb40f5a2..29a163b8f06 100644 --- a/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -137,7 +137,7 @@ void DwarfFile::emitStrings(const MCSection *StrSection, bool DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) { SmallVectorImpl &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 diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 750b8525695..ad1ef544b01 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -354,14 +354,14 @@ void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, StringRef File, 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()); } -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()); @@ -379,7 +379,7 @@ void DwarfUnit::addSourceLine(DIE &Die, const MDType *Ty) { 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()); @@ -976,7 +976,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { } else { constructMemberDIE(Buffer, DDTy); } - } else if (DIObjCProperty Property = dyn_cast(Element)) { + } else if (auto *Property = dyn_cast(Element)) { 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. @@ -1068,9 +1068,8 @@ void DwarfUnit::constructTemplateTypeParameterDIE(DIE &Buffer, 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 @@ -1270,7 +1269,8 @@ void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie, 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); diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.h b/lib/CodeGen/AsmPrinter/DwarfUnit.h index a236a4a7a97..7041f376ef4 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -246,12 +246,12 @@ public: /// \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, 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); @@ -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 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, - DITemplateTypeParameter TP); + const MDTemplateTypeParameter *TP); void constructTemplateValueParameterDIE(DIE &Buffer, - DITemplateValueParameter TVP); + const MDTemplateValueParameter *TVP); /// \brief Return the default lower bound for an array. /// diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp index c2993db6c5a..df48c53f16b 100644 --- a/lib/CodeGen/LiveDebugVariables.cpp +++ b/lib/CodeGen/LiveDebugVariables.cpp @@ -394,7 +394,7 @@ static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V, } void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) { - DIVariable DV = cast(Variable); + auto *DV = cast(Variable); OS << "!\""; printExtendedName(OS, DV, dl); diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index d15411026cb..86d33b0c0b0 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -1619,7 +1619,7 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const { } if (isDebugValue() && MO.isMetadata()) { // Pretty print DBG_VALUE instructions. - DIVariable DIV = dyn_cast(MO.getMetadata()); + auto *DIV = dyn_cast(MO.getMetadata()); 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 << ";"; - DIVariable DV = cast(getOperand(e - 2).getMetadata()); + auto *DV = cast(getOperand(e - 2).getMetadata()); OS << " line no:" << DV->getLine(); if (auto *InlinedAt = debugLoc->getInlinedAt()) { DebugLoc InlinedAtDL(InlinedAt); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 49ea4b4b5a3..746a9efaa4d 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4463,8 +4463,7 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue( // 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 Op; @@ -4672,9 +4671,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) { if (const BitCastInst *BCI = dyn_cast(Address)) Address = BCI->getOperand(0); // Parameters are handled specially. - bool isParameter = - (DIVariable(Variable)->getTag() == dwarf::DW_TAG_arg_variable || - isa(Address)); + bool isParameter = Variable->getTag() == dwarf::DW_TAG_arg_variable || + isa(Address); const AllocaInst *AI = dyn_cast(Address); diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp index ef43dd2d37b..bcead02d80a 100644 --- a/lib/Transforms/IPO/StripSymbols.cpp +++ b/lib/Transforms/IPO/StripSymbols.cpp @@ -321,11 +321,8 @@ bool StripDeadDebugInfo::runOnModule(Module &M) { } // Create our live global variable list. - MDGlobalVariableArray GVs = DIC->getGlobalVariables(); 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; diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp index 59dc52811c9..e11ab33b0fb 100644 --- a/lib/Transforms/Scalar/SROA.cpp +++ b/lib/Transforms/Scalar/SROA.cpp @@ -1166,9 +1166,9 @@ public: } 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)) { - 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. - 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. diff --git a/lib/Transforms/Scalar/SampleProfile.cpp b/lib/Transforms/Scalar/SampleProfile.cpp index f99fe3f5512..f4936b57062 100644 --- a/lib/Transforms/Scalar/SampleProfile.cpp +++ b/lib/Transforms/Scalar/SampleProfile.cpp @@ -224,7 +224,7 @@ unsigned SampleProfileLoader::getInstWeight(Instruction &Inst) { 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); diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 693c5ae9708..03fff1df5d9 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -1117,9 +1117,9 @@ public: } 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); } } }; diff --git a/lib/Transforms/Utils/AddDiscriminators.cpp b/lib/Transforms/Utils/AddDiscriminators.cpp index dd88f3d0a26..125aab2fe88 100644 --- a/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/lib/Transforms/Utils/AddDiscriminators.cpp @@ -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(); - 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(); - DILocation FirstDIL = First->getDebugLoc().get(); + const MDLocation *FirstDIL = First->getDebugLoc(); if (!FirstDIL) continue; diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 5672a36a458..492dc07d1eb 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -978,7 +978,7 @@ unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign, /// /// 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. @@ -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) { - DIVariable DIVar = DDI->getVariable(); - DIExpression DIExpr = DDI->getExpression(); + auto *DIVar = DDI->getVariable(); + auto *DIExpr = DDI->getExpression(); 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) { - DIVariable DIVar = DDI->getVariable(); - DIExpression DIExpr = DDI->getExpression(); + auto *DIVar = DDI->getVariable(); + auto *DIExpr = DDI->getExpression(); 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. - 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(); } @@ -1103,8 +1103,8 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, 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) { diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 1ff23027e16..08580faeba3 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -94,20 +94,18 @@ public: OS << "]"; } if (const DbgDeclareInst *DDI = dyn_cast(I)) { - DIVariable Var(DDI->getVariable()); if (!Padded) { OS.PadToColumn(50); OS << ";"; } - OS << " [debug variable = " << Var->getName() << "]"; + OS << " [debug variable = " << DDI->getVariable()->getName() << "]"; } else if (const DbgValueInst *DVI = dyn_cast(I)) { - DIVariable Var(DVI->getVariable()); if (!Padded) { OS.PadToColumn(50); OS << ";"; } - OS << " [debug variable = " << Var->getName() << "]"; + OS << " [debug variable = " << DVI->getVariable()->getName() << "]"; } } } diff --git a/unittests/Transforms/Utils/Cloning.cpp b/unittests/Transforms/Utils/Cloning.cpp index d778903cbae..35bdd3684ab 100644 --- a/unittests/Transforms/Utils/Cloning.cpp +++ b/unittests/Transforms/Utils/Cloning.cpp @@ -254,9 +254,9 @@ protected: // 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,