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.
7 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=c %s
10 // RUN: %clang_cl /C -### -- %s 2>&1 | FileCheck -check-prefix=C %s
11 // C: error: invalid argument '-C' only allowed with '/E, /P or /EP'
13 // RUN: %clang_cl /C /P -### -- %s 2>&1 | FileCheck -check-prefix=C_P %s
17 // RUN: %clang_cl /d1reportAllClassLayout -### -- %s 2>&1 | FileCheck -check-prefix=d1reportAllClassLayout %s
18 // d1reportAllClassLayout: -fdump-record-layouts
20 // RUN: %clang_cl /Dfoo=bar /D bar=baz /DMYDEF#value /DMYDEF2=foo#bar /DMYDEF3#a=b /DMYDEF4# \
21 // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=D %s
24 // D: "-D" "MYDEF=value"
25 // D: "-D" "MYDEF2=foo#bar"
26 // D: "-D" "MYDEF3=a=b"
29 // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
33 // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s
38 // RUN: %clang_cl /fp:fast /fp:except -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept %s
39 // fpexcept-NOT: -menable-unsafe-fp-math
41 // RUN: %clang_cl /fp:fast /fp:except /fp:except- -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept_ %s
42 // fpexcept_: -menable-unsafe-fp-math
44 // RUN: %clang_cl /fp:precise /fp:fast -### -- %s 2>&1 | FileCheck -check-prefix=fpfast %s
45 // fpfast: -menable-unsafe-fp-math
46 // fpfast: -ffast-math
48 // RUN: %clang_cl /fp:fast /fp:precise -### -- %s 2>&1 | FileCheck -check-prefix=fpprecise %s
49 // fpprecise-NOT: -menable-unsafe-fp-math
50 // fpprecise-NOT: -ffast-math
52 // RUN: %clang_cl /fp:fast /fp:strict -### -- %s 2>&1 | FileCheck -check-prefix=fpstrict %s
53 // fpstrict-NOT: -menable-unsafe-fp-math
54 // fpstrict-NOT: -ffast-math
56 // RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck -check-prefix=gcolumn %s
57 // gcolumn: -dwarf-column-info
59 // RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck -check-prefix=gnocolumn %s
60 // gnocolumn-NOT: -dwarf-column-info
62 // RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
63 // gdefcolumn-NOT: -dwarf-column-info
65 // RUN: %clang_cl -### /FA -fprofile-instr-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
66 // RUN: %clang_cl -### /FA -fprofile-instr-generate=/tmp/somefile.profraw -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-FILE %s
67 // RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
68 // RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use=file -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
69 // CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang"
70 // CHECK-PROFILE-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw"
71 // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
73 // RUN: %clang_cl -### /FA -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
74 // RUN: %clang_cl -### /FA -fprofile-instr-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
75 // CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata"
76 // CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof"
78 // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
79 // GA: -ftls-model=local-exec
81 // RTTI is on by default; just check that we don't error.
82 // RUN: %clang_cl /Zs /GR -- %s 2>&1
84 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
87 // Security Buffer Check is on by default.
88 // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=GS-default %s
89 // GS-default: "-stack-protector" "2"
91 // RUN: %clang_cl /GS -### -- %s 2>&1 | FileCheck -check-prefix=GS %s
92 // GS: "-stack-protector" "2"
94 // RUN: %clang_cl /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS_ %s
95 // GS_-NOT: -stack-protector
97 // RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
98 // Gy: -ffunction-sections
100 // RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s
101 // Gy_-NOT: -ffunction-sections
103 // RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s
104 // Gs: "-mstack-probe-size=0"
105 // RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s
106 // Gs0: "-mstack-probe-size=0"
107 // RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s
108 // Gs4096: "-mstack-probe-size=4096"
110 // RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s
111 // Gw: -fdata-sections
113 // RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s
114 // Gw_-NOT: -fdata-sections
116 // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
117 // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
118 // SLASH_I: "-I" "myincludedir"
120 // RUN: %clang_cl /imsvcmyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
121 // RUN: %clang_cl /imsvc myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
122 // Clang's resource header directory should be first:
123 // SLASH_imsvc: "-internal-isystem" "{{[^"]*}}lib{{(64)?/|\\\\}}clang{{[^"]*}}include"
124 // SLASH_imsvc: "-internal-isystem" "myincludedir"
126 // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
127 // J: -fno-signed-char
129 // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
132 // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
135 // RUN: %clang_cl /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
136 // RUN: %clang_cl /Odb2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
137 // RUN: %clang_cl /O2 /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
138 // Ob2-NOT: warning: argument unused during compilation: '/O2'
139 // Ob2: -finline-functions
141 // RUN: %clang_cl /Ob1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
142 // RUN: %clang_cl /Odb1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
143 // Ob1: -finline-hint-functions
145 // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
148 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
149 // Oi-NOT: -fno-builtin
151 // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
154 // RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
155 // RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
156 // Os-NOT: -mdisable-fp-elim
157 // Os: -momit-leaf-frame-pointer
160 // RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
161 // RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
162 // Ot-NOT: -mdisable-fp-elim
163 // Ot: -momit-leaf-frame-pointer
166 // RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
167 // RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
168 // Ox-NOT: -mdisable-fp-elim
169 // Ox: -momit-leaf-frame-pointer
172 // RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s
173 // PR24003: -mdisable-fp-elim
174 // PR24003: -momit-leaf-frame-pointer
177 // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s
178 // Oy_2: -momit-leaf-frame-pointer
181 // RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s
184 // RUN: %clang_cl /Zs -Werror /Oy -- %s 2>&1
186 // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
187 // Oy_: -mdisable-fp-elim
189 // RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s
190 // Qvec: -vectorize-loops
192 // RUN: %clang_cl /Qvec /Qvec- -### -- %s 2>&1 | FileCheck -check-prefix=Qvec_ %s
193 // Qvec_-NOT: -vectorize-loops
195 // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
196 // showIncludes: --show-includes
198 // RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
199 // RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
200 // RUN: %clang_cl /E /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
201 // RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
202 // showIncludes_E-NOT: warning: argument unused during compilation: '--show-includes'
204 // /source-charset: should warn on everything except UTF-8.
205 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
206 // source-charset-utf-16: invalid value 'utf-16'
208 // /execution-charset: should warn on everything except UTF-8.
209 // RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
210 // execution-charset-utf-16: invalid value 'utf-16'
212 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
213 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
216 // RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset %s
217 // validate-charset: -Winvalid-source-encoding
219 // RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset_ %s
220 // validate-charset_: -Wno-invalid-source-encoding
222 // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
223 // VD2: -vtordisp-mode=2
225 // RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s
226 // VMG: "-fms-memptr-rep=virtual"
228 // RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s
229 // VMS: "-fms-memptr-rep=single"
231 // RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s
232 // VMM: "-fms-memptr-rep=multiple"
234 // RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s
235 // VMV: "-fms-memptr-rep=virtual"
237 // RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s
238 // VMB: '/vmg' not allowed with '/vmb'
240 // RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s
241 // VMX: '/vms' not allowed with '/vmm'
243 // RUN: %clang_cl /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s
244 // VOLATILE-ISO-NOT: "-fms-volatile"
246 // RUN: %clang_cl /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s
247 // VOLATILE-MS: "-fms-volatile"
249 // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
252 // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
253 // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
254 // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
255 // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
256 // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=Weverything %s
259 // Weverything: -Weverything
261 // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
264 // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
267 // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
270 // RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s
271 // ZP: -fpack-struct=1
273 // RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s
274 // ZP2: -fpack-struct=2
276 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
279 // RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s
280 // FI: "-include" "asdf.h"
282 // RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
283 // FI_: "-include" "asdf.h"
285 // RUN: %clang_cl /TP /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s
286 // NO-GX-NOT: "-fcxx-exceptions" "-fexceptions"
288 // RUN: %clang_cl /TP /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s
289 // GX: "-fcxx-exceptions" "-fexceptions"
291 // RUN: %clang_cl /TP /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s
292 // GX_-NOT: "-fcxx-exceptions" "-fexceptions"
294 // RUN: %clang_cl /d1PP -### -- %s 2>&1 | FileCheck -check-prefix=d1PP %s
297 // We forward any unrecognized -W diagnostic options to cc1.
298 // RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
300 // WJoined: "-Wunused-pragmas"
302 // We recognize -f[no-]strict-aliasing.
303 // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s
304 // DEFAULTSTRICT: "-relaxed-aliasing"
305 // RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s
306 // STRICT-NOT: "-relaxed-aliasing"
307 // RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s
308 // NOSTRICT: "-relaxed-aliasing"
310 // We recognize -f[no-]delayed-template-parsing.
311 // /Zc:twoPhase[-] has the opposite meaning.
312 // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s
313 // DELAYEDDEFAULT: "-fdelayed-template-parsing"
314 // RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
315 // RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
316 // DELAYEDON: "-fdelayed-template-parsing"
317 // RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
318 // RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
319 // DELAYEDOFF-NOT: "-fdelayed-template-parsing"
321 // For some warning ids, we can map from MSVC warning to Clang warning.
322 // RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s
324 // Wno: "-Wno-macro-redefined"
325 // Wno: "-Wno-unused-parameter"
326 // Wno: "-Wno-dllexport-explicit-instantiation-decl"
327 // Wno: "-Wno-deprecated-declarations"
329 // Ignored options. Check that we don't get "unused during compilation" errors.
330 // RUN: %clang_cl /c \
333 // RUN: /cgthreads4 \
334 // RUN: /cgthreads8 \
335 // RUN: /d2FastFail \
337 // RUN: /errorReport:foo \
338 // RUN: /execution-charset:utf-8 \
349 // RUN: /permissive- \
353 // RUN: /source-charset:utf-8 \
356 // RUN: /volatile:iso \
359 // RUN: /Zc:__cplusplus \
361 // RUN: /Zc:forScope \
363 // RUN: /Zc:rvalueCast \
364 // RUN: /Zc:ternary \
365 // RUN: /Zc:wchar_t \
369 // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
370 // IGNORED-NOT: argument unused during compilation
371 // IGNORED-NOT: no such file or directory
372 // Don't confuse /openmp- with the /o flag:
373 // IGNORED-NOT: "-o" "penmp-.obj"
375 // Ignored options and compile-only options are ignored for link jobs.
377 // RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
378 // RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
379 // RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
380 // LINKUNUSED-NOT: argument unused during compilation
382 // Support ignoring warnings about unused arguments.
383 // RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
384 // UNUSED-NOT: argument unused during compilation
386 // Unsupported but parsed options. Check that we don't error on them.
387 // (/Zs is for syntax-only)
388 // RUN: %clang_cl /Zs \
398 // RUN: /Fafilename \
401 // RUN: /favor:blend \
404 // RUN: /FpDebug\main.pch \
430 // RUN: /homeparams \
438 // RUN: /Qfast_transcendentals \
440 // RUN: /Qimprecise_fwaits \
442 // RUN: /Qvec-report:2 \
445 // RUN: /volatile:ms \
452 // RUN: /Ycstdafx.h \
456 // RUN: /Yustdafx.h \
464 // RUN: /ZW:nostdlib \
467 // We support -Xclang for forwarding options to cc1.
468 // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
470 // Xclang: "hellocc1"
472 // Files under /Users are often confused with the /U flag. (This could happen
473 // for other flags too, but this is the one people run into.)
474 // RUN: %clang_cl /c /Users/me/myfile.c -### 2>&1 | FileCheck -check-prefix=SlashU %s
475 // SlashU: warning: '/Users/me/myfile.c' treated as the '/U' option
476 // SlashU: note: Use '--' to treat subsequent arguments as filenames
478 // RTTI is on by default. /GR- controls -fno-rtti-data.
479 // RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s
480 // NoRTTI: "-fno-rtti-data"
481 // NoRTTI-NOT: "-fno-rtti"
482 // RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s
483 // RTTI-NOT: "-fno-rtti-data"
484 // RTTI-NOT: "-fno-rtti"
486 // thread safe statics are off for versions < 19.
487 // RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
488 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
489 // NoThreadSafeStatics: "-fno-threadsafe-statics"
491 // RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s
492 // ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
494 // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
496 // Zi: "-debug-info-kind=limited"
498 // RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s
500 // Z7: "-debug-info-kind=limited"
502 // RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s
503 // Z7GMLT: "-gcodeview"
504 // Z7GMLT: "-debug-info-kind=line-tables-only"
506 // RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s
507 // ZGMLT: "-gcodeview"
508 // ZGMLT: "-debug-info-kind=line-tables-only"
510 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s
511 // BreproDefault: "-mincremental-linker-compatible"
513 // RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s
514 // Brepro-NOT: "-mincremental-linker-compatible"
516 // RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s
517 // Brepro_: "-mincremental-linker-compatible"
519 // This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs
520 // later on the command line, so it should win. Interestingly the cc1 arguments
521 // came out right, but had wrong semantics, because an invariant assumed by
522 // CompilerInvocation was violated: it expects that at most one of {gdwarfN,
523 // line-tables-only} appear. If you assume that, then you can safely use
524 // Args.hasArg to test whether a boolean flag is present without caring
525 // where it appeared. And for this test, it appeared to the left of -gdwarf
526 // which made it "win". This test could not detect that bug.
527 // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
528 // Z7_gdwarf: "-gcodeview"
529 // Z7_gdwarf: "-debug-info-kind=limited"
530 // Z7_gdwarf: "-dwarf-version=4"
532 // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
535 // RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s
538 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++14 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX14 %s
539 // STDCXX14: -std=c++14
541 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++17 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX17 %s
542 // STDCXX17: -std=c++17
544 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s
545 // STDCXXLATEST: -std=c++2a
547 // RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s
548 // ENV-CL: "-ffunction-sections"
550 // RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s
551 // ENV-_CL_-NOT: "-ffunction-sections"
553 // RUN: env CL="%s" _CL_="%s" not %clang --rsp-quoting=windows -c
555 // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s
558 // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck -check-prefix=LTO-THIN %s
559 // LTO-THIN: -flto=thin
561 // RUN: %clang_cl -### -Fe%t.exe -entry:main -flto -- %s 2>&1 | FileCheck -check-prefix=LTO-WITHOUT-LLD %s
562 // LTO-WITHOUT-LLD: LTO requires -fuse-ld=lld
564 // Accept "core" clang options.
565 // (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
567 // RUN: --driver-mode=cl \
569 // RUN: -fno-blocks \
571 // RUN: -fno-builtin \
572 // RUN: -fno-builtin-strcpy \
573 // RUN: -fcolor-diagnostics \
574 // RUN: -fno-color-diagnostics \
575 // RUN: -fcoverage-mapping \
576 // RUN: -fno-coverage-mapping \
577 // RUN: -fdiagnostics-color \
578 // RUN: -fno-diagnostics-color \
579 // RUN: -fdiagnostics-parseable-fixits \
580 // RUN: -fdiagnostics-absolute-paths \
581 // RUN: -ferror-limit=10 \
582 // RUN: -fmsc-version=1800 \
583 // RUN: -fno-strict-aliasing \
584 // RUN: -fstrict-aliasing \
585 // RUN: -fsyntax-only \
586 // RUN: -fms-compatibility \
587 // RUN: -fno-ms-compatibility \
588 // RUN: -fms-extensions \
589 // RUN: -fno-ms-extensions \
590 // RUN: -Xclang -disable-llvm-passes \
591 // RUN: -resource-dir asdf \
592 // RUN: -resource-dir=asdf \
593 // RUN: -Wunused-variable \
594 // RUN: -fmacro-backtrace-limit=0 \
595 // RUN: -fstandalone-debug \
596 // RUN: -flimit-debug-info \
598 // RUN: -fmerge-all-constants \
599 // RUN: -no-canonical-prefixes \
601 // RUN: -Werror /Zs -- %s 2>&1