[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-04 Thread Sharadh Rajaraman via cfe-commits

sharadhr wrote:

If this is consensus, then I will rework this PR from scratch to expose 
`/ifcOutput` (or any other appropriate flag, just not `/Fo` or `-o`) with 
`clang-cl`.

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-04 Thread Ben Boeckel via cfe-commits

mathstuf wrote:

I don't really care how things are spelled as long as they're possible. Don't 
take what CMake does for `clang-cl` and modules as gospel as it is very much 
not declared as supported at all. We can rework how CMake constructs command 
lines for `clang-cl` and modules as needed.

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-04 Thread Chuanqi Xu via cfe-commits

ChuanqiXu9 wrote:

CC @mathstuf @bradking 

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-04 Thread Sharadh Rajaraman via cfe-commits

sharadhr wrote:

> I think this patch needs to go back to the drawing board.

I agree. `/Fo` is strictly for object files—that is, `.obj` as a result of a 
compilation—that is, `/c`, whereas `-o` is meant for 'any output'. 

My understanding is that @Arthapz made `/clang:-o` work with upstream, even 
without this patch. CMake needs to rework its understanding of the Clang 
compilation model and perhaps rework its invocation of BMI compilation and 
`clang-scan-deps`.

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-04 Thread Hans Wennborg via cfe-commits

https://github.com/zmodem edited 
https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-04 Thread Hans Wennborg via cfe-commits

https://github.com/zmodem requested changes to this pull request.

> I'll land this one week later if no objection or new comments come in

I object.

Even the author seems to object:

> I believe it is now incorrect to use /Fo for the BMI output

The change to `Driver::GetNamedOutputPath` has not been explained yet, beyond 
"it seems to make the tests pass".

And the whole approach of making clang-cl's `/Fo` ("set object file noame") to 
something different from MSVC's seems very questionable.

I think this patch needs to go back to the drawing board.

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-03 Thread Chuanqi Xu via cfe-commits


@@ -14,3 +14,11 @@
 
 //--- test.pcm
 // CPP20WARNING-NOT: clang-cl: warning: argument unused during compilation: 
'/std:c++20' [-Wunused-command-line-argument]
+
+// test whether the following outputs %Hello.bmi

ChuanqiXu9 wrote:

```suggestion
// test whether the following outputs %t/Hello.bmi
```

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-03 Thread Chuanqi Xu via cfe-commits

https://github.com/ChuanqiXu9 edited 
https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-03 Thread Chuanqi Xu via cfe-commits

https://github.com/ChuanqiXu9 approved this pull request.

Given the problem is important (I've heard the problem for clang-cl with 
modules several times) and the author have been active on this direction for 
years, I think I can trust him even if I can't test it actually. So LGTM.

I'll land this one week later if no objection or new comments come in, 
@sharadhr remind me that time if I forget it somehow.

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-07-03 Thread via cfe-commits

h-vetinari wrote:

> given how important this it, I hope we can make this for clang21. Thanks!

FYI, branching for LLVM v21 is less than [two weeks 
away](https://discourse.llvm.org/t/llvm-21-x-release-information-and-branching/87065)




https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-22 Thread Arthur Laurent via cfe-commits

Arthapz wrote:

> > xmake dev said he can fix the problem by /clang:-o
> 
> We [tried this, but it didn't work when generating multiple output 
> files](https://gitlab.kitware.com/cmake/cmake/-/issues/25731#note_1603818). 
> In particular, a `scan-with-pch` test still fails. Perhaps @Arthapz needs to 
> widen the test scenarios for xmake.
> 
> ```
> CMake Error at R:/cmake/Tests/RunCMake/RunCMake.cmake:289 (message):
> examples/scan-with-pch-build - FAILED:
> 
> Result is [1], not [0].
> 
> Command was:
> 
> command> "R:/cmake/out/build/RelWithDebInfo/bin/cmake.exe" "--build" "." 
> "--config" "Debug"
> 
> Actual stdout:
> 
> actual-stdout> [1/5] Building CXX object 
> CMakeFiles\simple.dir\cmake_pch.cxx.obj
> actual-stdout> FAILED: CMakeFiles/simple.dir/cmake_pch.cxx.obj
> actual-stdout> R:\llvm-project\build\x64-release\bin\clang-cl.exe  /nologo 
> -TP   /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++20 -MDd -Zi 
> /YcR:/cmake/out/build/RelWithDebInfo/Tests/RunCMake/CXXModules/examples/scan-with-pch-build/CMakeFiles/simple.dir/cmake_pch.hxx
>  
> /FpR:/cmake/out/build/RelWithDebInfo/Tests/RunCMake/CXXModules/examples/scan-with-pch-build/CMakeFiles/simple.dir/./cmake_pch.cxx.pch
>  
> /FIR:/cmake/out/build/RelWithDebInfo/Tests/RunCMake/CXXModules/examples/scan-with-pch-build/CMakeFiles/simple.dir/cmake_pch.hxx
>  /showIncludes -clang:-oCMakeFiles\simple.dir\cmake_pch.cxx.obj 
> /FdCMakeFiles\simple.dir\ -c -- 
> R:\cmake\out\build\RelWithDebInfo\Tests\RunCMake\CXXModules\examples\scan-with-pch-build\CMakeFiles\simple.dir\cmake_pch.cxx
> actual-stdout> clang-cl: error: cannot specify -o when generating multiple 
> output files
> actual-stdout> ninja: build stopped: subcommand failed.
> ```
well i'm still experimenting,
i'm not using /clang: on scanning step (and i don't remove -Fo flag), only at 
build step
pch with module fail but for an other reason
https://github.com/user-attachments/assets/70141ac1-cb01-4b64-8add-381463b5ec86";
 />


https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-22 Thread Sharadh Rajaraman via cfe-commits

sharadhr wrote:

> xmake dev said he can fix the problem by /clang:-o

We [tried this, but it didn't seem to 
work](https://gitlab.kitware.com/cmake/cmake/-/issues/25731#note_1603818). 
However, I think that issue has a subtle but important difference: @Arthapz has 
used [`/clang:-o 
-clang:`](https://github.com/xmake-io/xmake/pull/6477/files#diff-b526124d8e7f20d143a49c263e4bf8ba6ebb77b799aa1b8d5e93639fd4e2d77cR44)
 whereas we used `/clang:-o`. I'm not sure why this difference 
manifested, but it seems to _almost_ work now with the above change.

However, a `scan-with-pch` test still fails because `clang-cl: error: cannot 
specify -o when generating multiple output files`.

```
CMake Error at R:/cmake/Tests/RunCMake/RunCMake.cmake:289 (message):
examples/scan-with-pch-build - FAILED:

Result is [1], not [0].

Command was:

command> "R:/cmake/out/build/RelWithDebInfo/bin/cmake.exe" "--build" "." 
"--config" "Debug"

Actual stdout:

actual-stdout> [1/5] Building CXX object CMakeFiles\simple.dir\cmake_pch.cxx.obj
actual-stdout> FAILED: CMakeFiles/simple.dir/cmake_pch.cxx.obj
actual-stdout> R:\llvm-project\build\x64-release\bin\clang-cl.exe  /nologo -TP  
 /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++20 -MDd -Zi 
/YcR:/cmake/out/build/RelWithDebInfo/Tests/RunCMake/CXXModules/examples/scan-with-pch-build/CMakeFiles/simple.dir/cmake_pch.hxx
 
/FpR:/cmake/out/build/RelWithDebInfo/Tests/RunCMake/CXXModules/examples/scan-with-pch-build/CMakeFiles/simple.dir/./cmake_pch.cxx.pch
 
/FIR:/cmake/out/build/RelWithDebInfo/Tests/RunCMake/CXXModules/examples/scan-with-pch-build/CMakeFiles/simple.dir/cmake_pch.hxx
 /showIncludes -clang:-oCMakeFiles\simple.dir\cmake_pch.cxx.obj 
/FdCMakeFiles\simple.dir\ -c -- 
R:\cmake\out\build\RelWithDebInfo\Tests\RunCMake\CXXModules\examples\scan-with-pch-build\CMakeFiles\simple.dir\cmake_pch.cxx
actual-stdout> clang-cl: error: cannot specify -o when generating multiple 
output files
actual-stdout> ninja: build stopped: subcommand failed.
```


https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-21 Thread Chuanqi Xu via cfe-commits

ChuanqiXu9 wrote:

@mathstuf in 
https://github.com/llvm/llvm-project/issues/140825#issuecomment-2900112555 , 
xmake dev said he can fix the problem by `/clang:-o`. I am wondering if you can 
did similar thing in CMake if there is an argument?

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-16 Thread Sharadh Rajaraman via cfe-commits

sharadhr wrote:

I believe the issue can be distilled further.

On the `main` branch, this command outputs `Hello.bmi`, assuming `Hello.cppm` 
exists and has `export module Hello;`:
```
clang.exe --precompile -x c++-module -o Hello.bmi -c Hello.cppm
```

This command does not:
```
clang-cl.exe --precompile -x c++-module -o Hello.bmi -c Hello.cppm
```

This command also does not:
```
clang-cl.exe --precompile -x c++-module /o Hello.bmi -c Hello.cppm
```

And the only lines where the driver behaviour appears to diverge, is the `if` 
block in `Driver.cpp`, commented as below:
```cxx
// Output to a user requested destination?
if (AtTopLevel && !isa(JA) && !isa(JA)) {
  ...
}
```

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Chuanqi Xu via cfe-commits

ChuanqiXu9 wrote:

> Is `-Fo` even relevant here? The BMI output name comes from `-ifcOutput` (or 
> `-fmodule-output=`). Consumption of external modules doesn't need an object, 
> so it would only use `-fmodule-output=`.
> 
> > Sorry, I don't remember seeing that discussion
> 
> See this thread: 
> https://discourse.llvm.org/t/clang-cl-exe-support-for-c-modules/72257

But if we want to generate BMI only instead of obj files, we should use 
`--precompile -o`

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Sharadh Rajaraman via cfe-commits

https://github.com/sharadhr updated 
https://github.com/llvm/llvm-project/pull/121046



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Ben Boeckel via cfe-commits

mathstuf wrote:

Is `-Fo` even relevant here? The BMI output name comes from `-ifcOutput` (or 
`-fmodule-output=`). Consumption of external modules doesn't need an object, so 
it would only use `-fmodule-output=`.

> Sorry, I don't remember seeing that discussion

See this thread: 
https://discourse.llvm.org/t/clang-cl-exe-support-for-c-modules/72257

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Hans Wennborg via cfe-commits

zmodem wrote:

> I think '/Fo' is basically '-o'. Its semantic is to specify the path to the 
> output file.

No, `/Fo` is for object files, `/Fe` for the executable, `/Fp` for pch file etc.

> So if now clang-cl can accept '-o' [...]

It works in general in clang-cl. I guess we'd have to double check if it works 
in the modules use case. And `-fmodule-output` is exposed in clang-cl as well, 
so it sounds like there are plenty of flags already :)

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Chuanqi Xu via cfe-commits

ChuanqiXu9 wrote:

> > @zmodem given how important this it, I hope we can make this for clang21. 
> > Thanks!
> 
> I'm just a reviewer here, and I still find the patch very confusing.

Not asking for an approval. It is just a ping : )
> 
> And taking a step back, the whole point of clang-cl is to provide a cl.exe 
> compatible interface to clang. I presume cl.exe does not use `--precompile -x 
> c++-module` to produce BMI files. Shouldn't we try to match what they're 
> doing?



https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Chuanqi Xu via cfe-commits

ChuanqiXu9 wrote:

> Sorry, I don't remember seeing that discussion, and I'm probably missing lots 
> of modules context. As a counter argument, clang-cl uses `/Yc` and `/Fp` to 
> generate PCH files, to match MSVC's interface although the file format is 
> different.
> 
> More importantly, it feels like we're being very unintentional about the 
> interface design here. Why should clang-cl's `/Fo` name a BMI file if that's 
> not what MSVC does, and the document clearly says that the flag "Specifies an 
> object (.obj) file name or directory to be used instead of the default."?
> 
> If the idea is to punt on the design, maybe the solution is just to use 
> regular clang flags for this?

although I don't use MSVC. I think '/Fo' is basically '-o'. Its semantic is to 
specify the path to the output file. And with '--precompile' the output file is 
BMI. And with '-c', the output is obj files. And with '-emit-llvm', the output 
is llvm ir. So I feel it is fine.

But of course, all of these are my thoughts and imagination. I am never a 
clang-cl user ever. So if now clang-cl can accept '-o', I don't mind to use 
that if @mathstuf agrees on this. Since most end users won't write this in my 
mind. The build system are the major users here.

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Hans Wennborg via cfe-commits

zmodem wrote:

Sorry, I don't remember seeing that discussion, and I'm probably missing lots 
of modules context. As a counter argument, clang-cl uses `/Yc` and `/Fp` to 
generate PCH files, to match MSVC's interface although the file format is 
different.

More importantly, it feels like we're being very unintentional about the 
interface design here. Why should clang-cl's `/Fo` name a BMI file if that's 
not what MSVC does, and the document clearly says that the flag "Specifies an 
object (.obj) file name or directory to be used instead of the default."?

If the idea is to punt on the design, maybe the solution is just to use regular 
clang flags for this?

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Ben Boeckel via cfe-commits

mathstuf wrote:

That was discussed on Discourse. If/when `clang-cl` starts writing and reading 
MSVC-compatible BMIs, it can use the same flags. Until then, it would be very 
weird to use `-ifcOutput` for `clang-cl` when it is not using the IFC format at 
all.

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Hans Wennborg via cfe-commits

zmodem wrote:

> @zmodem given how important this it, I hope we can make this for clang21. 
> Thanks!

I'm just a reviewer here, and I still find the patch very confusing.

And taking a step back, the whole point of clang-cl is to provide a cl.exe 
compatible interface to clang. I presume cl.exe does not use `--precompile -x 
c++-module` to produce BMI files. Shouldn't we try to match what they're doing?

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Sharadh Rajaraman via cfe-commits

https://github.com/sharadhr updated 
https://github.com/llvm/llvm-project/pull/121046



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Sharadh Rajaraman via cfe-commits

https://github.com/sharadhr updated 
https://github.com/llvm/llvm-project/pull/121046



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Sharadh Rajaraman via cfe-commits

https://github.com/sharadhr updated 
https://github.com/llvm/llvm-project/pull/121046

>From d6c2b9b7ef542975d9313dacd10003a9a6629504 Mon Sep 17 00:00:00 2001
From: Sharadh Rajaraman 
Date: Fri, 7 Feb 2025 21:24:12 +
Subject: [PATCH 1/3] Accept /Fo and -Fo in `-fmodule-output` when running
 under CL mode

---
 clang/lib/Driver/Driver.cpp | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 90d8e823d1d02..4aefa7196354d 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6204,10 +6204,29 @@ const char *Driver::GetNamedOutputPath(Compilation &C, 
const JobAction &JA,
   }
 
   llvm::PrettyStackTraceString CrashInfo("Computing output path");
+
   // Output to a user requested destination?
   if (AtTopLevel && !isa(JA) && !isa(JA)) {
-if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o))
+bool IsCLNonPCH =
+IsCLMode() && !C.getArgs().hasArg(options::OPT__SLASH_Yc) &&
+(isa(JA) || isa(JA));
+bool HasAnyOutputArg = C.getArgs().hasArg(
+options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON);
+
+Arg *FinalOutput = nullptr;
+if (IsCLNonPCH && HasAnyOutputArg) {
+  FinalOutput = C.getArgs().getLastArg(
+  options::OPT_o, options::OPT__SLASH_Fo, 
options::OPT__SLASH_Fo_COLON);
+} else if (IsCLNonPCH) {
+  FinalOutput = C.getArgs().getLastArg(options::OPT__SLASH_Fo,
+   options::OPT__SLASH_Fo_COLON);
+} else {
+  FinalOutput = C.getArgs().getLastArg(options::OPT_o);
+}
+
+if (FinalOutput) {
   return C.addResultFile(FinalOutput->getValue(), &JA);
+}
   }
 
   // For /P, preprocess to file named after BaseInput.

