================
@@ -5471,6 +5478,13 @@ void Driver::BuildJobs(Compilation &C) const {
           A->getKind() == clang::driver::Action::BinaryTranslatorJobClass)
         continue;
 
+      if (isa<PrecompileJobAction>(A) && !A->getInputs().empty()) {
+        const Action *FirstAction = A->getInputs().front();
+        if (FirstAction->getType() == types::TY_CXXStdModule ||
+            FirstAction->getType() == types::TY_PP_CXXStdModule)
+          continue;
+      }
----------------
naveen-seth wrote:

I've added a comment and simplified it a little.

We want to determine whether a `PrecompileJobAction` is for a Standard Library 
module input. Since `PrecompileJobAction::getType()` always returns 
`TY_ModuleFile`, we need to check using the `InputAction` which caused this 
this `PrecompileJobAction` to be generated instead.

The large context of this section of code is that the number of inputs is 
counted and an error is thrown if `-o` is used with > 1 input.
We still want something like `clang -fmodules-driver main.cpp -o main` to work. 
The implicitly generated `-cc1` jobs for Standard Library modules should 
therefore not be counted in that check.

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