diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-08-17 18:27:24 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-08-17 18:27:24 +0000 |
commit | 26cb1d266081d85d6fe410b1f7fa741ba2a37dda (patch) | |
tree | 1c95a689ae900318e13e25e6530cdae751483e53 /clang/lib | |
parent | b35be69ff5092d914419609820d0eb0d7c442b99 (diff) | |
download | bcm5719-llvm-26cb1d266081d85d6fe410b1f7fa741ba2a37dda.tar.gz bcm5719-llvm-26cb1d266081d85d6fe410b1f7fa741ba2a37dda.zip |
Module debug info: Fix a bug in handling record decls without fields.
The previous condition would erroneously mark all CXXRecordDecls
that didn't have any fields as being defined in a clang module.
This patch fixes the condition to only apply to explicit template
instantiations.
<rdar://problem/27771823>
llvm-svn: 278952
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index f56cd0a6bb6..fa5f53e4599 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1656,12 +1656,15 @@ static bool isDefinedInClangModule(const RecordDecl *RD) { return false; if (auto *CXXDecl = dyn_cast<CXXRecordDecl>(RD)) { assert(CXXDecl->isCompleteDefinition() && "incomplete record definition"); - if (CXXDecl->getTemplateSpecializationKind() != TSK_Undeclared) - // Make sure the instantiation is actually in a module. - if (CXXDecl->field_begin() != CXXDecl->field_end()) - return CXXDecl->field_begin()->isFromASTFile(); + auto TemplateKind = CXXDecl->getTemplateSpecializationKind(); + if (TemplateKind != TSK_Undeclared) { + // This is a template, check the origin of the first member. + if (CXXDecl->field_begin() == CXXDecl->field_end()) + return TemplateKind == TSK_ExplicitInstantiationDeclaration; + if (!CXXDecl->field_begin()->isFromASTFile()) + return false; + } } - return true; } |