[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


================
@@ -873,7 +873,8 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
 
       // If user provided -o, that is the dependency target, except
       // when we are only generating a dependency file.
-      Arg *OutputOpt = Args.getLastArg(options::OPT_o, options::OPT__SLASH_Fo);
+      Arg *OutputOpt = Args.getLastArg(options::OPT_o, options::OPT__SLASH_o,
+                                       options::OPT__SLASH_Fo);
----------------
ChenMiaoi wrote:

With `-o obj/`, this generates `-MT obj/`, resulting in:

```
obj/: a.c
```

The target should be the actual object file:

```
obj/a.obj: a.c
```

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


More information about the cfe-commits mailing list