Skip to content

Commit 6a04c48

Browse files
[clang] ModuleFileCacheMap needs to be available for all actions
Make ModuleFileCacheMap available for all frontend actions so action cache module lookup works for swift because clang importer from swift is a subclass of `clang::ASTFrontendAction` which return false for `usesPreprocessorOnly()`.
1 parent 230b7b8 commit 6a04c48

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

clang/lib/Frontend/FrontendAction.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,13 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
948948
CI.getDiagnostics().Report(diag::err_module_map_not_found) << Filename;
949949
}
950950

951+
// Provide any modules from the action cache.
952+
for (const auto &KeyPair : CI.getFrontendOpts().ModuleCacheKeys)
953+
if (CI.addCachedModuleFile(KeyPair.first, KeyPair.second,
954+
"-fmodule-file-cache-key"))
955+
return false;
956+
957+
951958
// If compiling implementation of a module, load its module map file now.
952959
(void)CI.getPreprocessor().getCurrentModuleImplementation();
953960

@@ -1062,12 +1069,6 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
10621069
"doesn't support modules");
10631070
}
10641071

1065-
// Provide any modules from the action cache.
1066-
for (const auto &KeyPair : CI.getFrontendOpts().ModuleCacheKeys)
1067-
if (CI.addCachedModuleFile(KeyPair.first, KeyPair.second,
1068-
"-fmodule-file-cache-key"))
1069-
return false;
1070-
10711072
// If we were asked to load any module files, do so now.
10721073
for (const auto &ModuleFile : CI.getFrontendOpts().ModuleFiles)
10731074
if (!CI.loadModuleFile(ModuleFile))

0 commit comments

Comments
 (0)