Home | History | Annotate | Download | only in Driver
      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: %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 /Dfoo=bar /D bar=baz /DMYDEF#value /DMYDEF2=foo#bar /DMYDEF3#a=b /DMYDEF4# \
     18 // RUN:    -### -- %s 2>&1 | FileCheck -check-prefix=D %s
     19 // D: "-D" "foo=bar"
     20 // D: "-D" "bar=baz"
     21 // D: "-D" "MYDEF=value"
     22 // D: "-D" "MYDEF2=foo#bar"
     23 // D: "-D" "MYDEF3=a=b"
     24 // D: "-D" "MYDEF4="
     25 
     26 // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
     27 // E: "-E"
     28 // E: "-o" "-"
     29 
     30 // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s
     31 // EP: "-E"
     32 // EP: "-P"
     33 // EP: "-o" "-"
     34 
     35 // RUN: %clang_cl /fp:fast /fp:except -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept %s
     36 // fpexcept-NOT: -menable-unsafe-fp-math
     37 
     38 // RUN: %clang_cl /fp:fast /fp:except /fp:except- -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept_ %s
     39 // fpexcept_: -menable-unsafe-fp-math
     40 
     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
     44 
     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
     48 
     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
     52 
     53 // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
     54 // GA: -ftls-model=local-exec
     55 
     56 // RTTI is on by default; just check that we don't error.
     57 // RUN: %clang_cl /Zs /GR -- %s 2>&1
     58 
     59 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
     60 // GR_: -fno-rtti
     61 
     62 // Security Buffer Check is on by default.
     63 // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=GS-default %s
     64 // GS-default: "-stack-protector" "2"
     65 
     66 // RUN: %clang_cl /GS -### -- %s 2>&1 | FileCheck -check-prefix=GS %s
     67 // GS: "-stack-protector" "2"
     68 
     69 // RUN: %clang_cl /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS_ %s
     70 // GS_-NOT: -stack-protector
     71 
     72 // RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
     73 // Gy: -ffunction-sections
     74 
     75 // RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s
     76 // Gy_-NOT: -ffunction-sections
     77 
     78 // RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s
     79 // Gs: "-mstack-probe-size=0"
     80 // RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s
     81 // Gs0: "-mstack-probe-size=0"
     82 // RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s
     83 // Gs4096: "-mstack-probe-size=4096"
     84 
     85 // RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s
     86 // Gw: -fdata-sections
     87 
     88 // RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s
     89 // Gw_-NOT: -fdata-sections
     90 
     91 // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
     92 // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
     93 // SLASH_I: "-I" "myincludedir"
     94 
     95 // RUN: %clang_cl /imsvcmyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
     96 // RUN: %clang_cl /imsvc myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
     97 // Clang's resource header directory should be first:
     98 // SLASH_imsvc: "-internal-isystem" "{{[^"]*}}lib{{(64)?/|\\\\}}clang{{[^"]*}}include"
     99 // SLASH_imsvc: "-internal-isystem" "myincludedir"
    100 
    101 // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
    102 // J: -fno-signed-char
    103 
    104 // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
    105 // O: /Ofoo
    106 
    107 // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
    108 // Ob0: -fno-inline
    109 
    110 // RUN: %clang_cl /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
    111 // RUN: %clang_cl /Odb2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
    112 // RUN: %clang_cl /O2 /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
    113 // Ob2-NOT: warning: argument unused during compilation: '/O2'
    114 // Ob2: -finline-functions
    115 
    116 // RUN: %clang_cl /Ob1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
    117 // RUN: %clang_cl /Odb1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
    118 // Ob1: -finline-hint-functions
    119 
    120 // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
    121 // Od: -O0
    122 
    123 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
    124 // Oi-NOT: -fno-builtin
    125 
    126 // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
    127 // Oi_: -fno-builtin
    128 
    129 // RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
    130 // RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
    131 // Os-NOT: -mdisable-fp-elim
    132 // Os: -momit-leaf-frame-pointer
    133 // Os: -Os
    134 
    135 // RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
    136 // RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
    137 // Ot-NOT: -mdisable-fp-elim
    138 // Ot: -momit-leaf-frame-pointer
    139 // Ot: -O2
    140 
    141 // RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
    142 // RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
    143 // Ox-NOT: -mdisable-fp-elim
    144 // Ox: -momit-leaf-frame-pointer
    145 // Ox: -O2
    146 
    147 // RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s
    148 // PR24003: -mdisable-fp-elim
    149 // PR24003: -momit-leaf-frame-pointer
    150 // PR24003: -Os
    151 
    152 // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s
    153 // Oy_2: -momit-leaf-frame-pointer
    154 // Oy_2: -O2
    155 
    156 // RUN: %clang_cl /Zs -Werror /Oy -- %s 2>&1
    157 
    158 // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
    159 // Oy_: -mdisable-fp-elim
    160 
    161 // RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s
    162 // Qvec: -vectorize-loops
    163 
    164 // RUN: %clang_cl /Qvec /Qvec- -### -- %s 2>&1 | FileCheck -check-prefix=Qvec_ %s
    165 // Qvec_-NOT: -vectorize-loops
    166 
    167 // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
    168 // showIncludes: --show-includes
    169 
    170 // RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
    171 // RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
    172 // showIncludes_E: warning: argument unused during compilation: '--show-includes'
    173 
    174 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
    175 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
    176 // U: "-U" "mymacro"
    177 
    178 // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
    179 // VD2: -vtordisp-mode=2
    180 
    181 // RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s
    182 // VMG: "-fms-memptr-rep=virtual"
    183 
    184 // RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s
    185 // VMS: "-fms-memptr-rep=single"
    186 
    187 // RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s
    188 // VMM: "-fms-memptr-rep=multiple"
    189 
    190 // RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s
    191 // VMV: "-fms-memptr-rep=virtual"
    192 
    193 // RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s
    194 // VMB: '/vmg' not allowed with '/vmb'
    195 
    196 // RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s
    197 // VMX: '/vms' not allowed with '/vmm'
    198 
    199 // RUN: %clang_cl /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s
    200 // VOLATILE-ISO-NOT: "-fms-volatile"
    201 
    202 // RUN: %clang_cl /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s
    203 // VOLATILE-MS: "-fms-volatile"
    204 
    205 // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
    206 // W0: -w
    207 
    208 // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
    209 // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
    210 // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
    211 // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
    212 // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
    213 // W1: -Wall
    214 // W4: -WCL4
    215 
    216 // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
    217 // WX: -Werror
    218 
    219 // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
    220 // WX_: -Wno-error
    221 
    222 // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
    223 // w: -w
    224 
    225 // RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s
    226 // ZP: -fpack-struct=1
    227 
    228 // RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s
    229 // ZP2: -fpack-struct=2
    230 
    231 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
    232 // Zs: -fsyntax-only
    233 
    234 // RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s
    235 // FI: "-include" "asdf.h"
    236 
    237 // RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
    238 // FI_: "-include" "asdf.h"
    239 
    240 // RUN: %clang_cl /TP /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s
    241 // NO-GX-NOT: "-fcxx-exceptions" "-fexceptions"
    242 
    243 // RUN: %clang_cl /TP /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s
    244 // GX: "-fcxx-exceptions" "-fexceptions"
    245 
    246 // RUN: %clang_cl /TP /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s
    247 // GX_-NOT: "-fcxx-exceptions" "-fexceptions"
    248 
    249 // We forward any unrecognized -W diagnostic options to cc1.
    250 // RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
    251 // WJoined: "-cc1"
    252 // WJoined: "-Wunused-pragmas"
    253 
    254 // We recognize -f[no-]strict-aliasing.
    255 // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s
    256 // DEFAULTSTRICT: "-relaxed-aliasing"
    257 // RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s
    258 // STRICT-NOT: "-relaxed-aliasing"
    259 // RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s
    260 // NOSTRICT: "-relaxed-aliasing"
    261 
    262 // For some warning ids, we can map from MSVC warning to Clang warning.
    263 // RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s
    264 // Wno: "-cc1"
    265 // Wno: "-Wno-macro-redefined"
    266 // Wno: "-Wno-unused-parameter"
    267 // Wno: "-Wno-dllexport-explicit-instantiation-decl"
    268 // Wno: "-Wno-deprecated-declarations"
    269 
    270 // Ignored options. Check that we don't get "unused during compilation" errors.
    271 // RUN: %clang_cl /c \
    272 // RUN:    /analyze- \
    273 // RUN:    /bigobj \
    274 // RUN:    /cgthreads4 \
    275 // RUN:    /cgthreads8 \
    276 // RUN:    /d2FastFail \
    277 // RUN:    /d2Zi+ \
    278 // RUN:    /errorReport:foo \
    279 // RUN:    /FC \
    280 // RUN:    /Fdfoo \
    281 // RUN:    /FS \
    282 // RUN:    /Gd \
    283 // RUN:    /GF \
    284 // RUN:    /GS- \
    285 // RUN:    /kernel- \
    286 // RUN:    /nologo \
    287 // RUN:    /openmp- \
    288 // RUN:    /RTC1 \
    289 // RUN:    /sdl \
    290 // RUN:    /sdl- \
    291 // RUN:    /vmg \
    292 // RUN:    /volatile:iso \
    293 // RUN:    /w12345 \
    294 // RUN:    /wd1234 \
    295 // RUN:    /Zo \
    296 // RUN:    /Zo- \
    297 // RUN:    -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
    298 // IGNORED-NOT: argument unused during compilation
    299 // IGNORED-NOT: no such file or directory
    300 // Don't confuse /openmp- with the /o flag:
    301 // IGNORED-NOT: "-o" "penmp-.obj"
    302 
    303 // Ignored options and compile-only options are ignored for link jobs.
    304 // RUN: touch %t.obj
    305 // RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
    306 // RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
    307 // RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
    308 // LINKUNUSED-NOT: argument unused during compilation
    309 
    310 // Support ignoring warnings about unused arguments.
    311 // RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
    312 // UNUSED-NOT: argument unused during compilation
    313 
    314 // Unsupported but parsed options. Check that we don't error on them.
    315 // (/Zs is for syntax-only)
    316 // RUN: %clang_cl /Zs \
    317 // RUN:     /AIfoo \
    318 // RUN:     /clr:pure \
    319 // RUN:     /docname \
    320 // RUN:     /EHsc \
    321 // RUN:     /F \
    322 // RUN:     /FA \
    323 // RUN:     /FAc \
    324 // RUN:     /Fafilename \
    325 // RUN:     /FAs \
    326 // RUN:     /FAu \
    327 // RUN:     /favor:blend \
    328 // RUN:     /FC \
    329 // RUN:     /Fifoo \
    330 // RUN:     /Fmfoo \
    331 // RUN:     /FpDebug\main.pch \
    332 // RUN:     /Frfoo \
    333 // RUN:     /FRfoo \
    334 // RUN:     /FU foo \
    335 // RUN:     /Fx \
    336 // RUN:     /G1 \
    337 // RUN:     /G2 \
    338 // RUN:     /GA \
    339 // RUN:     /Gd \
    340 // RUN:     /Ge \
    341 // RUN:     /Gh \
    342 // RUN:     /GH \
    343 // RUN:     /GL \
    344 // RUN:     /GL- \
    345 // RUN:     /Gm \
    346 // RUN:     /Gm- \
    347 // RUN:     /Gr \
    348 // RUN:     /GS \
    349 // RUN:     /GT \
    350 // RUN:     /guard:cf \
    351 // RUN:     /guard:cf- \
    352 // RUN:     /GX \
    353 // RUN:     /Gv \
    354 // RUN:     /Gz \
    355 // RUN:     /GZ \
    356 // RUN:     /H \
    357 // RUN:     /homeparams \
    358 // RUN:     /hotpatch \
    359 // RUN:     /kernel \
    360 // RUN:     /LN \
    361 // RUN:     /MP \
    362 // RUN:     /o foo.obj \
    363 // RUN:     /ofoo.obj \
    364 // RUN:     /openmp \
    365 // RUN:     /Qfast_transcendentals \
    366 // RUN:     /QIfist \
    367 // RUN:     /Qimprecise_fwaits \
    368 // RUN:     /Qpar \
    369 // RUN:     /Qvec-report:2 \
    370 // RUN:     /u \
    371 // RUN:     /V \
    372 // RUN:     /volatile:ms \
    373 // RUN:     /wfoo \
    374 // RUN:     /WL \
    375 // RUN:     /Wp64 \
    376 // RUN:     /X \
    377 // RUN:     /Y- \
    378 // RUN:     /Yc \
    379 // RUN:     /Ycstdafx.h \
    380 // RUN:     /Yd \
    381 // RUN:     /Yl- \
    382 // RUN:     /Ylfoo \
    383 // RUN:     /Yustdafx.h \
    384 // RUN:     /Z7 \
    385 // RUN:     /Za \
    386 // RUN:     /Ze \
    387 // RUN:     /Zg \
    388 // RUN:     /Zi \
    389 // RUN:     /ZI \
    390 // RUN:     /Zl \
    391 // RUN:     /ZW:nostdlib \
    392 // RUN:     -- %s 2>&1
    393 
    394 // We support -Xclang for forwarding options to cc1.
    395 // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
    396 // Xclang: "-cc1"
    397 // Xclang: "hellocc1"
    398 
    399 // RTTI is on by default. /GR- controls -fno-rtti-data.
    400 // RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s
    401 // NoRTTI: "-fno-rtti-data"
    402 // NoRTTI-NOT: "-fno-rtti"
    403 // RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s
    404 // RTTI-NOT: "-fno-rtti-data"
    405 // RTTI-NOT: "-fno-rtti"
    406 
    407 // thread safe statics are off for versions < 19.
    408 // RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
    409 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
    410 // NoThreadSafeStatics: "-fno-threadsafe-statics"
    411 
    412 // RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s
    413 // ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
    414 
    415 // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
    416 // Zi: "-gcodeview"
    417 // Zi: "-debug-info-kind=limited"
    418 
    419 // RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s
    420 // Z7: "-gcodeview"
    421 // Z7: "-debug-info-kind=limited"
    422 
    423 // RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s
    424 // Z7GMLT: "-gcodeview"
    425 // Z7GMLT: "-debug-info-kind=line-tables-only"
    426 
    427 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s
    428 // BreproDefault: "-mincremental-linker-compatible"
    429 
    430 // RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s
    431 // Brepro: "-mincremental-linker-compatible"
    432 
    433 // RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s
    434 // Brepro_-NOT: "-mincremental-linker-compatible"
    435 
    436 // This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs
    437 // later on the command line, so it should win. Interestingly the cc1 arguments
    438 // came out right, but had wrong semantics, because an invariant assumed by
    439 // CompilerInvocation was violated: it expects that at most one of {gdwarfN,
    440 // line-tables-only} appear. If you assume that, then you can safely use
    441 // Args.hasArg to test whether a boolean flag is present without caring
    442 // where it appeared. And for this test, it appeared to the left of -gdwarf
    443 // which made it "win". This test could not detect that bug.
    444 // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
    445 // Z7_gdwarf: "-gcodeview"
    446 // Z7_gdwarf: "-debug-info-kind=limited"
    447 // Z7_gdwarf: "-dwarf-version=4"
    448 
    449 // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
    450 // CXX11: -std=c++11
    451 
    452 // RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s
    453 // CXX14: -std=c++14
    454 
    455 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++14 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX14 %s
    456 // STDCXX14: -std=c++14
    457 
    458 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s
    459 // STDCXXLATEST: -std=c++1z
    460 
    461 // RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s
    462 // ENV-CL: "-ffunction-sections"
    463 
    464 // RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s
    465 // ENV-_CL_-NOT: "-ffunction-sections"
    466 
    467 // Accept "core" clang options.
    468 // (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
    469 // RUN: %clang_cl \
    470 // RUN:     --driver-mode=cl \
    471 // RUN:     -fcolor-diagnostics \
    472 // RUN:     -fno-color-diagnostics \
    473 // RUN:     -fdiagnostics-color \
    474 // RUN:     -fno-diagnostics-color \
    475 // RUN:     -fdiagnostics-parseable-fixits \
    476 // RUN:     -ferror-limit=10 \
    477 // RUN:     -fmsc-version=1800 \
    478 // RUN:     -fno-strict-aliasing \
    479 // RUN:     -fstrict-aliasing \
    480 // RUN:     -fsyntax-only \
    481 // RUN:     -fms-compatibility \
    482 // RUN:     -fno-ms-compatibility \
    483 // RUN:     -fms-extensions \
    484 // RUN:     -fno-ms-extensions \
    485 // RUN:     -mllvm -disable-llvm-optzns \
    486 // RUN:     -resource-dir \
    487 // RUN:     -Wunused-variable \
    488 // RUN:     -fmacro-backtrace-limit=0 \
    489 // RUN:     -Werror /Zs -- %s 2>&1
    490 
    491 
    492 void f() { }
    493