================
@@ -1597,6 +1598,22 @@ static void fixupNamedModuleCommandLines(Compilation &C,
       llvm::CastTo<NamedModuleJobNode>);
 
   for (NamedModuleJobNode *Node : NamedModuleNodes) {
+    const auto &Job = *Node->Job;
+
+    // For Standard library modules, the driver already creates the module
+    // output as a temp file, so we can use that path directly.
+    const bool IsStdModule =
+        Job.getInputInfos().front().getType() == types::TY_CXXStdModule;
+    if (IsStdModule) {
+      const auto &OutputFilenames = Job.getOutputFilenames();
+      if (OutputFilenames.empty())
+        continue;
+
+      StringRef ModuleOutputPath = Job.getOutputFilenames().front();
+      propagateModuleFileMappingArg(C, *Node, ModuleOutputPath);
+      continue;
+    }
----------------
naveen-seth wrote:

This part of the PR adds the Standard library modules to the compilation inputs 
as `types::TY_CXXStdModule`: 
https://github.com/naveen-seth/llvm-project/blob/8eab412ee4d1166ee125dfcf6879aa36ed8fd94e/clang/lib/Driver/ModulesDriver.cpp#L149

The change this PR makes in Driver.cpp is to ensure that inputs of type 
`TY_CXXStdModule` always generate a -cc1 command line in the from of `-cc1 ... 
-emit-reduced-module-interface`, rather than `-c -fmodule-output`.
https://github.com/naveen-seth/llvm-project/blob/1d2321979a95cedb87956fbec6063bcce14952f1/clang/lib/Driver/Driver.cpp#L5278
The tests added in the PR also verify that this happens when targeting 
different final phases, such as `-fsyntax-only` or `-S -emit-llvm`.

SO in this case, we can skip adding `-fmodule-output`.

https://github.com/llvm/llvm-project/pull/199289
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to