aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2020-02-29 09:10:42 -0800
committerReid Kleckner <rnk@google.com>2020-03-11 13:53:12 -0700
commite08464fb450456881733c885267b32dc7339cf11 (patch)
tree1a11e18cf258b651cdb87814626417a70271ea71 /clang/lib/Lex/ModuleMap.cpp
parent526a4f2ac365a5babbc80e0f7c17be310728a538 (diff)
downloadllvm-e08464fb450456881733c885267b32dc7339cf11.zip
llvm-e08464fb450456881733c885267b32dc7339cf11.tar.gz
llvm-e08464fb450456881733c885267b32dc7339cf11.tar.bz2
Avoid including FileManager.h from SourceManager.h
Most clients of SourceManager.h need to do things like turning source locations into file & line number pairs, but this doesn't require bringing in FileManager.h and LLVM's FS headers. The main code change here is to sink SM::createFileID into the cpp file. I reason that this is not performance critical because it doesn't happen on the diagnostic path, it happens along the paths of macro expansion (could be hot) and new includes (less hot). Saves some includes: 309 - /usr/local/google/home/rnk/llvm-project/clang/include/clang/Basic/FileManager.h 272 - /usr/local/google/home/rnk/llvm-project/clang/include/clang/Basic/FileSystemOptions.h 271 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/VirtualFileSystem.h 267 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/FileSystem.h 266 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Chrono.h Differential Revision: https://reviews.llvm.org/D75406
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 1c340f3..bff4e11 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -1244,6 +1244,11 @@ void ModuleMap::setInferredModuleAllowedBy(Module *M, const FileEntry *ModMap) {
InferredModuleAllowedBy[M] = ModMap;
}
+void ModuleMap::addAdditionalModuleMapFile(const Module *M,
+ const FileEntry *ModuleMap) {
+ AdditionalModMaps[M].insert(ModuleMap);
+}
+
LLVM_DUMP_METHOD void ModuleMap::dump() {
llvm::errs() << "Modules:";
for (llvm::StringMap<Module *>::iterator M = Modules.begin(),