aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp6
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp10
2 files changed, 12 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index e500675..49c1d8e 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1717,7 +1717,8 @@ void CompilerInstance::createASTReader() {
Listener->attachToASTReader(*TheASTReader);
}
-bool CompilerInstance::loadModuleFile(StringRef FileName) {
+bool CompilerInstance::loadModuleFile(
+ StringRef FileName, serialization::ModuleFile *&LoadedModuleFile) {
llvm::Timer Timer;
if (FrontendTimerGroup)
Timer.init("preloading." + FileName.str(), "Preloading " + FileName.str(),
@@ -1743,7 +1744,8 @@ bool CompilerInstance::loadModuleFile(StringRef FileName) {
// Try to load the module file.
switch (TheASTReader->ReadAST(
FileName, serialization::MK_ExplicitModule, SourceLocation(),
- ConfigMismatchIsRecoverable ? ASTReader::ARR_ConfigurationMismatch : 0)) {
+ ConfigMismatchIsRecoverable ? ASTReader::ARR_ConfigurationMismatch : 0,
+ &LoadedModuleFile)) {
case ASTReader::Success:
// We successfully loaded the module file; remember the set of provided
// modules so that we don't try to load implicit modules for them.
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 2da25be..e016b94 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -1023,10 +1023,16 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
}
// If we were asked to load any module files, do so now.
- for (const auto &ModuleFile : CI.getFrontendOpts().ModuleFiles)
- if (!CI.loadModuleFile(ModuleFile))
+ for (const auto &ModuleFile : CI.getFrontendOpts().ModuleFiles) {
+ serialization::ModuleFile *Loaded = nullptr;
+ if (!CI.loadModuleFile(ModuleFile, Loaded))
return false;
+ if (Loaded && Loaded->StandardCXXModule)
+ CI.getDiagnostics().Report(
+ diag::warn_eagerly_load_for_standard_cplusplus_modules);
+ }
+
// If there is a layout overrides file, attach an external AST source that
// provides the layouts from that file.
if (!CI.getFrontendOpts().OverrideRecordLayoutsFile.empty() &&