diff options
author | Adrian Prantl <aprantl@apple.com> | 2015-09-24 16:10:04 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2015-09-24 16:10:04 +0000 |
commit | eb66a263c24059d8884683638a058441ef1b836d (patch) | |
tree | 81d1f3ffdd93a7250fd44d139190f9ae2dc8f64b /clang | |
parent | 6083b08580185643561b34166a98d7315b2981b8 (diff) | |
download | bcm5719-llvm-eb66a263c24059d8884683638a058441ef1b836d.tar.gz bcm5719-llvm-eb66a263c24059d8884683638a058441ef1b836d.zip |
Debug Info: Use the module pointer as key for the module cache.
This way we don't need to rebuild the full module name for every decl.
llvm-svn: 248510
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/AST/ExternalASTSource.h | 1 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 14 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.h | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/clang/include/clang/AST/ExternalASTSource.h b/clang/include/clang/AST/ExternalASTSource.h index e3db1ee4c53..fa0ea875bbe 100644 --- a/clang/include/clang/AST/ExternalASTSource.h +++ b/clang/include/clang/AST/ExternalASTSource.h @@ -163,6 +163,7 @@ public: StringRef getPath() const { return Path; } StringRef getASTFile() const { return ASTFile; } uint64_t getSignature() const { return Signature; } + const Module *getModuleOrNull() const { return ClangModule; } }; /// Return a descriptor for the corresponding module, if one exists. diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 04d6876076b..d8879cc6f10 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1676,8 +1676,11 @@ llvm::DIType *CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, llvm::DIModule * CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod, bool CreateSkeletonCU) { - std::string FullModuleName = Mod.getFullModuleName(); - auto &ModRef = ModuleRefCache[FullModuleName]; + // Use the Module pointer as the key into the cache. This is a + // nullptr if the "Module" is a PCH, which is safe because we don't + // support chained PCH debug info, so there can only be a single PCH. + const Module *M = Mod.getModuleOrNull(); + auto &ModRef = ModuleCache[M]; if (ModRef) return cast<llvm::DIModule>(ModRef); @@ -1704,6 +1707,7 @@ CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod, } } + std::string FullModuleName = Mod.getFullModuleName(); if (CreateSkeletonCU) { llvm::DIBuilder DIB(CGM.getModule()); DIB.createCompileUnit(TheCU->getSourceLanguage(), FullModuleName, @@ -1712,11 +1716,11 @@ CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod, llvm::DIBuilder::FullDebug, Mod.getSignature()); DIB.finalize(); } - llvm::DIModule *M = + llvm::DIModule *DIMod = DBuilder.createModule(TheCU, FullModuleName, ConfigMacros, Mod.getPath(), CGM.getHeaderSearchOpts().Sysroot); - ModRef.reset(M); - return M; + ModRef.reset(DIMod); + return DIMod; } llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index ddc90bfa67d..cce7bb2884f 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -96,7 +96,7 @@ class CGDebugInfo { llvm::SmallVector<ObjCInterfaceCacheEntry, 32> ObjCInterfaceCache; /// Cache of references to clang modules and precompiled headers. - llvm::StringMap<llvm::TrackingMDRef> ModuleRefCache; + llvm::DenseMap<const Module *, llvm::TrackingMDRef> ModuleCache; /// List of interfaces we want to keep even if orphaned. std::vector<void *> RetainedTypes; |