diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2019-11-04 11:10:09 -0800 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2019-11-04 11:40:03 -0800 |
commit | 8112a423a8ede9bce64b6553e6451bf10995105c (patch) | |
tree | 75e9affbe6879664d46600a409e5aa62ed3f9f7c /clang/lib/Frontend/CompilerInstance.cpp | |
parent | b2b6a54f847f33f821f41e3e82bf3b86e08817a0 (diff) | |
download | bcm5719-llvm-8112a423a8ede9bce64b6553e6451bf10995105c.tar.gz bcm5719-llvm-8112a423a8ede9bce64b6553e6451bf10995105c.zip |
clang/Modules: Bring back optimization lost in 31e14f41a21f
31e14f41a21f9016050a20f07d5da03db2e8c13e accidentally dropped caching of
failed module loads. This brings it back by making
ModuleMap::getCachedModuleLoad return an Optional.
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index cc3d848c1e0..a0663217453 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -1633,10 +1633,11 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, } // If we don't already have information on this module, load the module now. + Module *Module = nullptr; ModuleMap &MM = getPreprocessor().getHeaderSearchInfo().getModuleMap(); - clang::Module *Module = MM.getCachedModuleLoad(*Path[0].first); - if (Module) { - // Nothing to do here, we found it. + if (auto MaybeModule = MM.getCachedModuleLoad(*Path[0].first)) { + // Use the cached result, which may be nullptr. + Module = *MaybeModule; } else if (ModuleName == getLangOpts().CurrentModule) { // This is the module we're building. Module = PP->getHeaderSearchInfo().lookupModule( |