>From 59dcf4d9c9218bfbf6da3b7a3b99c055707d477b Mon Sep 17 00:00:00 2001
From: Sharadh Rajaraman 
Date: Sat, 8 Feb 2025 21:24:53 +
Subject: [PATCH 2/3] Add a test for the -fmodule-output BMI output file

---
 clang/test/Driver/cl-cxx20-modules.cppm | 8 
 1 file changed, 8 insertions(+)

diff --git a/clang/test/Driver/cl-cxx20-modules.cppm 
b/clang/test/Driver/cl-cxx20-modules.cppm
index 43dbf517485a0..8744745019d15 100644
--- a/clang/test/Driver/cl-cxx20-modules.cppm
+++ b/clang/test/Driver/cl-cxx20-modules.cppm
@@ -14,3 +14,11 @@
 
 //--- test.pcm
 // CPP20WARNING-NOT: clang-cl: warning: argument unused during compilation: 
'/std:c++20' [-Wunused-command-line-argument]
+
+// test whether the following outputs %Hello.bmi
+// RUN: %clang_cl /std:c++20 --precompile -x c++-module 
-fmodule-output=%t/Hello.bmi -Fo"%t/Hello.bmi" -c %t/Hello.cppm -### 2>&1 | 
FileCheck %s
+// CHECK: "-emit-module-interface"
+// CHECK: "-o" "{{.*}}Hello.bmi"
+
+//--- Hello.cppm
+export module Hello;
\ No newline at end of file

