diff options
author | Adrian Prantl <aprantl@apple.com> | 2015-09-21 17:48:37 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2015-09-21 17:48:37 +0000 |
commit | 85d938aadbea1ba16d893b49f94620bd6d706f98 (patch) | |
tree | d8f10a161f19f0a01a6b1fb104aa1f7ab83eb8f9 /clang/lib | |
parent | 53d5cea648d8db7ceeedced4309e8ddd2c715578 (diff) | |
download | bcm5719-llvm-85d938aadbea1ba16d893b49f94620bd6d706f98.tar.gz bcm5719-llvm-85d938aadbea1ba16d893b49f94620bd6d706f98.zip |
Debug Info: When building a module, emit skeleton CUs for imported modules.
llvm-svn: 248184
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 17 | ||||
-rw-r--r-- | clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 7 |
2 files changed, 15 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 6af8d6626b4..ae1f5e7ecfa 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -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; } diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index 1673340a495..310e374e348 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -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())) |