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 | 135b6cd218276eaf2c9564b93e28e9da830f5928 (patch) | |
| tree | 30cdb947b313745ca3c6370f774c126a6f292bbf /lib/CodeGen/ObjectFilePCHContainerOperations.cpp | |
| parent | 15b1e41f6d5d1d95f7b41e47a3b0b30ecf6f78af (diff) | |
| download | clang-135b6cd218276eaf2c9564b93e28e9da830f5928.tar.gz | |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258250 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
| -rw-r--r-- | lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index 2c0c3ca8a9..cd17832554 100644 --- a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/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); } |
