diff options
author | David Blaikie <dblaikie@gmail.com> | 2017-04-11 21:13:37 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2017-04-11 21:13:37 +0000 |
commit | 1ac9c98e6c40d9a1e6cb904b414161388af4a89c (patch) | |
tree | 1928c119f565401a0a8d7221f85fe4f0c3190d0b /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | ddb9ae192a0df1497eeda6e2627e82db3c85c0f0 (diff) | |
download | bcm5719-llvm-1ac9c98e6c40d9a1e6cb904b414161388af4a89c.tar.gz bcm5719-llvm-1ac9c98e6c40d9a1e6cb904b414161388af4a89c.zip |
Modular Codegen: Support homing debug info for types in modular objects
Matching the function-homing support for modular codegen. Any type
implicitly (implicit template specializations) or explicitly defined in
a module is attached to that module's object file and omitted elsewhere
(only a declaration used if necessary for references).
llvm-svn: 299987
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 05987be8455..818b51543d3 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1820,6 +1820,10 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, if (DebugTypeExtRefs && isDefinedInClangModule(RD->getDefinition())) return true; + if (auto *ES = RD->getASTContext().getExternalSource()) + if (ES->hasExternalDefinitions(RD) == ExternalASTSource::EK_Always) + return true; + if (DebugKind > codegenoptions::LimitedDebugInfo) return false; @@ -2552,11 +2556,17 @@ void CGDebugInfo::completeTemplateDefinition( const ClassTemplateSpecializationDecl &SD) { if (DebugKind <= codegenoptions::DebugLineTablesOnly) return; + completeUnusedClass(SD); +} + +void CGDebugInfo::completeUnusedClass(const CXXRecordDecl &D) { + if (DebugKind <= codegenoptions::DebugLineTablesOnly) + return; - completeClassData(&SD); + completeClassData(&D); // In case this type has no member function definitions being emitted, ensure // it is retained - RetainedTypes.push_back(CGM.getContext().getRecordType(&SD).getAsOpaquePtr()); + RetainedTypes.push_back(CGM.getContext().getRecordType(&D).getAsOpaquePtr()); } llvm::DIType *CGDebugInfo::getOrCreateType(QualType Ty, llvm::DIFile *Unit) { |