>From 865385588ed11ced81b3fd741d1840b7df431c22 Mon Sep 17 00:00:00 2001
From: Sharadh Rajaraman 
Date: Thu, 15 May 2025 10:44:52 +0800
Subject: [PATCH 3/3] SLASH_Fo and SLASH_Fo_COLON are aliases

---
 clang/lib/Driver/Driver.cpp | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 4aefa7196354d..45e728e8f22bf 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6211,15 +6211,14 @@ const char *Driver::GetNamedOutputPath(Compilation &C, 
const JobAction &JA,
 IsCLMode() && !C.getArgs().hasArg(options::OPT__SLASH_Yc) &&
 (isa(JA) || isa(JA));
 bool HasAnyOutputArg = C.getArgs().hasArg(
-options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON);
+options::OPT_o, options::OPT__SLASH_Fo);
 
 Arg *FinalOutput = nullptr;
 if (IsCLNonPCH && HasAnyOutputArg) {
   FinalOutput = C.getArgs().getLastArg(
-  options::OPT_o, options::OPT__SLASH_Fo, 
options::OPT__SLASH_Fo_COLON);
+  options::OPT_o, options::OPT__SLASH_Fo);
 } else if (IsCLNonPCH) {
-  FinalOutput = C.getArgs().getLastArg(options::OPT__SLASH_Fo,
-   options::OPT__SLASH_Fo_COLON);
+  FinalOutput = C.getArgs().getLastArg(options::OPT__SLASH_Fo);
 } else {
   FinalOutput = C.getArgs().getLastArg(options::OPT_o);
 }

