diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-03-07 20:58:52 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-03-07 20:58:52 +0000 |
commit | 5a9a42778ab565913b6c1b66c4e15cfa80b7a610 (patch) | |
tree | eef9acefd604982d31af473855a1931e2651a2dc /clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | |
parent | af97a282b9f4b5220c9a966feebcf34f322c727f (diff) | |
download | bcm5719-llvm-5a9a42778ab565913b6c1b66c4e15cfa80b7a610.tar.gz bcm5719-llvm-5a9a42778ab565913b6c1b66c4e15cfa80b7a610.zip |
Module Debugging: Fix a crash when emitting debug info for nested tag types
whose DeclContext is not yet complete by deferring their emission.
rdar://problem/24918680
llvm-svn: 262851
Diffstat (limited to 'clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
-rw-r--r-- | clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index 96752528d71..d609cf2648a 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -201,6 +201,15 @@ public: if (D->getName().empty()) return; + // Defer tag decls until their declcontext is complete. + auto *DeclCtx = D->getDeclContext(); + while (DeclCtx) { + if (auto *D = dyn_cast<TagDecl>(DeclCtx)) + if (!D->isCompleteDefinition()) + return; + DeclCtx = DeclCtx->getParent(); + } + DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx); DTV.TraverseDecl(D); Builder->UpdateCompletedType(D); |