diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-10-24 00:06:02 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-10-24 00:06:02 +0000 |
commit | ba6fdc57b4be3d65903531a7ad734ccf417cb0a6 (patch) | |
tree | e7c205b4fa1d41d6d96ef4e667547ff0646464fb /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | cd416382927996eb1aa661e3f9cf9ce3c46bb71e (diff) | |
download | bcm5719-llvm-ba6fdc57b4be3d65903531a7ad734ccf417cb0a6.tar.gz bcm5719-llvm-ba6fdc57b4be3d65903531a7ad734ccf417cb0a6.zip |
Debug Info (-gmodules): emit full types for non-anchored template specializations
Before this patch, clang would emit a (module-)forward declaration for
template instantiations that are not anchored by an explicit template
instantiation, but still are guaranteed to be available in an imported
module. Unfortunately detecting the owning module doesn't reliably
work when local submodule visibility is enabled and the template is
inside a cross-module namespace.
This make clang debuggable again with -gmodules and LSV enabled.
rdar://problem/41552377
llvm-svn: 345109
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index bcd5338ac05..0d42befa5ab 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1955,8 +1955,17 @@ static bool isDefinedInClangModule(const RecordDecl *RD) { if (auto *CXXDecl = dyn_cast<CXXRecordDecl>(RD)) { if (!CXXDecl->isCompleteDefinition()) return false; + // Check wether RD is a template. auto TemplateKind = CXXDecl->getTemplateSpecializationKind(); if (TemplateKind != TSK_Undeclared) { + // Unfortunately getOwningModule() isn't accurate enough to find the + // owning module of a ClassTemplateSpecializationDecl that is inside a + // namespace spanning multiple modules. + bool Explicit = false; + if (auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(CXXDecl)) + Explicit = TD->isExplicitInstantiationOrSpecialization(); + if (!Explicit && CXXDecl->getEnclosingNamespaceContext()) + return false; // This is a template, check the origin of the first member. if (CXXDecl->field_begin() == CXXDecl->field_end()) return TemplateKind == TSK_ExplicitInstantiationDeclaration; |