[clang] [clang][modules-driver] Add missing PrependArg for Clang module precompile jobs (PR #191610)

Naveen Seth Hanig via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 00:50:37 PDT 2026


https://github.com/naveen-seth created https://github.com/llvm/llvm-project/pull/191610

In `createClangModulePrecompileJob`, the `PrependArg` parameter was not being passed for the newly created Clang module precompile job. 
This causes failures for setups where the clang executable is a wrapper (e.g., the llvm-driver wrapper).

See https://github.com/llvm/llvm-project/pull/191258#issuecomment-4227294864

>From 02527e6c7042e76ad13d64bd55440c9b73b9acac Mon Sep 17 00:00:00 2001
From: Naveen Seth Hanig <naveen.hanig at outlook.com>
Date: Sat, 11 Apr 2026 09:47:34 +0200
Subject: [PATCH] [clang][modules-driver] Add missing PrependArg for Clang
 module precompile jobs

In `createClangModulePrecompileJob`, the PrependArg parameter was not
being passed for the newly created Clang module precompile job.
This causes test failures for scenarios like in
`clang/test/Driver/modules-driver-clang-modules-only.cpp` when
the clang executable is a wrapper (e.g., the llvm-driver wrapper).

See
https://github.com/llvm/llvm-project/pull/191258#issuecomment-4227294864
---
 clang/lib/Driver/ModulesDriver.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/clang/lib/Driver/ModulesDriver.cpp b/clang/lib/Driver/ModulesDriver.cpp
index 783f2270c4e0f..8738397c6cb75 100644
--- a/clang/lib/Driver/ModulesDriver.cpp
+++ b/clang/lib/Driver/ModulesDriver.cpp
@@ -1243,11 +1243,12 @@ createClangModulePrecompileJob(Compilation &C, const Command &ImportingJob,
   for (const auto &Arg : BuildArgs)
     JobArgs.push_back(TCArgs.MakeArgString(Arg));
 
-  return std::make_unique<Command>(*PA, ImportingJob.getCreator(),
-                                   ResponseFileSupport::AtFileUTF8(),
-                                   C.getDriver().getClangProgramPath(), JobArgs,
-                                   /*Inputs=*/ArrayRef<InputInfo>{},
-                                   /*Outputs=*/ArrayRef<InputInfo>{});
+  const auto &D = C.getDriver();
+  return std::make_unique<Command>(
+      *PA, ImportingJob.getCreator(), ResponseFileSupport::AtFileUTF8(),
+      D.getClangProgramPath(), JobArgs,
+      /*Inputs=*/ArrayRef<InputInfo>{},
+      /*Outputs=*/ArrayRef<InputInfo>{}, D.getPrependArg());
 }
 
 /// Creates a \c ClangModuleJobNode with associated job for each unique Clang



More information about the cfe-commits mailing list