___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-15 Thread Sharadh Rajaraman via cfe-commits

https://github.com/sharadhr updated 
https://github.com/llvm/llvm-project/pull/121046

>From b6bda7bd5980f3ff9bb9bd680846eb1bb05ac7c7 Mon Sep 17 00:00:00 2001
From: Sharadh Rajaraman 
Date: Fri, 7 Feb 2025 21:24:12 +
Subject: [PATCH 1/3] Accept /Fo and -Fo in `-fmodule-output` when running
 under CL mode

---
 clang/lib/Driver/Driver.cpp | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 4d9492ea08f64..36749a9075001 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6097,10 +6097,29 @@ const char *Driver::GetNamedOutputPath(Compilation &C, 
const JobAction &JA,
   }
 
   llvm::PrettyStackTraceString CrashInfo("Computing output path");
+
   // Output to a user requested destination?
   if (AtTopLevel && !isa(JA) && !isa(JA)) {
-if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o))
+bool IsCLNonPCH =
+IsCLMode() && !C.getArgs().hasArg(options::OPT__SLASH_Yc) &&
+(isa(JA) || isa(JA));
+bool HasAnyOutputArg = C.getArgs().hasArg(
+options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON);
+
+Arg *FinalOutput = nullptr;
+if (IsCLNonPCH && HasAnyOutputArg) {
+  FinalOutput = C.getArgs().getLastArg(
+  options::OPT_o, options::OPT__SLASH_Fo, 
options::OPT__SLASH_Fo_COLON);
+} else if (IsCLNonPCH) {
+  FinalOutput = C.getArgs().getLastArg(options::OPT__SLASH_Fo,
+   options::OPT__SLASH_Fo_COLON);
+} else {
+  FinalOutput = C.getArgs().getLastArg(options::OPT_o);
+}
+
+if (FinalOutput) {
   return C.addResultFile(FinalOutput->getValue(), &JA);
+}
   }
 
   // For /P, preprocess to file named after BaseInput.

