forked from OSchip/llvm-project
Debug Info: When building a module, emit skeleton CUs for imported modules.
llvm-svn: 248184
This commit is contained in:
parent
53d5cea648
commit
85d938aadb
|
@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCInterfaceDecl(QualType Ty) {
|
|||
|
||||
llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
|
||||
ExternalASTSource::ASTSourceDescriptor Info;
|
||||
if (ClangModuleMap) {
|
||||
if (DebugTypeExtRefs && D->isFromASTFile()) {
|
||||
// Record a reference to an imported clang module or precompiled header.
|
||||
auto *Reader = CGM.getContext().getExternalSource();
|
||||
auto Idx = D->getOwningModuleID();
|
||||
auto Info = Reader->getSourceDescriptor(Idx);
|
||||
if (Info)
|
||||
return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
|
||||
} else if (ClangModuleMap) {
|
||||
// We are building a clang module or a precompiled header.
|
||||
//
|
||||
// TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies
|
||||
|
@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
|
|||
}
|
||||
}
|
||||
|
||||
if (DebugTypeExtRefs && D->isFromASTFile()) {
|
||||
// Record a reference to an imported clang module or precompiled header.
|
||||
auto *Reader = CGM.getContext().getExternalSource();
|
||||
auto Idx = D->getOwningModuleID();
|
||||
auto Info = Reader->getSourceDescriptor(Idx);
|
||||
if (Info)
|
||||
return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,13 @@ class PCHContainerGenerator : public ASTConsumer {
|
|||
return !Ty->isDependentType() && !Ty->isUndeducedType();
|
||||
}
|
||||
|
||||
bool VisitImportDecl(ImportDecl *D) {
|
||||
auto *Import = cast<ImportDecl>(D);
|
||||
if (!Import->getImportedOwningModule())
|
||||
DI.EmitImportDecl(*Import);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VisitTypeDecl(TypeDecl *D) {
|
||||
QualType QualTy = Ctx.getTypeDeclType(D);
|
||||
if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \
|
||||
// RUN: -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \
|
||||
// RUN: %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s
|
||||
// REQUIRES: asserts
|
||||
|
||||
@import diamond_left;
|
||||
|
||||
// CHECK: ![[TOP_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_top
|
||||
// CHECK: ![[LEFT_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_left
|
||||
// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration,
|
||||
// CHECK-SAME: entity: ![[MODULE:.*]], line: 3)
|
||||
// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "diamond_top"
|
||||
// CHECK: ![[TOP_SKEL_CU:.*]] = distinct !DICompileUnit({{.*}}diamond_top{{.*}}dwoId:
|
||||
|
Loading…
Reference in New Issue