diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-20 18:32:29 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-20 18:32:29 +0000 |
| commit | be9e4fe768faf92071960b99cb329dbbd7e4b355 (patch) | |
| tree | b9710e10adb562d67ef8c59f074ba608ac3be132 /llvm/lib | |
| parent | fc8d9d9a20906e2ee51796add3798538d653ee74 (diff) | |
| download | bcm5719-llvm-be9e4fe768faf92071960b99cb329dbbd7e4b355.tar.gz bcm5719-llvm-be9e4fe768faf92071960b99cb329dbbd7e4b355.zip | |
DebugInfo: Remove DIScope
Replace uses of `DIScope` with `MDScope*`. There was one spot where
I've left an `MDScope*` uninitialized (where `DIScope` would have been
default-initialized to `nullptr`) -- this is intentional, since the
if/else that follows should unconditional assign it to a value.
llvm-svn: 235327
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 21 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h | 5 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 18 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h | 13 |
4 files changed, 29 insertions, 28 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index c7e853fa988..0fd25eb1a53 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -104,8 +104,8 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(DIGlobalVariable GV) { assert(GV); - DIScope GVContext = GV->getScope(); - DIType GTy = DD->resolve(GV->getType()); + auto *GVContext = GV->getScope(); + auto *GTy = DD->resolve(GV->getType()); // Construct the context before querying for the existence of the DIE in // case such construction creates the DIE. @@ -113,8 +113,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(DIGlobalVariable GV) { // Add to map. DIE *VariableDIE = &createAndAddDIE(GV->getTag(), *ContextDIE, GV); - DIScope DeclContext; - + MDScope *DeclContext; if (auto *SDMDecl = GV->getStaticDataMemberDeclaration()) { DeclContext = resolve(SDMDecl->getScope()); assert(SDMDecl->isStaticMember() && "Expected static member decl"); @@ -306,7 +305,7 @@ void DwarfCompileUnit::constructScopeDIE( if (!Scope || !Scope->getScopeNode()) return; - DIScope DS(Scope->getScopeNode()); + auto *DS = Scope->getScopeNode(); assert((Scope->getInlinedAt() || !isa<MDSubprogram>(DS)) && "Only handle inlined subprograms here, use " @@ -419,8 +418,8 @@ void DwarfCompileUnit::attachRangesOrLowHighPC( std::unique_ptr<DIE> DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope) { assert(Scope->getScopeNode()); - DIScope DS(Scope->getScopeNode()); - DISubprogram InlinedSP = getDISubprogram(DS); + auto *DS = Scope->getScopeNode(); + auto *InlinedSP = getDISubprogram(DS); // Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram // was inlined from another compile unit. DIE *OriginDIE = DU->getAbstractSPDies()[InlinedSP]; @@ -708,7 +707,7 @@ void DwarfCompileUnit::emitHeader(bool UseOffsets) { /// addGlobalName - Add a new global name to the compile unit. void DwarfCompileUnit::addGlobalName(StringRef Name, DIE &Die, - DIScope Context) { + const MDScope *Context) { if (includeMinimalInlineScopes()) return; std::string FullName = getParentContextString(Context) + Name.str(); @@ -716,8 +715,8 @@ void DwarfCompileUnit::addGlobalName(StringRef Name, DIE &Die, } /// Add a new global type to the unit. -void DwarfCompileUnit::addGlobalType(DIType Ty, const DIE &Die, - DIScope Context) { +void DwarfCompileUnit::addGlobalType(const MDType *Ty, const DIE &Die, + const MDScope *Context) { if (includeMinimalInlineScopes()) return; std::string FullName = getParentContextString(Context) + Ty->getName().str(); @@ -809,7 +808,7 @@ void DwarfCompileUnit::addExpr(DIELoc &Die, dwarf::Form Form, void DwarfCompileUnit::applySubprogramAttributesToDefinition(DISubprogram SP, DIE &SPDie) { auto *SPDecl = SP->getDeclaration(); - DIScope Context = resolve(SPDecl ? SPDecl->getScope() : SP->getScope()); + auto *Context = resolve(SPDecl ? SPDecl->getScope() : SP->getScope()); applySubprogramAttributes(SP, SPDie, includeMinimalInlineScopes()); addGlobalName(SP->getName(), SPDie, Context); } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index 9484bb6f33d..f197d226f9c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -183,10 +183,11 @@ public: } /// Add a new global name to the compile unit. - void addGlobalName(StringRef Name, DIE &Die, DIScope Context) override; + void addGlobalName(StringRef Name, DIE &Die, const MDScope *Context) override; /// Add a new global type to the compile unit. - void addGlobalType(DIType Ty, const DIE &Die, DIScope Context) override; + void addGlobalType(const MDType *Ty, const DIE &Die, + const MDScope *Context) override; const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; } const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 1dd6b49e48b..fe8be422d4d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -772,7 +772,7 @@ void DwarfUnit::addTemplateParams(DIE &Buffer, DIArray TParams) { } /// getOrCreateContextDIE - Get context owner's DIE. -DIE *DwarfUnit::getOrCreateContextDIE(DIScope Context) { +DIE *DwarfUnit::getOrCreateContextDIE(const MDScope *Context) { if (!Context || isa<MDFile>(Context)) return &getUnitDie(); if (auto *T = dyn_cast<MDType>(Context)) @@ -785,7 +785,7 @@ DIE *DwarfUnit::getOrCreateContextDIE(DIScope Context) { } DIE *DwarfUnit::createTypeDIE(DICompositeType Ty) { - DIScope Context = resolve(Ty->getScope()); + auto *Context = resolve(Ty->getScope()); DIE *ContextDIE = getOrCreateContextDIE(Context); if (DIE *TyDIE = getDIE(Ty)) @@ -817,7 +817,7 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { // Construct the context before querying for the existence of the DIE in case // such construction creates the DIE. - DIScope Context = resolve(Ty->getScope()); + auto *Context = resolve(Ty->getScope()); DIE *ContextDIE = getOrCreateContextDIE(Context); assert(ContextDIE); @@ -846,8 +846,8 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { return &TyDIE; } -void DwarfUnit::updateAcceleratorTables(DIScope Context, DIType Ty, - const DIE &TyDIE) { +void DwarfUnit::updateAcceleratorTables(const MDScope *Context, + const MDType *Ty, const DIE &TyDIE) { if (!Ty->getName().empty() && !Ty->isForwardDecl()) { bool IsImplementation = 0; if (auto *CT = dyn_cast<MDCompositeTypeBase>(Ty)) { @@ -890,7 +890,7 @@ void DwarfUnit::addType(DIE &Entity, DIType Ty, dwarf::Attribute Attribute) { /// it as a string. This is done at the metadata level because DIEs may /// not currently have been added to the parent context and walking the /// DIEs looking for names is more expensive than walking the metadata. -std::string DwarfUnit::getParentContextString(DIScope Context) const { +std::string DwarfUnit::getParentContextString(const MDScope *Context) const { if (!Context) return ""; @@ -899,7 +899,7 @@ std::string DwarfUnit::getParentContextString(DIScope Context) const { return ""; std::string CS; - SmallVector<DIScope, 1> Parents; + SmallVector<const MDScope *, 1> Parents; while (!isa<MDCompileUnit>(Context)) { Parents.push_back(Context); if (Context->getScope()) @@ -912,9 +912,7 @@ std::string DwarfUnit::getParentContextString(DIScope Context) const { // Reverse iterate over our list to go from the outermost construct to the // innermost. - for (SmallVectorImpl<DIScope>::reverse_iterator I = Parents.rbegin(), - E = Parents.rend(); - I != E; ++I) { + for (auto I = Parents.rbegin(), E = Parents.rend(); I != E; ++I) { const MDScope *Ctx = *I; StringRef Name = Ctx->getName(); if (Name.empty() && isa<MDNamespace>(Ctx)) diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h index 8b43e868784..7b7559fef5d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -153,13 +153,15 @@ public: /// getParentContextString - Get a string containing the language specific /// context for a global name. - std::string getParentContextString(DIScope Context) const; + std::string getParentContextString(const MDScope *Context) const; /// Add a new global name to the compile unit. - virtual void addGlobalName(StringRef Name, DIE &Die, DIScope Context) {} + virtual void addGlobalName(StringRef Name, DIE &Die, const MDScope *Context) { + } /// Add a new global type to the compile unit. - virtual void addGlobalType(DIType Ty, const DIE &Die, DIScope Context) {} + virtual void addGlobalType(const MDType *Ty, const DIE &Die, + const MDScope *Context) {} /// addAccelNamespace - Add a new name to the namespace accelerator table. void addAccelNamespace(StringRef Name, const DIE &Die); @@ -302,7 +304,7 @@ public: DIE *createTypeDIE(DICompositeType Ty); /// getOrCreateContextDIE - Get context owner's DIE. - DIE *getOrCreateContextDIE(DIScope Context); + DIE *getOrCreateContextDIE(const MDScope *Context); /// constructContainingTypeDIEs - Construct DIEs for types that contain /// vtables. @@ -402,7 +404,8 @@ private: /// If this is a named finished type then include it in the list of types for /// the accelerator tables. - void updateAcceleratorTables(DIScope Context, DIType Ty, const DIE &TyDIE); + void updateAcceleratorTables(const MDScope *Context, const MDType *Ty, + const DIE &TyDIE); virtual bool isDwoUnit() const = 0; }; |