>From acad422d098855251252c0c5925f571f1b38631d Mon Sep 17 00:00:00 2001
From: Sharadh Rajaraman 
Date: Sat, 8 Feb 2025 21:24:53 +
Subject: [PATCH 2/3] Add a test for the -fmodule-output BMI output file

---
 clang/test/Driver/cl-cxx20-modules.cppm | 8 
 1 file changed, 8 insertions(+)

diff --git a/clang/test/Driver/cl-cxx20-modules.cppm 
b/clang/test/Driver/cl-cxx20-modules.cppm
index 43dbf517485a0..8744745019d15 100644
--- a/clang/test/Driver/cl-cxx20-modules.cppm
+++ b/clang/test/Driver/cl-cxx20-modules.cppm
@@ -14,3 +14,11 @@
 
 //--- test.pcm
 // CPP20WARNING-NOT: clang-cl: warning: argument unused during compilation: 
'/std:c++20' [-Wunused-command-line-argument]
+
+// test whether the following outputs %Hello.bmi
+// RUN: %clang_cl /std:c++20 --precompile -x c++-module 
-fmodule-output=%t/Hello.bmi -Fo"%t/Hello.bmi" -c %t/Hello.cppm -### 2>&1 | 
FileCheck %s
+// CHECK: "-emit-module-interface"
+// CHECK: "-o" "{{.*}}Hello.bmi"
+
+//--- Hello.cppm
+export module Hello;
\ No newline at end of file

