[clang] [clang][driver][clang-cl] Support `--precompile` and `-fmodule-*` options in Clang-CL (PR #98761)
Sharadh Rajaraman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 12:56:44 PDT 2024
================
@@ -0,0 +1,65 @@
+// REQUIRES: system-windows
+
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cl /std:c++20 --precompile "%/t/Hello.cppm" "/Fo%/t/Hello.pcm"
----------------
sharadhr wrote:
So, I've tried to write the test like you've suggested exactly, but I end up with these errors:
```
Testing:
FAIL: Clang :: Driver/cl-cxx20-modules.cppm (1 of 19831)
******************** TEST 'Clang :: Driver/cl-cxx20-modules.cppm' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
r:\llvm-project\build\x64-release\bin\clang.exe --driver-mode=cl /std:c++20 --precompile -### -- R:\llvm-project\clang\test\Driver\cl-cxx20-modules.cppm 2>&1 | r:\llvm-project\build\x64-release\bin\filecheck.exe R:\llvm-project\clang\test\Driver\cl-cxx20-modules.cppm
# executed command: 'r:\llvm-project\build\x64-release\bin\clang.exe' --driver-mode=cl /std:c++20 --precompile '-###' -- 'R:\llvm-project\clang\test\Driver\cl-cxx20-modules.cppm'
# executed command: 'r:\llvm-project\build\x64-release\bin\filecheck.exe' 'R:\llvm-project\clang\test\Driver\cl-cxx20-modules.cppm'
# .---command stderr------------
# | // CHECK: --precompile
# | ^
# | <stdin>:1:1: note: scanning from here
# | clang version 19.0.0git (https://github.com/sharadhr/llvm-project.git e6386de2ef7dcb4650073c81e2da99bbd3446c99)
# | ^
# | <stdin>:6:744: note: possible intended match here
# | "D:\\Libraries\\Documents\\_Documents\\Repositories\\llvm-project\\build\\x64-release\\bin\\clang.exe" "-cc1" "-triple" "x86_64-pc-windows-msvc19.40.33812" "-emit-module-interface" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "cl-cxx20-modules.cppm" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-relaxed-aliasing" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-fms-volatile" "-funwind-tables=2" "-target-cpu" "x86-64" "-mllvm" "-x86-asm-syntax=intel" "-tune-cpu" "generic" "-D_MT" "-flto-visibility-public-std" "--dependent-lib=libcmt" "--dependent-lib=oldnames" "-stack-protector" "2" "-fdiagnostics-format" "msvc" "-fdebug-compilation-dir=R:\\llvm-project\\build\\x64-release\\tools\\clang\\test\\Driver" "-fcoverage-compilation-dir=R:\\llvm-project\\build\\x64-release\\tools\\clang\\test\\Driver" "-resource-dir" "D:\\Libraries\\Documents\\_Documents\\Repositories\\llvm-project\\build\\x64-release\\lib\\clang\\19" "-internal-isystem" "D:\\Libraries\\Documents\\_Documents\\Repositories\\llvm-project\\build\\x64-release\\lib\\clang\\19\\include" "-internal-isystem" "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.40.33807\\include" "-internal-isystem" "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.40.33807\\ATLMFC\\include" "-internal-isystem" "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\VS\\include" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.22621.0\\ucrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\um" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\shared" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\winrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\cppwinrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um" "-fdeprecated-macro" "-ferror-limit" "19" "-fno-use-cxa-atexit" "-fms-extensions" "-fms-compatibility" "-fms-compatibility-version=19.40.33812" "-std=c++20" "-fno-implicit-modules" "-fskip-odr-check-in-gmf" "-faddrsig" "-o" "cl-cxx20-modules.pcm" "-x" "c++" "R:\\llvm-project\\clang\\test\\Driver\\cl-cxx20-modules.cppm"
# | ^
# |
# | Input file: <stdin>
# | Check file: R:\llvm-project\clang\test\Driver\cl-cxx20-modules.cppm
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | 1: clang version 19.0.0git (https://github.com/sharadhr/llvm-project.git e6386de2ef7dcb4650073c81e2da99bbd3446c99)
# | 2: Target: x86_64-pc-windows-msvc
# | check:2'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 3: Thread model: posix
# | check:2'0 ~~~~~~~~~~~~~~~~~~~~
# | 4: InstalledDir: D:\Libraries\Documents\_Documents\Repositories\llvm-project\build\x64-release\bin
# | check:2'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 5: (in-process)
# | check:2'0 ~~~~~~~~~~~~~~
# | 6: "D:\\Libraries\\Documents\\_Documents\\Repositories\\llvm-project\\build\\x64-release\\bin\\clang.exe" "-cc1" "-triple" "x86_64-pc-windows-msvc19.40.33812" "-emit-module-interface" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "cl-cxx20-modules.cppm" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-relaxed-aliasing" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-fms-volatile" "-funwind-tables=2" "-target-cpu" "x86-64" "-mllvm" "-x86-asm-syntax=intel" "-tune-cpu" "generic" "-D_MT" "-flto-visibility-public-std" "--dependent-lib=libcmt" "--dependent-lib=oldnames" "-stack-protector" "2" "-fdiagnostics-format" "msvc" "-fdebug-compilation-dir=R:\\llvm-project\\build\\x64-release\\tools\\clang\\test\\Driver" "-fcoverage-compilation-dir=R:\\llvm-project\\build\\x64-release\\tools\\clang\\test\\Driver" "-resource-dir" "D:\\Libraries\\Documents\\_Documents\\Repositories\\llvm-project\\build\\x64-release\\lib\\clang\\19" "-internal-isystem" "D:\\Libraries\\Documents\\_Documents\\Repositories\\llvm-project\\build\\x64-release\\lib\\clang\\19\\include" "-internal-isystem" "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.40.33807\\include" "-internal-isystem" "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.40.33807\\ATLMFC\\include" "-internal-isystem" "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\VS\\include" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.22621.0\\ucrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\um" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\shared" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\winrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\cppwinrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um" "-fdeprecated-macro" "-ferror-limit" "19" "-fno-use-cxa-atexit" "-fms-extensions" "-fms-compatibility" "-fms-compatibility-version=19.40.33812" "-std=c++20" "-fno-implicit-modules" "-fskip-odr-check-in-gmf" "-faddrsig" "-o" "cl-cxx20-modules.pcm" "-x" "c++" "R:\\llvm-project\\clang\\test\\Driver\\cl-cxx20-modules.cppm"
# | check:2'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:2'1 ? possible intended match
# | >>>>>>
# `-----------------------------
R:\llvm-project\build\x64-release\EXEC : # error : command failed with exit status: 1
```
I'm not quite sure what to do here; any advice is welcome.
https://github.com/llvm/llvm-project/pull/98761
More information about the cfe-commits
mailing list