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 /Dfoo=bar /D bar=baz /DMYDEF#value /DMYDEF2=foo#bar /DMYDEF3#a=b /DMYDEF4# \
18 // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=D %s
21 // D: "-D" "MYDEF=value"
22 // D: "-D" "MYDEF2=foo#bar"
23 // D: "-D" "MYDEF3=a=b"
26 // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
30 // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s
35 // RUN: %clang_cl /fp:fast /fp:except -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept %s
36 // fpexcept-NOT: -menable-unsafe-fp-math
38 // RUN: %clang_cl /fp:fast /fp:except /fp:except- -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept_ %s
39 // fpexcept_: -menable-unsafe-fp-math
41 // RUN: %clang_cl /fp:precise /fp:fast -### -- %s 2>&1 | FileCheck -check-prefix=fpfast %s
42 // fpfast: -menable-unsafe-fp-math
43 // fpfast: -ffast-math
45 // RUN: %clang_cl /fp:fast /fp:precise -### -- %s 2>&1 | FileCheck -check-prefix=fpprecise %s
46 // fpprecise-NOT: -menable-unsafe-fp-math
47 // fpprecise-NOT: -ffast-math
49 // RUN: %clang_cl /fp:fast /fp:strict -### -- %s 2>&1 | FileCheck -check-prefix=fpstrict %s
50 // fpstrict-NOT: -menable-unsafe-fp-math
51 // fpstrict-NOT: -ffast-math
53 // RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck -check-prefix=gcolumn %s
54 // gcolumn: -dwarf-column-info
56 // RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck -check-prefix=gnocolumn %s
57 // gnocolumn-NOT: -dwarf-column-info
59 // RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
60 // gdefcolumn-NOT: -dwarf-column-info
62 // RUN: %clang_cl -### /FA -fprofile-instr-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
63 // RUN: %clang_cl -### /FA -fprofile-instr-generate=/tmp/somefile.profraw -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-FILE %s
64 // RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
65 // RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use=file -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
66 // CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang"
67 // CHECK-PROFILE-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw"
68 // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
70 // RUN: %clang_cl -### /FA -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
71 // RUN: %clang_cl -### /FA -fprofile-instr-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
72 // CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata"
73 // CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof"
75 // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
76 // GA: -ftls-model=local-exec
78 // RTTI is on by default; just check that we don't error.
79 // RUN: %clang_cl /Zs /GR -- %s 2>&1
81 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
84 // Security Buffer Check is on by default.
85 // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=GS-default %s
86 // GS-default: "-stack-protector" "2"
88 // RUN: %clang_cl /GS -### -- %s 2>&1 | FileCheck -check-prefix=GS %s
89 // GS: "-stack-protector" "2"
91 // RUN: %clang_cl /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS_ %s
92 // GS_-NOT: -stack-protector
94 // RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
95 // Gy: -ffunction-sections
97 // RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s
98 // Gy_-NOT: -ffunction-sections
100 // RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s
101 // Gs: "-mstack-probe-size=0"
102 // RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s
103 // Gs0: "-mstack-probe-size=0"
104 // RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s
105 // Gs4096: "-mstack-probe-size=4096"
107 // RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s
108 // Gw: -fdata-sections
110 // RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s
111 // Gw_-NOT: -fdata-sections
113 // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
114 // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
115 // SLASH_I: "-I" "myincludedir"
117 // RUN: %clang_cl /imsvcmyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
118 // RUN: %clang_cl /imsvc myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
119 // Clang's resource header directory should be first:
120 // SLASH_imsvc: "-internal-isystem" "{{[^"]*}}lib{{(64)?/|\\\\}}clang{{[^"]*}}include"
121 // SLASH_imsvc: "-internal-isystem" "myincludedir"
123 // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
124 // J: -fno-signed-char
126 // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
129 // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
132 // RUN: %clang_cl /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
133 // RUN: %clang_cl /Odb2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
134 // RUN: %clang_cl /O2 /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
135 // Ob2-NOT: warning: argument unused during compilation: '/O2'
136 // Ob2: -finline-functions
138 // RUN: %clang_cl /Ob1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
139 // RUN: %clang_cl /Odb1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
140 // Ob1: -finline-hint-functions
142 // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
145 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
146 // Oi-NOT: -fno-builtin
148 // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
151 // RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
152 // RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
153 // Os-NOT: -mdisable-fp-elim
154 // Os: -momit-leaf-frame-pointer
157 // RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
158 // RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
159 // Ot-NOT: -mdisable-fp-elim
160 // Ot: -momit-leaf-frame-pointer
163 // RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
164 // RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
165 // Ox-NOT: -mdisable-fp-elim
166 // Ox: -momit-leaf-frame-pointer
169 // RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s
170 // PR24003: -mdisable-fp-elim
171 // PR24003: -momit-leaf-frame-pointer
174 // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s
175 // Oy_2: -momit-leaf-frame-pointer
178 // RUN: %clang_cl /Zs -Werror /Oy -- %s 2>&1
180 // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
181 // Oy_: -mdisable-fp-elim
183 // RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s
184 // Qvec: -vectorize-loops
186 // RUN: %clang_cl /Qvec /Qvec- -### -- %s 2>&1 | FileCheck -check-prefix=Qvec_ %s
187 // Qvec_-NOT: -vectorize-loops
189 // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
190 // showIncludes: --show-includes
192 // RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
193 // RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
194 // showIncludes_E: warning: argument unused during compilation: '--show-includes'
196 // /source-charset: should warn on everything except UTF-8.
197 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
198 // source-charset-utf-16: invalid value 'utf-16'
200 // /execution-charset: should warn on everything except UTF-8.
201 // RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
202 // execution-charset-utf-16: invalid value 'utf-16'
204 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
205 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
208 // RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset %s
209 // validate-charset: -Winvalid-source-encoding
211 // RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset_ %s
212 // validate-charset_: -Wno-invalid-source-encoding
214 // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
215 // VD2: -vtordisp-mode=2
217 // RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s
218 // VMG: "-fms-memptr-rep=virtual"
220 // RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s
221 // VMS: "-fms-memptr-rep=single"
223 // RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s
224 // VMM: "-fms-memptr-rep=multiple"
226 // RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s
227 // VMV: "-fms-memptr-rep=virtual"
229 // RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s
230 // VMB: '/vmg' not allowed with '/vmb'
232 // RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s
233 // VMX: '/vms' not allowed with '/vmm'
235 // RUN: %clang_cl /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s
236 // VOLATILE-ISO-NOT: "-fms-volatile"
238 // RUN: %clang_cl /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s
239 // VOLATILE-MS: "-fms-volatile"
241 // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
244 // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
245 // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
246 // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
247 // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
248 // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
252 // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
255 // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
258 // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
261 // RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s
262 // ZP: -fpack-struct=1
264 // RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s
265 // ZP2: -fpack-struct=2
267 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
270 // RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s
271 // FI: "-include" "asdf.h"
273 // RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
274 // FI_: "-include" "asdf.h"
276 // RUN: %clang_cl /TP /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s
277 // NO-GX-NOT: "-fcxx-exceptions" "-fexceptions"
279 // RUN: %clang_cl /TP /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s
280 // GX: "-fcxx-exceptions" "-fexceptions"
282 // RUN: %clang_cl /TP /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s
283 // GX_-NOT: "-fcxx-exceptions" "-fexceptions"
285 // We forward any unrecognized -W diagnostic options to cc1.
286 // RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
288 // WJoined: "-Wunused-pragmas"
290 // We recognize -f[no-]strict-aliasing.
291 // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s
292 // DEFAULTSTRICT: "-relaxed-aliasing"
293 // RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s
294 // STRICT-NOT: "-relaxed-aliasing"
295 // RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s
296 // NOSTRICT: "-relaxed-aliasing"
298 // We recognize -f[no-]delayed-template-parsing.
299 // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s
300 // DELAYEDDEFAULT: "-fdelayed-template-parsing"
301 // RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
302 // DELAYEDON: "-fdelayed-template-parsing"
303 // RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
304 // DELAYEDOFF-NOT: "-fdelayed-template-parsing"
306 // For some warning ids, we can map from MSVC warning to Clang warning.
307 // RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s
309 // Wno: "-Wno-macro-redefined"
310 // Wno: "-Wno-unused-parameter"
311 // Wno: "-Wno-dllexport-explicit-instantiation-decl"
312 // Wno: "-Wno-deprecated-declarations"
314 // Ignored options. Check that we don't get "unused during compilation" errors.
315 // RUN: %clang_cl /c \
318 // RUN: /cgthreads4 \
319 // RUN: /cgthreads8 \
320 // RUN: /d2FastFail \
322 // RUN: /errorReport:foo \
323 // RUN: /execution-charset:utf-8 \
336 // RUN: /source-charset:utf-8 \
339 // RUN: /volatile:iso \
344 // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
345 // IGNORED-NOT: argument unused during compilation
346 // IGNORED-NOT: no such file or directory
347 // Don't confuse /openmp- with the /o flag:
348 // IGNORED-NOT: "-o" "penmp-.obj"
350 // Ignored options and compile-only options are ignored for link jobs.
352 // RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
353 // RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
354 // RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
355 // LINKUNUSED-NOT: argument unused during compilation
357 // Support ignoring warnings about unused arguments.
358 // RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
359 // UNUSED-NOT: argument unused during compilation
361 // Unsupported but parsed options. Check that we don't error on them.
362 // (/Zs is for syntax-only)
363 // RUN: %clang_cl /Zs \
371 // RUN: /Fafilename \
374 // RUN: /favor:blend \
377 // RUN: /FpDebug\main.pch \
403 // RUN: /homeparams \
411 // RUN: /Qfast_transcendentals \
413 // RUN: /Qimprecise_fwaits \
415 // RUN: /Qvec-report:2 \
418 // RUN: /volatile:ms \
425 // RUN: /Ycstdafx.h \
429 // RUN: /Yustdafx.h \
437 // RUN: /ZW:nostdlib \
440 // We support -Xclang for forwarding options to cc1.
441 // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
443 // Xclang: "hellocc1"
445 // Files under /Users are often confused with the /U flag. (This could happen
446 // for other flags too, but this is the one people run into.)
447 // RUN: %clang_cl /c /Users/me/myfile.c -### 2>&1 | FileCheck -check-prefix=SlashU %s
448 // SlashU: warning: '/Users/me/myfile.c' treated as the '/U' option
449 // SlashU: note: Use '--' to treat subsequent arguments as filenames
451 // RTTI is on by default. /GR- controls -fno-rtti-data.
452 // RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s
453 // NoRTTI: "-fno-rtti-data"
454 // NoRTTI-NOT: "-fno-rtti"
455 // RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s
456 // RTTI-NOT: "-fno-rtti-data"
457 // RTTI-NOT: "-fno-rtti"
459 // thread safe statics are off for versions < 19.
460 // RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
461 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
462 // NoThreadSafeStatics: "-fno-threadsafe-statics"
464 // RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s
465 // ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
467 // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
469 // Zi: "-debug-info-kind=limited"
471 // RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s
473 // Z7: "-debug-info-kind=limited"
475 // RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s
476 // Z7GMLT: "-gcodeview"
477 // Z7GMLT: "-debug-info-kind=line-tables-only"
479 // RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s
480 // ZGMLT: "-gcodeview"
481 // ZGMLT: "-debug-info-kind=line-tables-only"
483 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s
484 // BreproDefault: "-mincremental-linker-compatible"
486 // RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s
487 // Brepro-NOT: "-mincremental-linker-compatible"
489 // RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s
490 // Brepro_: "-mincremental-linker-compatible"
492 // This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs
493 // later on the command line, so it should win. Interestingly the cc1 arguments
494 // came out right, but had wrong semantics, because an invariant assumed by
495 // CompilerInvocation was violated: it expects that at most one of {gdwarfN,
496 // line-tables-only} appear. If you assume that, then you can safely use
497 // Args.hasArg to test whether a boolean flag is present without caring
498 // where it appeared. And for this test, it appeared to the left of -gdwarf
499 // which made it "win". This test could not detect that bug.
500 // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
501 // Z7_gdwarf: "-gcodeview"
502 // Z7_gdwarf: "-debug-info-kind=limited"
503 // Z7_gdwarf: "-dwarf-version=4"
505 // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
508 // RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s
511 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++14 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX14 %s
512 // STDCXX14: -std=c++14
514 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s
515 // STDCXXLATEST: -std=c++1z
517 // RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s
518 // ENV-CL: "-ffunction-sections"
520 // RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s
521 // ENV-_CL_-NOT: "-ffunction-sections"
523 // RUN: env CL="%s" _CL_="%s" not %clang --rsp-quoting=windows -c
525 // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s
528 // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck -check-prefix=LTO-THIN %s
529 // LTO-THIN: -flto=thin
531 // RUN: %clang_cl -### -Fe%t.exe -entry:main -flto -- %s 2>&1 | FileCheck -check-prefix=LTO-WITHOUT-LLD %s
532 // LTO-WITHOUT-LLD: LTO requires -fuse-ld=lld
534 // Accept "core" clang options.
535 // (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
537 // RUN: --driver-mode=cl \
538 // RUN: -fcolor-diagnostics \
539 // RUN: -fno-color-diagnostics \
540 // RUN: -fdiagnostics-color \
541 // RUN: -fno-diagnostics-color \
542 // RUN: -fdiagnostics-parseable-fixits \
543 // RUN: -fdiagnostics-absolute-paths \
544 // RUN: -ferror-limit=10 \
545 // RUN: -fmsc-version=1800 \
546 // RUN: -fno-strict-aliasing \
547 // RUN: -fstrict-aliasing \
548 // RUN: -fsyntax-only \
549 // RUN: -fms-compatibility \
550 // RUN: -fno-ms-compatibility \
551 // RUN: -fms-extensions \
552 // RUN: -fno-ms-extensions \
553 // RUN: -Xclang -disable-llvm-passes \
554 // RUN: -resource-dir asdf \
555 // RUN: -resource-dir=asdf \
556 // RUN: -Wunused-variable \
557 // RUN: -fmacro-backtrace-limit=0 \
558 // RUN: -fstandalone-debug \
559 // RUN: -flimit-debug-info \
561 // RUN: -Werror /Zs -- %s 2>&1