>From 91cf98bdb6827f30ea75cbefd5db419825ecc116 Mon Sep 17 00:00:00 2001
From: Sharadh Rajaraman 
Date: Thu, 15 May 2025 18:05:59 +0800
Subject: [PATCH 3/3] Use only `OPT__SLASH_Fo`

---
 clang/lib/Driver/Driver.cpp | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index ffdf8cc028f97..7b6db8c34ddd1 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6219,15 +6219,14 @@ const char *Driver::GetNamedOutputPath(Compilation &C, 
const JobAction &JA,
 IsCLMode() && !C.getArgs().hasArg(options::OPT__SLASH_Yc) &&
 (isa(JA) || isa(JA));
 bool HasAnyOutputArg = C.getArgs().hasArg(
-options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON);
+options::OPT_o, options::OPT__SLASH_Fo);
 
 Arg *FinalOutput = nullptr;
 if (IsCLNonPCH && HasAnyOutputArg) {
   FinalOutput = C.getArgs().getLastArg(
-  options::OPT_o, options::OPT__SLASH_Fo, 
options::OPT__SLASH_Fo_COLON);
+  options::OPT_o, options::OPT__SLASH_Fo);
 } else if (IsCLNonPCH) {
-  FinalOutput = C.getArgs().getLastArg(options::OPT__SLASH_Fo,
-   options::OPT__SLASH_Fo_COLON);
+  FinalOutput = C.getArgs().getLastArg(options::OPT__SLASH_Fo);
 } else {
   FinalOutput = C.getArgs().getLastArg(options::OPT_o);
 }

___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-12 Thread Brad King via cfe-commits


@@ -14,3 +14,11 @@
 
 //--- test.pcm
 // CPP20WARNING-NOT: clang-cl: warning: argument unused during compilation: 
'/std:c++20' [-Wunused-command-line-argument]
+
+// test whether the following outputs %Hello.bmi
+// RUN: %clang_cl /std:c++20 --precompile -x c++-module 
-fmodule-output=%t/Hello.bmi -Fo"%t/Hello.bmi" -c %t/Hello.cppm -### 2>&1 | 
FileCheck %s

