diff options
author | Reid Kleckner <rnk@google.com> | 2020-02-27 18:13:54 -0800 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2020-03-11 13:37:41 -0700 |
commit | c915cb957dc37275ce1ca1a0b993239c82f12692 (patch) | |
tree | 77ffdcc1ea4e7c968624e10ee6b55312a76e13b8 /clang/lib/Basic/Module.cpp | |
parent | a0cacb60549f2346f7addf9205cd32720afc8fb4 (diff) | |
download | llvm-c915cb957dc37275ce1ca1a0b993239c82f12692.zip llvm-c915cb957dc37275ce1ca1a0b993239c82f12692.tar.gz llvm-c915cb957dc37275ce1ca1a0b993239c82f12692.tar.bz2 |
Avoid including Module.h from ExternalASTSource.h
Module.h takes 86ms to parse, mostly parsing the class itself. Avoid it
if possible. ASTContext.h depends on ExternalASTSource.h.
A few NFC changes were needed to make this possible:
- Move ASTSourceDescriptor to Module.h. This needs Module to be
complete, and seems more related to modules and AST files than
external AST sources.
- Move "import complete" bit from Module* pointer int pair to
NextLocalImport pointer. Required because PointerIntPair<Module*,...>
requires Module to be complete, and now it may not be.
Reviewed By: aaron.ballman, hans
Differential Revision: https://reviews.llvm.org/D75784
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 7fb6dee..dd8f111 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -658,3 +658,18 @@ void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc, }; VisitModule({M, nullptr}); } + +ASTSourceDescriptor::ASTSourceDescriptor(const Module &M) + : Signature(M.Signature), ClangModule(&M) { + if (M.Directory) + Path = M.Directory->getName(); + if (auto *File = M.getASTFile()) + ASTFile = File->getName(); +} + +std::string ASTSourceDescriptor::getModuleName() const { + if (ClangModule) + return ClangModule->Name; + else + return std::string(PCHModuleName); +} |