[clang] [Feature]: merge host and kernel dependencies for heterogeneous compilation (PR #119513)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 21 10:19:34 PST 2025


================
@@ -1056,8 +1056,20 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
         DepFile = getDependencyFileName(Args, Inputs);
         C.addFailureResultFile(DepFile, &JA);
       }
-      CmdArgs.push_back("-dependency-file");
-      CmdArgs.push_back(DepFile);
+      // for host compile, if OPT_MMMD is on, default to create *.d.host file
+      // and merge it with *.d (kernel dep) file in DependencyFile.cpp
+      Arg *ArgMMD = Args.getLastArg(options::OPT_MMMD);
+      auto at = getToolChain().getAuxTriple();
+      if (ArgMMD && !at && std::string(DepFile) != "-") {
+        SmallString<128> NewDepFile(DepFile);
+        NewDepFile.append(".host");
----------------
yxsamliu wrote:

This name may conflict with other files. Is there a way to avoid the conflict? How about add CUID as part of postfix?

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


More information about the cfe-commits mailing list