Refactor ASTSourceDescriptor to not store copies of all strings. (NFC)
llvm-svn: 248509
diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp
index 8d32dd2..f3b15fc5 100644
--- a/clang/lib/AST/ExternalASTSource.cpp
+++ b/clang/lib/AST/ExternalASTSource.cpp
@@ -29,13 +29,20 @@
}
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) {}