diff options
author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-09-07 17:10:07 +0800 |
---|---|---|
committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-09-07 17:13:16 +0800 |
commit | 869111ccf2d3916bf24a31bdb367d7e567483ff0 (patch) | |
tree | b58d9fcd080657ec57c3e774430b14be2aa00a3c /clang/lib/Frontend/FrontendAction.cpp | |
parent | 31ded495271e5869d619da851a351c9f6f05b2d4 (diff) | |
download | llvm-869111ccf2d3916bf24a31bdb367d7e567483ff0.zip llvm-869111ccf2d3916bf24a31bdb367d7e567483ff0.tar.gz llvm-869111ccf2d3916bf24a31bdb367d7e567483ff0.tar.bz2 |
[NFC] [C++20] [Modules] Refactor the warning to '-fmodule-file=<BMIPath>' for C++20 modules
Previous implementation of the warning to use `-fmodule-file=<BMIPath>`
for C++20 Modules is not straightforward and it is problematic in case
we read the BMIPath by writing tools based clang components. This patch
refactors it with a simple and direct style.
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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() && |