[clang] [C++20] [Modules] Introduce -fexperimental-modules-reduced-bmi (PR #85050)

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 12 14:55:52 PDT 2024


================
@@ -1061,6 +1070,16 @@ CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
     CI.getPreprocessor().addPPCallbacks(std::move(Callbacks));
   }
 
+  if (CI.getFrontendOpts().GenReducedBMI &&
+      !CI.getFrontendOpts().ModuleOutputPath.empty()) {
+    std::vector<std::unique_ptr<ASTConsumer>> Consumers{2};
+    Consumers[0] = std::make_unique<ReducedBMIGenerator>(
+        CI.getPreprocessor(), CI.getModuleCache(),
+        CI.getFrontendOpts().ModuleOutputPath);
+    Consumers[1] = std::move(Result);
+    return std::make_unique<MultiplexConsumer>(std::move(Consumers));
+  }
----------------
dwblaikie wrote:

Why is this new code, rather than an alternative codepath of existing code? (like some code that was producing the BMI would go from producing the unreduced BMI to producing the reduced BMI)

Figuring this out would help me unedrstand why `ModuleOutputPath` is new (this patch doesn't add the functionality to output a module to a path - we had that already, this just changes the content that goes there)

I guess because maybe this patch is changing the way we output the BMI - or that the reduced BMI is being output in a different way than the non-reduced BMI?

Should we address that? Make the current full BMI emission work the same way as the reduced BMI? (or, more precisely, in a pre-patch, change the full BMI emission to use a mechanism that can then be reused for the reduced BMI?)

https://github.com/llvm/llvm-project/pull/85050


More information about the cfe-commits mailing list