bradking wrote:

Please don't worry too much about what CMake's command-line invocations [linked 
above](https://github.com/llvm/llvm-project/pull/121046#discussion_r2038627647) 
are doing.  CMake doesn't yet support modules with `clang-cl`, and is waiting 
on the work here.  The command lines I posted over there are showing what 
*unmerged* changes to CMake are doing in its test suite as part of analyzing 
why not everything is working.  This PR should focus on the functionality in 
`clang-cl` and its test should focus on the documented and intended usage.  
Once this is merged then CMake can be taught to do the right thing.


https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-11 Thread Chuanqi Xu via cfe-commits


@@ -14,3 +14,11 @@
 
 //--- test.pcm
 // CPP20WARNING-NOT: clang-cl: warning: argument unused during compilation: 
'/std:c++20' [-Wunused-command-line-argument]
+
+// test whether the following outputs %Hello.bmi
+// RUN: %clang_cl /std:c++20 --precompile -x c++-module 
-fmodule-output=%t/Hello.bmi -Fo"%t/Hello.bmi" -c %t/Hello.cppm -### 2>&1 | 
FileCheck %s

ChuanqiXu9 wrote:

Sorry for ignoring this. `--precompile` will be meaningless if it is followed 
by a `-c`. So the command line in cmake's thread actually use `-fmodule-output`.

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-05-11 Thread via cfe-commits


@@ -6097,10 +6097,29 @@ const char *Driver::GetNamedOutputPath(Compilation &C, 
const JobAction &JA,
   }
 
   llvm::PrettyStackTraceString CrashInfo("Computing output path");
+
   // Output to a user requested destination?
   if (AtTopLevel && !isa(JA) && !isa(JA)) {
-if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o))
+bool IsCLNonPCH =
+IsCLMode() && !C.getArgs().hasArg(options::OPT__SLASH_Yc) &&
+(isa(JA) || isa(JA));
+bool HasAnyOutputArg = C.getArgs().hasArg(
+options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON);

cor3ntin wrote:

@sharadhr ping

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-04-16 Thread Sharadh Rajaraman via cfe-commits

https://github.com/sharadhr edited 
https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-04-16 Thread Sharadh Rajaraman via cfe-commits


@@ -6097,10 +6097,29 @@ const char *Driver::GetNamedOutputPath(Compilation &C, 
const JobAction &JA,
   }
 
   llvm::PrettyStackTraceString CrashInfo("Computing output path");
+
   // Output to a user requested destination?
   if (AtTopLevel && !isa(JA) && !isa(JA)) {
-if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o))
+bool IsCLNonPCH =
+IsCLMode() && !C.getArgs().hasArg(options::OPT__SLASH_Yc) &&
+(isa(JA) || isa(JA));
+bool HasAnyOutputArg = C.getArgs().hasArg(
+options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON);
+
+Arg *FinalOutput = nullptr;
+if (IsCLNonPCH && HasAnyOutputArg) {
+  FinalOutput = C.getArgs().getLastArg(
+  options::OPT_o, options::OPT__SLASH_Fo, 
options::OPT__SLASH_Fo_COLON);
+} else if (IsCLNonPCH) {
+  FinalOutput = C.getArgs().getLastArg(options::OPT__SLASH_Fo,
+   options::OPT__SLASH_Fo_COLON);
+} else {
+  FinalOutput = C.getArgs().getLastArg(options::OPT_o);
+}

sharadhr wrote:

Given [the comment 
below](https://github.com/llvm/llvm-project/pull/121046#discussion_r1971184880),
 I believe it is incorrect to pass both `-fmodule-output` and the combination 
of `--precompile` and `-o` (or `-Fo`). I think there is hence scope to simplify 
this logic.

https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-04-16 Thread Sharadh Rajaraman via cfe-commits

https://github.com/sharadhr edited 
https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--precompile` (PR #121046)

2025-04-16 Thread Sharadh Rajaraman via cfe-commits

https://github.com/sharadhr edited 
https://github.com/llvm/llvm-project/pull/121046
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits