diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-04-25 20:52:40 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-04-25 20:52:40 +0000 |
commit | 05fefa4a85cbafe99834ba02a96933e7fc65ec25 (patch) | |
tree | 5b880aeef36182b7b547afc31dac42ee6606e815 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | cef04a25f65b1759063b3ea3cda81e6a7afc5427 (diff) | |
download | bcm5719-llvm-05fefa4a85cbafe99834ba02a96933e7fc65ec25.tar.gz bcm5719-llvm-05fefa4a85cbafe99834ba02a96933e7fc65ec25.zip |
Module Debugging: Fix the condition for determining whether a template
instantiation is in a module.
This patch fixes the condition for determining whether the debug info for a
template instantiation will exist in an imported clang module by:
- checking whether the ClassTemplateSpecializationDecl is complete and
- checking that the instantiation was in a module by looking at the first field.
I also added a negative check to make sure that a typedef to a forward-declared
template (with the definition outside of the module) is handled correctly.
http://reviews.llvm.org/D19443
rdar://problem/25553724
llvm-svn: 267464
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 70a5f619aad..0050b78f04b 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1514,12 +1514,28 @@ static bool hasExplicitMemberDefinition(CXXRecordDecl::method_iterator I, return false; } +/// Does a type definition exist in an imported clang module? +static bool isDefinedInClangModule(const RecordDecl *RD) { + if (!RD->isFromASTFile()) + return false; + if (!RD->getDefinition()) + return false; + if (!RD->isExternallyVisible() && RD->getName().empty()) + return false; + if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD)) { + if (!CTSD->isCompleteDefinition()) + return false; + // Make sure the instantiation is actually in a module. + if (CTSD->field_begin() != CTSD->field_end()) + return CTSD->field_begin()->isFromASTFile(); + } + return true; +} + static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, bool DebugTypeExtRefs, const RecordDecl *RD, const LangOptions &LangOpts) { - // Does the type exist in an imported clang module? - if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition() && - (RD->isExternallyVisible() || !RD->getName().empty())) + if (DebugTypeExtRefs && isDefinedInClangModule(RD)) return true; if (DebugKind > codegenoptions::LimitedDebugInfo) |