diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-07-01 18:07:22 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-07-01 18:07:22 +0000 |
commit | be822edf032854e4a5439f7c64cab95861cfbd8c (patch) | |
tree | 16e13d872d6c4b7e9cdd6511125e0db9918a1a4a /clang/lib/CodeGen | |
parent | d51dea67b3b75e96c0362eb6c559cded341c0f4d (diff) | |
download | bcm5719-llvm-be822edf032854e4a5439f7c64cab95861cfbd8c.tar.gz bcm5719-llvm-be822edf032854e4a5439f7c64cab95861cfbd8c.zip |
Revert "[DebugInfo] Fix debug info generation for function static variables, typedefs, and records"
Caused PR24008.
This reverts commit r241154.
llvm-svn: 241177
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 36 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.h | 11 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 11 |
3 files changed, 7 insertions, 51 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 7368dc69f51..8c4b4b3d061 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -786,18 +786,15 @@ llvm::DIType *CGDebugInfo::CreateType(const TemplateSpecializationType *Ty, llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty, llvm::DIFile *Unit) { - TypedefNameDecl *TD = Ty->getDecl(); // We don't set size information, but do specify where the typedef was // declared. - SourceLocation Loc = TD->getLocation(); - - llvm::DIScope *TDContext = getDeclarationLexicalScope(*TD, QualType(Ty, 0)); + SourceLocation Loc = Ty->getDecl()->getLocation(); // Typedefs are derived from some other type. return DBuilder.createTypedef( getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit), Ty->getDecl()->getName(), getOrCreateFile(Loc), getLineNumber(Loc), - TDContext); + getContextDescriptor(cast<Decl>(Ty->getDecl()->getDeclContext()))); } llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty, @@ -1445,23 +1442,6 @@ llvm::DIType *CGDebugInfo::getOrCreateInterfaceType(QualType D, return T; } -void CGDebugInfo::recordDeclarationLexicalScope(const Decl &D) { - assert(LexicalBlockMap.find(&D) == LexicalBlockMap.end() && - "D is already mapped to lexical block scope"); - if (!LexicalBlockStack.empty()) - LexicalBlockMap[&D] = LexicalBlockStack.back(); -} - -llvm::DIScope *CGDebugInfo::getDeclarationLexicalScope(const Decl &D, - QualType Ty) { - auto I = LexicalBlockMap.find(&D); - if (I != LexicalBlockMap.end()) { - RetainedTypes.push_back(Ty.getAsOpaquePtr()); - return I->second; - } else - return getContextDescriptor(cast<Decl>(D.getDeclContext())); -} - void CGDebugInfo::completeType(const EnumDecl *ED) { if (DebugKind <= CodeGenOptions::DebugLineTablesOnly) return; @@ -2289,7 +2269,8 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) { unsigned Line = getLineNumber(RD->getLocation()); StringRef RDName = getClassName(RD); - llvm::DIScope *RDContext = getDeclarationLexicalScope(*RD, QualType(Ty, 0)); + llvm::DIScope *RDContext = + getContextDescriptor(cast<Decl>(RD->getDeclContext())); // If we ended up creating the type during the context chain construction, // just return that. @@ -2435,14 +2416,7 @@ void CGDebugInfo::collectVarDeclProps(const VarDecl *VD, llvm::DIFile *&Unit, // outside the class by putting it in the global scope. if (DC->isRecord()) DC = CGM.getContext().getTranslationUnitDecl(); - - if (VD->isStaticLocal()) { - // Get context for static locals (that are technically globals) the same way - // we do for "local" locals -- by using current lexical block. - assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!"); - VDContext = LexicalBlockStack.back(); - } else - VDContext = getContextDescriptor(dyn_cast<Decl>(DC)); + VDContext = getContextDescriptor(dyn_cast<Decl>(DC)); } llvm::DISubprogram * diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index a4e51e99df6..10d3b0d9ab0 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -100,11 +100,6 @@ class CGDebugInfo { // LexicalBlockStack - Keep track of our current nested lexical block. std::vector<llvm::TypedTrackingMDRef<llvm::DIScope>> LexicalBlockStack; - - /// \brief Map of AST declaration to its lexical block scope. - llvm::DenseMap<const Decl *, llvm::TypedTrackingMDRef<llvm::DIScope>> - LexicalBlockMap; - llvm::DenseMap<const Decl *, llvm::TrackingMDRef> RegionMap; // FnBeginRegionCount - Keep track of LexicalBlockStack counter at the // beginning of a function. This is used to pop unbalanced regions at @@ -310,12 +305,6 @@ public: /// debug info. llvm::DIType *getOrCreateInterfaceType(QualType Ty, SourceLocation Loc); - /// \brief Map AST declaration to its lexical block scope if available. - void recordDeclarationLexicalScope(const Decl &D); - - /// \brief Get lexical scope of AST declaration. - llvm::DIScope *getDeclarationLexicalScope(const Decl &D, QualType Ty); - void completeType(const EnumDecl *ED); void completeType(const RecordDecl *RD); void completeRequiredType(const RecordDecl *RD); diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 7550266e7b2..07dbce4252f 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -81,8 +81,10 @@ void CodeGenFunction::EmitDecl(const Decl &D) { case Decl::UsingShadow: llvm_unreachable("Declaration should not be in declstmts!"); case Decl::Function: // void X(); + case Decl::Record: // struct/union/class X; case Decl::Enum: // enum X; case Decl::EnumConstant: // enum ? { X = ? } + case Decl::CXXRecord: // struct/union/class X; [C++] case Decl::StaticAssert: // static_assert(X, ""); [C++0x] case Decl::Label: // __label__ x; case Decl::Import: @@ -91,12 +93,6 @@ void CodeGenFunction::EmitDecl(const Decl &D) { // None of these decls require codegen support. return; - case Decl::CXXRecord: // struct/union/class X; [C++] - case Decl::Record: // struct/union/class X; - if (CGDebugInfo *DI = getDebugInfo()) - DI->recordDeclarationLexicalScope(D); - return; - case Decl::NamespaceAlias: if (CGDebugInfo *DI = getDebugInfo()) DI->EmitNamespaceAlias(cast<NamespaceAliasDecl>(D)); @@ -121,9 +117,6 @@ void CodeGenFunction::EmitDecl(const Decl &D) { const TypedefNameDecl &TD = cast<TypedefNameDecl>(D); QualType Ty = TD.getUnderlyingType(); - if (CGDebugInfo *DI = getDebugInfo()) - DI->recordDeclarationLexicalScope(D); - if (Ty->isVariablyModifiedType()) EmitVariablyModifiedType(Ty); } |