Debian Codegraph @

clang/test/Driver/cl-options.c

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