diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-01-19 23:42:44 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-01-19 23:42:44 +0000 |
commit | cd975018feb88d2ae9f83b712b1d3684985df0f3 (patch) | |
tree | 52651c3767ecc3ccac0b62691be131dbfefa1fd8 /clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | |
parent | 6f630f800beee0653ae7d7bf28d2ea2b145aeb04 (diff) | |
download | llvm-cd975018feb88d2ae9f83b712b1d3684985df0f3.zip llvm-cd975018feb88d2ae9f83b712b1d3684985df0f3.tar.gz llvm-cd975018feb88d2ae9f83b712b1d3684985df0f3.tar.bz2 |
Module Debugging: Make sure that anonymous tag decls that define global
variables are visited.
This shouldn't encourage anyone to put global variables into clang modules.
rdar://problem/24199640
llvm-svn: 258250
Diffstat (limited to 'clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
-rw-r--r-- | clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index 2c0c3ca..cd17832 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -59,10 +59,8 @@ class PCHContainerGenerator : public ASTConsumer { struct DebugTypeVisitor : public RecursiveASTVisitor<DebugTypeVisitor> { clang::CodeGen::CGDebugInfo &DI; ASTContext &Ctx; - bool SkipTagDecls; - DebugTypeVisitor(clang::CodeGen::CGDebugInfo &DI, ASTContext &Ctx, - bool SkipTagDecls) - : DI(DI), Ctx(Ctx), SkipTagDecls(SkipTagDecls) {} + DebugTypeVisitor(clang::CodeGen::CGDebugInfo &DI, ASTContext &Ctx) + : DI(DI), Ctx(Ctx) {} /// Determine whether this type can be represented in DWARF. static bool CanRepresent(const Type *Ty) { @@ -80,7 +78,8 @@ class PCHContainerGenerator : public ASTConsumer { // TagDecls may be deferred until after all decls have been merged and we // know the complete type. Pure forward declarations will be skipped, but // they don't need to be emitted into the module anyway. - if (SkipTagDecls && isa<TagDecl>(D)) + if (auto *TD = dyn_cast<TagDecl>(D)) + if (!TD->isCompleteDefinition()) return true; QualType QualTy = Ctx.getTypeDeclType(D); @@ -173,7 +172,7 @@ public: // Collect debug info for all decls in this group. for (auto *I : D) if (!I->isFromASTFile()) { - DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx, true); + DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx); DTV.TraverseDecl(I); } return true; @@ -194,7 +193,7 @@ public: if (D->getName().empty()) return; - DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx, false); + DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx); DTV.TraverseDecl(D); Builder->UpdateCompletedType(D); } |