[clang] [clang-cl] Fix dependency file naming with -o (PR #235578)

Chen Miao via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 20:05:11 PST 2026


================
@@ -9250,7 +9251,7 @@ const char *Clang::getDependencyFileName(const ArgList &Args,
                                          const InputInfoList &Inputs) {
   // FIXME: Think about this more.
 
-  if (Arg *OutputOpt = Args.getLastArg(options::OPT_o)) {
+  if (Arg *OutputOpt = Args.getLastArg(options::OPT_o, options::OPT__SLASH_o)) {
----------------
ChenMiaoi wrote:

We also need to account for `clang-cl`'s `-o` accepting a directory. Simply adding `OPT__SLASH_o` here makes `-o obj/` produce `obj/.d`, so this needs to handle directory outputs correctly.


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


More information about the cfe-commits mailing list