xref: /llvm-project/clang/test/Driver/cl-options.c (revision 8f17c908e3858c0a2a9b1bed3f6506fec3c6f910)
1 // Note: %s must be preceded by --, otherwise it may be interpreted as a
2 // command-line option, e.g. on Mac where %s is commonly under /Users.
3 
4 
5 // Alias options:
6 
7 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=c %s
8 // c: -c
9 
10 // RUN: not %clang_cl /C -### -- %s 2>&1 | FileCheck -check-prefix=C %s
11 // C: error: invalid argument '/C' only allowed with '/E, /P or /EP'
12 
13 // RUN: %clang_cl /C /P -### -- %s 2>&1 | FileCheck -check-prefix=C_P %s
14 // C_P: "-E"
15 // C_P: "-C"
16 
17 // RUN: %clang_cl /d1reportAllClassLayout -### /c /WX -- %s 2>&1 | \
18 // RUN:     FileCheck -check-prefix=d1reportAllClassLayout %s
19 // d1reportAllClassLayout-NOT: warning:
20 // d1reportAllClassLayout-NOT: error:
21 // d1reportAllClassLayout: -fdump-record-layouts
22 
23 // RUN: %clang_cl /Dfoo=bar /D bar=baz /DMYDEF#value /DMYDEF2=foo#bar /DMYDEF3#a=b /DMYDEF4# \
24 // RUN:    -### -- %s 2>&1 | FileCheck -check-prefix=D %s
25 // D: "-D" "foo=bar"
26 // D: "-D" "bar=baz"
27 // D: "-D" "MYDEF=value"
28 // D: "-D" "MYDEF2=foo#bar"
29 // D: "-D" "MYDEF3=a=b"
30 // D: "-D" "MYDEF4="
31 
32 // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
33 // E: "-E"
34 // E: "-o" "-"
35 
36 // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s
37 // EP: "-E"
38 // EP: "-P"
39 // EP: "-o" "-"
40 
41 // RUN: %clang_cl /external:Ipath  -### -- %s 2>&1 | FileCheck -check-prefix=EXTERNAL_I %s
42 // RUN: %clang_cl /external:I path -### -- %s 2>&1 | FileCheck -check-prefix=EXTERNAL_I %s
43 // EXTERNAL_I: "-isystem" "path"
44 
45 // RUN: %clang_cl /fp:fast /fp:except -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept %s
46 // fpexcept-NOT: -funsafe-math-optimizations
47 // fpexcept: -ffp-exception-behavior=strict
48 
49 // RUN: %clang_cl /fp:fast /fp:except /fp:except- -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept_ %s
50 // fpexcept_: -funsafe-math-optimizations
51 // fpexcept_: -ffp-exception-behavior=ignore
52 
53 // RUN: %clang_cl /fp:precise /fp:fast -### -- %s 2>&1 | FileCheck -check-prefix=fpfast %s
54 // fpfast: -funsafe-math-optimizations
55 // fpfast: -ffast-math
56 
57 // RUN: %clang_cl /fp:fast /fp:precise -### -- %s 2>&1 | FileCheck -check-prefix=fpprecise %s
58 // fpprecise-NOT: -funsafe-math-optimizations
59 // fpprecise-NOT: -ffast-math
60 
61 // RUN: %clang_cl /fp:fast /fp:strict -### -- %s 2>&1 | FileCheck -check-prefix=fpstrict %s
62 // fpstrict-NOT: -funsafe-math-optimizations
63 // fpstrict-NOT: -ffast-math
64 // fpstrict: -ffp-contract=off
65 
66 // RUN: %clang_cl /fp:strict /fp:contract -### -- %s 2>&1 | FileCheck -check-prefix=fpcontract %s
67 // fpcontract: -ffp-contract=on
68 
69 // RUN: %clang_cl /fsanitize=address -### -- %s 2>&1 | FileCheck -check-prefix=fsanitize_address %s
70 // fsanitize_address: -fsanitize=address
71 
72 // RUN: %clang_cl -### /FA -fprofile-instr-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE %s
73 // RUN: %clang_cl -### /FA -fprofile-instr-generate -fno-rtlib-defaultlib -frtlib-defaultlib -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE %s
74 // RUN: %clang_cl -### /FA -fprofile-instr-generate=/tmp/somefile.profraw -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE-FILE %s
75 // RUN: %clang_cl -### /FAcsu -fprofile-instr-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE %s
76 // RUN: %clang_cl -### /FAcsu -fprofile-instr-generate=/tmp/somefile.profraw -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE-FILE %s
77 // CHECK-PROFILE-INSTR-GENERATE: "-fprofile-instrument=clang" "--dependent-lib=clang_rt.profile{{[^"]*}}.lib"
78 // CHECK-PROFILE-INSTR-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw"
79 
80 // RUN: %clang_cl -### /FA -fprofile-instr-generate -fno-rtlib-defaultlib -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE-NODEF %s
81 // CHECK-PROFILE-INSTR-GENERATE-NODEF-NOT: "--dependent-lib=clang_rt.profile{{[^"]*}}.lib"
82 
83 // RUN: %clang_cl -### /FA -fprofile-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
84 // RUN: %clang_cl -### /FAcsu -fprofile-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
85 // CHECK-PROFILE-GENERATE: "-fprofile-instrument=llvm" "--dependent-lib=clang_rt.profile{{[^"]*}}.lib"
86 
87 // RUN: not %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
88 // RUN: not %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use=file -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
89 // RUN: not %clang_cl -### /FAcsu -fprofile-instr-generate -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
90 // RUN: not %clang_cl -### /FAcsu -fprofile-instr-generate -fprofile-instr-use=file -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
91 // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
92 
93 // RUN: %clang_cl -### /FA -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
94 // RUN: %clang_cl -### /FA -fprofile-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
95 // RUN: %clang_cl -### /FA -fprofile-instr-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
96 // RUN: %clang_cl -### /FA -fprofile-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
97 // RUN: %clang_cl -### /FAcsu -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
98 // RUN: %clang_cl -### /FAcsu -fprofile-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
99 // RUN: %clang_cl -### /FAcsu -fprofile-instr-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
100 // RUN: %clang_cl -### /FAcsu -fprofile-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
101 // CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata"
102 // CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof"
103 
104 // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
105 // GA: -ftls-model=local-exec
106 
107 // RTTI is on by default; just check that we don't error.
108 // RUN: %clang_cl /Zs /GR -- %s 2>&1
109 
110 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
111 // GR_: -fno-rtti
112 
113 // Security Buffer Check is on by default.
114 // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=GS-default %s
115 // GS-default: "-stack-protector" "2"
116 
117 // RUN: %clang_cl /GS -### -- %s 2>&1 | FileCheck -check-prefix=GS %s
118 // GS: "-stack-protector" "2"
119 
120 // RUN: %clang_cl /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS_ %s
121 // GS_-NOT: -stack-protector
122 
123 // RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
124 // Gy: -ffunction-sections
125 
126 // RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s
127 // Gy_-NOT: -ffunction-sections
128 
129 // RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s
130 // Gs: "-mstack-probe-size=4096"
131 // RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s
132 // Gs0: "-mstack-probe-size=0"
133 // RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s
134 // Gs4096: "-mstack-probe-size=4096"
135 
136 // RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s
137 // Gw: -fdata-sections
138 
139 // RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s
140 // Gw_-NOT: -fdata-sections
141 
142 // RUN: %clang_cl /hotpatch -### -- %s 2>&1 | FileCheck -check-prefix=hotpatch %s
143 // hotpatch: -fms-hotpatch
144 
145 // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
146 // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
147 // SLASH_I: "-I" "myincludedir"
148 
149 // RUN: %clang_cl /imsvcmyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
150 // RUN: %clang_cl /imsvc myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
151 // Clang's resource header directory should be first:
152 // SLASH_imsvc: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
153 // SLASH_imsvc: "-internal-isystem" "[[RESOURCE_DIR]]{{[/\\]+}}include"
154 // SLASH_imsvc: "-internal-isystem" "myincludedir"
155 
156 // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
157 // J: -fno-signed-char
158 
159 // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
160 // O: /Ofoo
161 
162 // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
163 // Ob0: -fno-inline
164 
165 // RUN: %clang_cl /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
166 // RUN: %clang_cl /Ob3 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
167 // RUN: %clang_cl /Odb2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
168 // RUN: %clang_cl /Odb3 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
169 // RUN: %clang_cl /O2 /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
170 // Ob2-NOT: warning: argument unused during compilation: '/O2'
171 // Ob2: -finline-functions
172 
173 // RUN: %clang_cl /Ob1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
174 // RUN: %clang_cl /Odb1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
175 // Ob1: -finline-hint-functions
176 
177 // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
178 // Od: -O0
179 
180 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
181 // Oi-NOT: -fno-builtin
182 
183 // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
184 // Oi_: -fno-builtin
185 
186 // RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
187 // RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
188 // Os: -mframe-pointer=none
189 // Os: -Os
190 
191 // RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
192 // RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
193 // Ot: -mframe-pointer=none
194 // Ot: -O3
195 
196 // RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
197 // RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
198 // Ox: -mframe-pointer=none
199 // Ox: -O3
200 
201 // RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s
202 // PR24003: -mframe-pointer=all
203 // PR24003: -Os
204 
205 // RUN: %clang_cl --target=i686-pc-win32 -Werror -Wno-msvc-not-found /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s
206 // Oy_2: -mframe-pointer=all
207 // Oy_2: -O3
208 
209 // RUN: %clang_cl --target=aarch64-pc-windows-msvc -Werror -Wno-msvc-not-found /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_aarch64 %s
210 // Oy_aarch64: -mframe-pointer=non-leaf
211 // Oy_aarch64: -O3
212 
213 // RUN: %clang_cl --target=i686-pc-win32 -Werror -Wno-msvc-not-found /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s
214 // O2O2: "-O3"
215 
216 // RUN: %clang_cl /Zs -Werror /Oy -- %s 2>&1
217 
218 // RUN: %clang_cl --target=i686-pc-win32 -Werror -Wno-msvc-not-found /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
219 // Oy_: -mframe-pointer=all
220 
221 // RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s
222 // Qvec: -vectorize-loops
223 
224 // RUN: %clang_cl /Qvec /Qvec- -### -- %s 2>&1 | FileCheck -check-prefix=Qvec_ %s
225 // Qvec_-NOT: -vectorize-loops
226 
227 // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_ %s
228 // showIncludes_: --show-includes
229 // showIncludes_: -sys-header-deps
230 
231 // RUN: %clang_cl /showIncludes:user -### -- %s 2>&1 | FileCheck -check-prefix=showIncludesUser %s
232 // showIncludesUser: --show-includes
233 // showIncludesUser-NOT: -sys-header-deps
234 
235 // RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
236 // RUN: %clang_cl /E /showIncludes:user -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
237 // RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
238 // RUN: %clang_cl /E /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
239 // RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
240 // showIncludes_E-NOT: warning: argument unused during compilation: '--show-includes'
241 
242 // /source-charset: should warn on everything except UTF-8.
243 // RUN: not %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
244 // source-charset-utf-16: invalid value 'utf-16' in '/source-charset:utf-16'
245 
246 // /execution-charset: should warn on everything except UTF-8.
247 // RUN: not %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
248 // execution-charset-utf-16: invalid value 'utf-16' in '/execution-charset:utf-16'
249 //
250 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
251 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
252 // U: "-U" "mymacro"
253 
254 // RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset %s
255 // validate-charset: -Winvalid-source-encoding
256 
257 // RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset_ %s
258 // validate-charset_: -Wno-invalid-source-encoding
259 
260 // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
261 // VD2: -vtordisp-mode=2
262 
263 // RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s
264 // VMG: "-fms-memptr-rep=virtual"
265 
266 // RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s
267 // VMS: "-fms-memptr-rep=single"
268 
269 // RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s
270 // VMM: "-fms-memptr-rep=multiple"
271 
272 // RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s
273 // VMV: "-fms-memptr-rep=virtual"
274 
275 // RUN: not %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s
276 // VMB: '/vmg' not allowed with '/vmb'
277 
278 // RUN: not %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s
279 // VMX: '/vms' not allowed with '/vmm'
280 
281 // RUN: %clang_cl --target=i686-pc-win32 /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s
282 // RUN: %clang_cl --target=aarch64-pc-win32 -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s
283 // VOLATILE-ISO-NOT: "-fms-volatile"
284 
285 // RUN: %clang_cl --target=aarch64-pc-win32 /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s
286 // RUN: %clang_cl --target=i686-pc-win32 -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s
287 // VOLATILE-MS: "-fms-volatile"
288 
289 // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
290 // W0: -w
291 
292 // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
293 // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
294 // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
295 // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
296 // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=Weverything %s
297 // W1: -Wall
298 // W4: -WCL4
299 // Weverything: -Weverything
300 
301 // RUN: %clang_cl /WX -Wno-msvc-not-found -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
302 // WX: -Werror
303 
304 // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
305 // WX_: -Wno-error
306 
307 // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
308 // w: -w
309 
310 // RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s
311 // ZP: -fpack-struct=1
312 
313 // RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s
314 // ZP2: -fpack-struct=2
315 
316 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
317 // Zs: -fsyntax-only
318 
319 // RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s
320 // FI: "-include" "asdf.h"
321 
322 // RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
323 // FI_: "-include" "asdf.h"
324 
325 // RUN: %clang_cl /TP /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s
326 // NO-GX-NOT: "-fcxx-exceptions" "-fexceptions"
327 
328 // RUN: %clang_cl /TP /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s
329 // GX: "-fcxx-exceptions" "-fexceptions"
330 
331 // RUN: %clang_cl /TP /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s
332 // GX_-NOT: "-fcxx-exceptions" "-fexceptions"
333 
334 // RUN: %clang_cl /d1PP -### -- %s 2>&1 | FileCheck -check-prefix=d1PP %s
335 // d1PP: -dD
336 
337 // RUN: %clang_cl --target=i686-pc-windows-msvc /c /QIntel-jcc-erratum -### -- %s 2>&1 | FileCheck -check-prefix=jcceratum %s
338 // jcceratum: "-mllvm" "-x86-branches-within-32B-boundaries"
339 
340 
341 // We forward any unrecognized -W diagnostic options to cc1.
342 // RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
343 // WJoined: "-cc1"
344 // WJoined: "-Wunused-pragmas"
345 
346 // We recognize -f[no-]strict-aliasing.
347 // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s
348 // DEFAULTSTRICT: "-relaxed-aliasing"
349 // RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s
350 // STRICT-NOT: "-relaxed-aliasing"
351 // RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s
352 // NOSTRICT: "-relaxed-aliasing"
353 
354 // We recognize -f[no-]delete-null-pointer-checks.
355 // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTNULL %s
356 // DEFAULTNULL-NOT: "-fno-delete-null-pointer-checks"
357 // RUN: %clang_cl -c -fdelete-null-pointer-checks -### -- %s 2>&1 | FileCheck -check-prefix=NULL %s
358 // NULL-NOT: "-fno-delete-null-pointer-checks"
359 // RUN: %clang_cl -c -fno-delete-null-pointer-checks -### -- %s 2>&1 | FileCheck -check-prefix=NONULL %s
360 // NONULL: "-fno-delete-null-pointer-checks"
361 
362 // RUN: %clang_cl -c -### /std:c11 -- %s 2>&1 | FileCheck -check-prefix CHECK-C11 %s
363 // CHECK-C11: -std=c11
364 
365 // For some warning ids, we can map from MSVC warning to Clang warning.
366 // RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -wd12345678 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s
367 // Wno: "-cc1"
368 // Wno: "-Wno-macro-redefined"
369 // Wno: "-Wno-unused-parameter"
370 // Wno: "-Wno-dllexport-explicit-instantiation-decl"
371 // Wno: "-Wno-deprecated-declarations"
372 // Wno-NOT: "-wd
373 
374 // Ignored options. Check that we don't get "unused during compilation" errors.
375 // RUN: %clang_cl /c \
376 // RUN:    /analyze- \
377 // RUN:    /bigobj \
378 // RUN:    /cgthreads4 \
379 // RUN:    /cgthreads8 \
380 // RUN:    /d2FastFail \
381 // RUN:    /d2Zi+ \
382 // RUN:    /errorReport:foo \
383 // RUN:    /execution-charset:utf-8 \
384 // RUN:    /FC \
385 // RUN:    /Fdfoo \
386 // RUN:    /FS \
387 // RUN:    /Gd \
388 // RUN:    /GF \
389 // RUN:    /GS- \
390 // RUN:    /kernel- \
391 // RUN:    /nologo \
392 // RUN:    /Og \
393 // RUN:    /openmp- \
394 // RUN:    /permissive- \
395 // RUN:    /RTC1 \
396 // RUN:    /sdl \
397 // RUN:    /sdl- \
398 // RUN:    /source-charset:utf-8 \
399 // RUN:    /utf-8 \
400 // RUN:    /vmg \
401 // RUN:    /volatile:iso \
402 // RUN:    /w12345 \
403 // RUN:    /wd1234 \
404 // RUN:    /Wv \
405 // RUN:    /Wv:17 \
406 // RUN:    /Zm \
407 // RUN:    /Zo \
408 // RUN:    /Zo- \
409 // RUN:    -### -- %s 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=IGNORED %s
410 // IGNORED-NOT: argument unused during compilation
411 // IGNORED-NOT: [[MSG]]
412 // Don't confuse /openmp- with the /o flag:
413 // IGNORED-NOT: "-o" "penmp-.obj"
414 
415 // Ignored options and compile-only options are ignored for link jobs.
416 // RUN: touch %t.obj
417 // RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
418 // RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
419 // RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
420 // LINKUNUSED-NOT: argument unused during compilation
421 
422 // Support ignoring warnings about unused arguments.
423 // RUN: not %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
424 // UNUSED-NOT: argument unused during compilation
425 
426 // Unsupported but parsed options. Check that we don't error on them.
427 // (/Zs is for syntax-only)
428 // RUN: %clang_cl /Zs \
429 // RUN:     /await \
430 // RUN:     /await:strict \
431 // RUN:     /constexpr:depth1000 /constexpr:backtrace1000 /constexpr:steps1000 \
432 // RUN:     /AIfoo \
433 // RUN:     /AI foo_does_not_exist \
434 // RUN:     /Bt \
435 // RUN:     /Bt+ \
436 // RUN:     /clr:pure \
437 // RUN:     /d1import_no_registry \
438 // RUN:     /d1nodatetime \
439 // RUN:     /d2FH4 \
440 // RUN:     /docname \
441 // RUN:     /experimental:external \
442 // RUN:     /experimental:module \
443 // RUN:     /experimental:preprocessor \
444 // RUN:     /exportHeader /headerName:foo \
445 // RUN:     /external:anglebrackets \
446 // RUN:     /external:env:var \
447 // RUN:     /external:W0 \
448 // RUN:     /external:W1 \
449 // RUN:     /external:W2 \
450 // RUN:     /external:W3 \
451 // RUN:     /external:W4 \
452 // RUN:     /external:templates- \
453 // RUN:     /headerUnit foo.h=foo.ifc /headerUnit:quote foo.h=foo.ifc /headerUnit:angle foo.h=foo.ifc \
454 // RUN:     /EHsc \
455 // RUN:     /F 42 \
456 // RUN:     /FA \
457 // RUN:     /FAc \
458 // RUN:     /Fafilename \
459 // RUN:     /FAs \
460 // RUN:     /FAu \
461 // RUN:     /favor:blend \
462 // RUN:     /fno-sanitize-address-vcasan-lib \
463 // RUN:     /Fifoo \
464 // RUN:     /Fmfoo \
465 // RUN:     /FpDebug\main.pch \
466 // RUN:     /Frfoo \
467 // RUN:     /FRfoo \
468 // RUN:     /FU foo \
469 // RUN:     /Fx \
470 // RUN:     /G1 \
471 // RUN:     /G2 \
472 // RUN:     /GA \
473 // RUN:     /Gd \
474 // RUN:     /Ge \
475 // RUN:     /Gh \
476 // RUN:     /GH \
477 // RUN:     /GL \
478 // RUN:     /GL- \
479 // RUN:     /Gm \
480 // RUN:     /Gm- \
481 // RUN:     /Gr \
482 // RUN:     /GS \
483 // RUN:     /GT \
484 // RUN:     /GX \
485 // RUN:     /Gv \
486 // RUN:     /Gz \
487 // RUN:     /GZ \
488 // RUN:     /H \
489 // RUN:     /homeparams \
490 // RUN:     /kernel \
491 // RUN:     /LN \
492 // RUN:     /MP \
493 // RUN:     /o foo.obj \
494 // RUN:     /ofoo.obj \
495 // RUN:     /openmp \
496 // RUN:     /openmp:experimental \
497 // RUN:     /Qfast_transcendentals \
498 // RUN:     /QIfist \
499 // RUN:     /Qimprecise_fwaits \
500 // RUN:     /Qpar \
501 // RUN:     /Qpar-report:1 \
502 // RUN:     /Qsafe_fp_loads \
503 // RUN:     /Qspectre \
504 // RUN:     /Qspectre-load \
505 // RUN:     /Qspectre-load-cf \
506 // RUN:     /Qvec-report:2 \
507 // RUN:     /reference foo=foo.ifc /reference foo.ifc \
508 // RUN:     /sourceDependencies foo.json \
509 // RUN:     /sourceDependencies:directives foo.json \
510 // RUN:     /translateInclude \
511 // RUN:     /u \
512 // RUN:     /V \
513 // RUN:     /volatile:ms \
514 // RUN:     /wfoo \
515 // RUN:     /WL \
516 // RUN:     /Wp64 \
517 // RUN:     /X \
518 // RUN:     /Y- \
519 // RUN:     /Yc \
520 // RUN:     /Ycstdafx.h \
521 // RUN:     /Yd \
522 // RUN:     /Yl- \
523 // RUN:     /Ylfoo \
524 // RUN:     /Yustdafx.h \
525 // RUN:     /Z7 \
526 // RUN:     /Za \
527 // RUN:     /Ze \
528 // RUN:     /Zg \
529 // RUN:     /Zi \
530 // RUN:     /ZI \
531 // RUN:     /Zl \
532 // RUN:     /ZW:nostdlib \
533 // RUN:     -- %s 2>&1
534 
535 // We support -Xclang for forwarding options to cc1.
536 // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
537 // Xclang: "-cc1"
538 // Xclang: "hellocc1"
539 
540 // Files under /Users are often confused with the /U flag. (This could happen
541 // for other flags too, but this is the one people run into.)
542 // RUN: %clang_cl /c /Users/me/myfile.c -### 2>&1 | FileCheck -check-prefix=SlashU %s
543 // SlashU: warning: '/Users/me/myfile.c' treated as the '/U' option
544 // SlashU: note: use '--' to treat subsequent arguments as filenames
545 
546 // RTTI is on by default. /GR- controls -fno-rtti-data.
547 // RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s
548 // NoRTTI: "-fno-rtti-data"
549 // NoRTTI-NOT: "-fno-rtti"
550 // RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s
551 // RTTI-NOT: "-fno-rtti-data"
552 // RTTI-NOT: "-fno-rtti"
553 
554 // RUN: %clang_cl -target x86_64-windows /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
555 // Zi: "-gcodeview"
556 // Zi: "-debug-info-kind=constructor"
557 
558 // RUN: %clang_cl -target x86_64-windows /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s
559 // Z7: "-gcodeview"
560 // Z7: "-debug-info-kind=constructor"
561 
562 // RUN: %clang_cl -target x86_64-windows -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s
563 // ZGMLT: "-gcodeview"
564 // ZGMLT: "-debug-info-kind=line-tables-only"
565 
566 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s
567 // BreproDefault: "-mincremental-linker-compatible"
568 
569 // RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s
570 // Brepro-NOT: "-mincremental-linker-compatible"
571 
572 // RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s
573 // Brepro_: "-mincremental-linker-compatible"
574 
575 // If We specify both /Z7 and -gdwarf we should get dwarf, not codeview.
576 // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
577 // RUN: %clang_cl -gdwarf /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
578 // Z7_gdwarf-NOT: "-gcodeview"
579 // Z7_gdwarf: "-debug-info-kind=constructor"
580 // Z7_gdwarf: "-dwarf-version=
581 
582 // RUN: %clang_cl /ZH:MD5 /c -### -- %s 2>&1 | FileCheck -check-prefix=ZH_MD5 %s
583 // ZH_MD5: "-gsrc-hash=md5"
584 
585 // RUN: %clang_cl /ZH:SHA1 /c -### -- %s 2>&1 \
586 // RUN:     | FileCheck -check-prefix=ZH_SHA1 %s
587 // ZH_SHA1: "-gsrc-hash=sha1"
588 
589 // RUN: %clang_cl /ZH:SHA_256 /c -### -- %s 2>&1 \
590 // RUN:     | FileCheck -check-prefix=ZH_SHA256 %s
591 // ZH_SHA256: "-gsrc-hash=sha256"
592 
593 // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
594 // CXX11: -std=c++11
595 
596 // RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s
597 // CXX14: -std=c++14
598 
599 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++14 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX14 %s
600 // STDCXX14: -std=c++14
601 
602 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++17 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX17 %s
603 // STDCXX17: -std=c++17
604 
605 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++20 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX20 %s
606 // STDCXX20: -std=c++20
607 
608 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++23preview -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX23PREVIEW %s
609 // STDCXX23PREVIEW: -std=c++23
610 
611 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s
612 // STDCXXLATEST: -std=c++26
613 
614 // RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s
615 // ENV-CL: "-ffunction-sections"
616 
617 // RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s
618 // ENV-_CL_-NOT: "-ffunction-sections"
619 
620 // RUN: env CL="%s" _CL_="%s" not %clang --rsp-quoting=windows -c
621 
622 // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s
623 // LTO: -flto
624 
625 // RUN: %clang_cl -### /c -flto -fno-lto -- %s 2>&1 | FileCheck -check-prefix=LTO-NO %s
626 // LTO-NO-NOT: "-flto"
627 
628 // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck -check-prefix=LTO-THIN %s
629 // LTO-THIN: -flto=thin
630 
631 // RUN: not %clang_cl -### -Fe%t.exe -entry:main -flto -- %s 2>&1 | FileCheck -check-prefix=LTO-WITHOUT-LLD %s
632 // RUN: not %clang_cl -### -fuse-ld=link -Fe%t.exe -entry:main -flto -- %s 2>&1 | FileCheck -check-prefix=LTO-WITHOUT-LLD %s
633 // RUN: not %clang -### --target=x86_64-windows-msvc -fuse-ld=link -Fe%t.exe -entry:main -flto -- %s 2>&1 | FileCheck -check-prefix=LTO-WITHOUT-LLD %s
634 // LTO-WITHOUT-LLD: LTO requires -fuse-ld=lld
635 
636 // RUN: %clang_cl  -### -- %s 2>&1 | FileCheck -check-prefix=NOCFGUARD %s
637 // RUN: %clang_cl /guard:cf- -### -- %s 2>&1 | FileCheck -check-prefix=NOCFGUARD %s
638 // NOCFGUARD-NOT: -cfguard
639 
640 // RUN: %clang_cl /guard:cf -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s
641 // CFGUARD: -cfguard
642 // CFGUARD-NOT: -cfguard-no-checks
643 
644 // RUN: %clang_cl /guard:cf,nochecks -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDNOCHECKS %s
645 // CFGUARDNOCHECKS: -cfguard-no-checks
646 
647 // RUN: not %clang_cl /guard:nochecks -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDNOCHECKSINVALID %s
648 // CFGUARDNOCHECKSINVALID: invalid value 'nochecks' in '/guard:'
649 
650 // RUN: %clang_cl  -### -- %s 2>&1 | FileCheck -check-prefix=NOEHCONTGUARD %s
651 // RUN: %clang_cl /guard:ehcont- -### -- %s 2>&1 | FileCheck -check-prefix=NOEHCONTGUARD %s
652 // NOEHCONTGUARD-NOT: -ehcontguard
653 
654 // RUN: %clang_cl /guard:ehcont -### -- %s 2>&1 | FileCheck -check-prefix=EHCONTGUARD %s
655 // EHCONTGUARD: -ehcontguard
656 
657 // RUN: %clang_cl /guard:cf /guard:ehcont -Wall -Wno-msvc-not-found -### -- %s 2>&1 | \
658 // RUN:   FileCheck -check-prefix=BOTHGUARD %s --implicit-check-not=warning:
659 // BOTHGUARD: -cfguard
660 // BOTHGUARD-SAME: -ehcontguard
661 // BOTHGUARD: -guard:cf
662 // BOTHGUARD-SAME: -guard:ehcont
663 
664 // RUN: not %clang_cl /guard:foo -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDINVALID %s
665 // CFGUARDINVALID: invalid value 'foo' in '/guard:'
666 
667 // Accept "core" clang options.
668 // (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
669 // RUN: %clang_cl \
670 // RUN:     --driver-mode=cl \
671 // RUN:     -fblocks \
672 // RUN:     -fcrash-diagnostics-dir=/foo \
673 // RUN:     -fno-crash-diagnostics \
674 // RUN:     -fno-blocks \
675 // RUN:     -fbuiltin \
676 // RUN:     -fno-builtin \
677 // RUN:     -fno-builtin-strcpy \
678 // RUN:     -fcolor-diagnostics \
679 // RUN:     -fno-color-diagnostics \
680 // RUN:     -fcoverage-mapping \
681 // RUN:     -fno-coverage-mapping \
682 // RUN:     -fdiagnostics-color \
683 // RUN:     -fdiagnostics-color=auto \
684 // RUN:     -fno-diagnostics-color \
685 // RUN:     -fdebug-compilation-dir . \
686 // RUN:     -fdebug-compilation-dir=. \
687 // RUN:     -ffile-compilation-dir=. \
688 // RUN:     -fdiagnostics-parseable-fixits \
689 // RUN:     -fdiagnostics-absolute-paths \
690 // RUN:     -ferror-limit=10 \
691 // RUN:     -fident \
692 // RUN:     -fno-ident \
693 // RUN:     -fmsc-version=1800 \
694 // RUN:     -fno-strict-aliasing \
695 // RUN:     -fstrict-aliasing \
696 // RUN:     -fsyntax-only \
697 // RUN:     -fms-compatibility \
698 // RUN:     -fno-ms-compatibility \
699 // RUN:     -fms-extensions \
700 // RUN:     -fno-ms-extensions \
701 // RUN:     -Xclang -disable-llvm-passes \
702 // RUN:     -resource-dir asdf \
703 // RUN:     -resource-dir=asdf \
704 // RUN:     -Wunused-variable \
705 // RUN:     -fmacro-backtrace-limit=0 \
706 // RUN:     -fstandalone-debug \
707 // RUN:     -feliminate-unused-debug-types \
708 // RUN:     -fno-eliminate-unused-debug-types \
709 // RUN:     -flimit-debug-info \
710 // RUN:     -flto \
711 // RUN:     -fmerge-all-constants \
712 // RUN:     -no-canonical-prefixes \
713 // RUN:     -march=skylake \
714 // RUN:     -fbracket-depth=123 \
715 // RUN:     -fprofile-generate \
716 // RUN:     -fprofile-generate=dir \
717 // RUN:     -fprofile-sample-use=%S/Inputs/file.prof \
718 // RUN:     -fno-profile-generate \
719 // RUN:     -fno-profile-instr-generate \
720 // RUN:     -fno-profile-instr-use \
721 // RUN:     -fcs-profile-generate \
722 // RUN:     -fcs-profile-generate=dir \
723 // RUN:     -ftime-trace \
724 // RUN:     -fmodules \
725 // RUN:     -fno-modules \
726 // RUN:     -fimplicit-module-maps \
727 // RUN:     -fmodule-maps \
728 // RUN:     -fmodule-name=foo \
729 // RUN:     -fmodule-implementation-of \
730 // RUN:     -fsystem-module \
731 // RUN:     -fmodule-map-file=foo \
732 // RUN:     -fmodule-file=foo \
733 // RUN:     -fmodules-ignore-macro=foo \
734 // RUN:     -fmodules-strict-decluse \
735 // RUN:     -fmodules-decluse \
736 // RUN:     -fno-modules-decluse \
737 // RUN:     -fmodules-search-all \
738 // RUN:     -fno-modules-search-all \
739 // RUN:     -fimplicit-modules \
740 // RUN:     -fno-implicit-modules \
741 // RUN:     -ftrivial-auto-var-init=zero \
742 // RUN:     -fwrapv \
743 // RUN:     -fno-wrapv \
744 // RUN:     --version \
745 // RUN:     -Werror /Zs -- %s 2>&1
746 
747 // Accept clang options under the /clang: flag.
748 // The first test case ensures that the SLP vectorizer is on by default and that
749 // it's being turned off by the /clang:-fno-slp-vectorize flag.
750 
751 // RUN: %clang_cl -O2 -### -- %s 2>&1 | FileCheck -check-prefix=NOCLANG %s
752 // NOCLANG: "--dependent-lib=libcmt"
753 // NOCLANG-SAME: "-vectorize-slp"
754 // NOCLANG-NOT: "--dependent-lib=msvcrt"
755 
756 // RUN: %clang_cl -O2 -MD /clang:-fno-slp-vectorize /clang:-MD /clang:-MF /clang:my_dependency_file.dep /c /Fo%/t/cl-options.obj -### -- %s 2>&1 | FileCheck -DPREFIX=%/t -check-prefix=CLANG %s
757 // CLANG: "--dependent-lib=msvcrt"
758 // CLANG-SAME: "-dependency-file" "my_dependency_file.dep"
759 // CLANG-SAME: "-MT" "[[PREFIX]]/cl-options.obj"
760 // CLANG-NOT: "--dependent-lib=libcmt"
761 // CLANG-NOT: "-vectorize-slp"
762 
763 // Cover PR42501: clang-cl /clang: pass-through causes read-after-free with aliased options.
764 // RUN: %clang_cl /clang:-save-temps /clang:-Wl,test1,test2 -### -- %s 2>&1 | FileCheck -check-prefix=SAVETEMPS %s
765 // SAVETEMPS: "-save-temps=cwd"
766 // SAVETEMPS: "test1" "test2"
767 
768 // Validate that the default triple is used when run an empty tools dir is specified
769 // RUN: %clang_cl -vctoolsdir "" -### -- %s 2>&1 | FileCheck %s --check-prefix VCTOOLSDIR
770 // VCTOOLSDIR: "-triple" "{{[a-zA-Z0-9_-]*}}-pc-windows-msvc19.33.0"
771 
772 // Validate that built-in include paths are based on the supplied path
773 // RUN: %clang_cl --target=aarch64-pc-windows-msvc -vctoolsdir "/fake" -winsdkdir "/foo" -winsdkversion 10.0.12345.0 -### -- %s 2>&1 | FileCheck %s --check-prefix FAKEDIR
774 // FAKEDIR: "-internal-isystem" "/fake{{/|\\\\}}include"
775 // FAKEDIR: "-internal-isystem" "/fake{{/|\\\\}}atlmfc{{/|\\\\}}include"
776 // FAKEDIR: "-internal-isystem" "/foo{{/|\\\\}}Include{{/|\\\\}}10.0.12345.0{{/|\\\\}}ucrt"
777 // FAKEDIR: "-internal-isystem" "/foo{{/|\\\\}}Include{{/|\\\\}}10.0.12345.0{{/|\\\\}}shared"
778 // FAKEDIR: "-internal-isystem" "/foo{{/|\\\\}}Include{{/|\\\\}}10.0.12345.0{{/|\\\\}}um"
779 // FAKEDIR: "-internal-isystem" "/foo{{/|\\\\}}Include{{/|\\\\}}10.0.12345.0{{/|\\\\}}winrt"
780 // FAKEDIR: "-libpath:/fake{{/|\\\\}}lib{{/|\\\\}}
781 // FAKEDIR: "-libpath:/fake{{/|\\\\}}atlmfc{{/|\\\\}}lib{{/|\\\\}}
782 // FAKEDIR: "-libpath:/foo{{/|\\\\}}Lib{{/|\\\\}}10.0.12345.0{{/|\\\\}}ucrt
783 // FAKEDIR: "-libpath:/foo{{/|\\\\}}Lib{{/|\\\\}}10.0.12345.0{{/|\\\\}}um
784 
785 // Accept both the -target and --target= spellings.
786 // RUN: %clang_cl --target=i686-pc-windows-msvc19.14.0 -### -- %s 2>&1 | FileCheck -check-prefix=TARGET %s
787 // RUN: %clang_cl -target i686-pc-windows-msvc19.14.0  -### -- %s 2>&1 | FileCheck -check-prefix=TARGET %s
788 // TARGET: "-triple" "i686-pc-windows-msvc19.14.0"
789 
790 // RUN: %clang_cl /JMC /c -### -- %s 2>&1 | FileCheck %s --check-prefix JMCWARN
791 // JMCWARN: /JMC requires debug info. Use '/Zi', '/Z7' or debug options that enable debugger's stepping function; option ignored
792 
793 // RUN: %clang_cl /JMC /c -### -- %s 2>&1 | FileCheck %s --check-prefix NOJMC
794 // RUN: %clang_cl /JMC /Z7 /JMC- /c -### -- %s 2>&1 | FileCheck %s --check-prefix NOJMC
795 // NOJMC-NOT: -fjmc
796 
797 // RUN: %clang_cl /JMC /Z7 /c -### -- %s 2>&1 | FileCheck %s --check-prefix JMC
798 // JMC: -fjmc
799 
800 // RUN: %clang_cl /external:W0 /c -### -- %s 2>&1 | FileCheck -check-prefix=EXTERNAL_W0 %s
801 // RUN: %clang_cl /external:W1 /c -### -- %s 2>&1 | FileCheck -check-prefix=EXTERNAL_Wn %s
802 // RUN: %clang_cl /external:W2 /c -### -- %s 2>&1 | FileCheck -check-prefix=EXTERNAL_Wn %s
803 // RUN: %clang_cl /external:W3 /c -### -- %s 2>&1 | FileCheck -check-prefix=EXTERNAL_Wn %s
804 // RUN: %clang_cl /external:W4 /c -### -- %s 2>&1 | FileCheck -check-prefix=EXTERNAL_Wn %s
805 // EXTERNAL_W0: "-Wno-system-headers"
806 // EXTERNAL_Wn: "-Wsystem-headers"
807 
808 // RUN: %clang_cl -vctoolsdir "" /arm64EC /c -### -- %s 2>&1 | FileCheck --check-prefix=ARM64EC %s
809 // ARM64EC-NOT: /arm64EC has been overridden by specified target
810 // ARM64EC: "-triple" "arm64ec-pc-windows-msvc19.33.0"
811 // ARM64EC-SAME: "--dependent-lib=softintrin"
812 
813 // RUN: %clang_cl -vctoolsdir "" /arm64EC /c -target x86_64-pc-windows-msvc  -### -- %s 2>&1 | FileCheck --check-prefix=ARM64EC_OVERRIDE %s
814 // ARM64EC_OVERRIDE: warning: /arm64EC has been overridden by specified target: x86_64-pc-windows-msvc; option ignored
815 
816 void f(void) { }
817