diff options
| author | Adrian Prantl <aprantl@apple.com> | 2015-09-24 16:10:00 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2015-09-24 16:10:00 +0000 |
| commit | 6083b08580185643561b34166a98d7315b2981b8 (patch) | |
| tree | 6b23f3e66f94707398b2aeb252e9af1e85d941a5 /clang/lib | |
| parent | b6be1ebb7d53475c4edd88131efd52a84e1b6b23 (diff) | |
| download | bcm5719-llvm-6083b08580185643561b34166a98d7315b2981b8.tar.gz bcm5719-llvm-6083b08580185643561b34166a98d7315b2981b8.zip | |
Refactor ASTSourceDescriptor to not store copies of all strings. (NFC)
llvm-svn: 248509
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ExternalASTSource.cpp | 9 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 13 |
2 files changed, 15 insertions, 7 deletions
diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp index 8d32dd23bbe..f3b15fc58c8 100644 --- a/clang/lib/AST/ExternalASTSource.cpp +++ b/clang/lib/AST/ExternalASTSource.cpp @@ -29,13 +29,20 @@ ExternalASTSource::getSourceDescriptor(unsigned ID) { } ExternalASTSource::ASTSourceDescriptor::ASTSourceDescriptor(const Module &M) - : FullModuleName(M.getFullModuleName()), Signature(M.Signature) { + : Signature(M.Signature), ClangModule(&M) { if (M.Directory) Path = M.Directory->getName(); if (auto *File = M.getASTFile()) ASTFile = File->getName(); } +std::string ExternalASTSource::ASTSourceDescriptor::getFullModuleName() const { + if (ClangModule) + return ClangModule->getFullModuleName(); + else + return PCHModuleName; +} + void ExternalASTSource::FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length, SmallVectorImpl<Decl *> &Decls) {} diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 72ddf4efc7c..04d6876076b 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1676,7 +1676,8 @@ llvm::DIType *CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, llvm::DIModule * CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod, bool CreateSkeletonCU) { - auto &ModRef = ModuleRefCache[Mod.FullModuleName]; + std::string FullModuleName = Mod.getFullModuleName(); + auto &ModRef = ModuleRefCache[FullModuleName]; if (ModRef) return cast<llvm::DIModule>(ModRef); @@ -1705,14 +1706,14 @@ CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod, if (CreateSkeletonCU) { llvm::DIBuilder DIB(CGM.getModule()); - DIB.createCompileUnit(TheCU->getSourceLanguage(), Mod.FullModuleName, - Mod.Path, TheCU->getProducer(), true, StringRef(), 0, - Mod.ASTFile, llvm::DIBuilder::FullDebug, - Mod.Signature); + DIB.createCompileUnit(TheCU->getSourceLanguage(), FullModuleName, + Mod.getPath(), TheCU->getProducer(), true, + StringRef(), 0, Mod.getASTFile(), + llvm::DIBuilder::FullDebug, Mod.getSignature()); DIB.finalize(); } llvm::DIModule *M = - DBuilder.createModule(TheCU, Mod.FullModuleName, ConfigMacros, Mod.Path, + DBuilder.createModule(TheCU, FullModuleName, ConfigMacros, Mod.getPath(), CGM.getHeaderSearchOpts().Sysroot); ModRef.reset(M); return M; |

