blob: c9e857332d7d892917f5b772f4271b3c77efd40d [file] [log] [blame]
Hans Wennborg96d54842013-08-02 22:24:50 +00001// 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.
Hans Wennborg19076102013-07-31 20:51:53 +00003
Hans Wennborg96d54842013-08-02 22:24:50 +00004
5// Alias options:
6
Hans Wennborg8f008372014-06-11 19:44:53 +00007// 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"
Hans Wennborg96d54842013-08-02 22:24:50 +000016
Hans Wennborg94d6a712016-01-12 23:31:58 +000017// RUN: %clang_cl /Dfoo=bar /D bar=baz /DMYDEF#value /DMYDEF2=foo#bar /DMYDEF3#a=b /DMYDEF4# \
Hans Wennborg21d73d22016-01-12 23:17:03 +000018// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=D %s
Hans Wennborg96d54842013-08-02 22:24:50 +000019// D: "-D" "foo=bar"
Hans Wennborg21d73d22016-01-12 23:17:03 +000020// D: "-D" "bar=baz"
21// D: "-D" "MYDEF=value"
22// D: "-D" "MYDEF2=foo#bar"
23// D: "-D" "MYDEF3=a=b"
Hans Wennborg94d6a712016-01-12 23:31:58 +000024// D: "-D" "MYDEF4="
Hans Wennborg96d54842013-08-02 22:24:50 +000025
Hans Wennborge0053472013-12-20 18:40:46 +000026// RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
27// E: "-E"
28// E: "-o" "-"
29
Hans Wennborge50cec32014-06-13 20:59:54 +000030// RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s
31// EP: "-E"
32// EP: "-P"
33// EP: "-o" "-"
34
Hans Wennborg7a2e5c22015-04-08 22:55:09 +000035// 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
David Majnemere95f3bd2015-05-20 04:39:56 +000053// RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
54// GA: -ftls-model=local-exec
55
Hans Wennborg96d54842013-08-02 22:24:50 +000056// 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
David Majnemerda39ab22014-03-23 17:47:22 +000062// RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
63// Gy: -ffunction-sections
64
65// RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s
66// Gy_-NOT: -ffunction-sections
67
Hans Wennborg77dc2362015-01-20 19:45:50 +000068// RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s
69// Gs: "-mstack-probe-size=0"
70// RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s
71// Gs0: "-mstack-probe-size=0"
72// RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s
73// Gs4096: "-mstack-probe-size=4096"
74
David Majnemerdc7a47c2014-04-07 16:14:38 +000075// RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s
76// Gw: -fdata-sections
77
78// RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s
79// Gw_-NOT: -fdata-sections
80
Reid Kleckneraf1acd92013-09-26 17:41:14 +000081// RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
82// RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
83// SLASH_I: "-I" "myincludedir"
Hans Wennborg96d54842013-08-02 22:24:50 +000084
85// RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
86// J: -fno-signed-char
87
88// RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
David Majnemer015ce0f2015-07-27 07:32:11 +000089// O: /Ofoo
Hans Wennborg96d54842013-08-02 22:24:50 +000090
91// RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
92// Ob0: -fno-inline
93
94// RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
95// Od: -O0
96
Hans Wennborg56eb4b62013-08-08 23:44:01 +000097// RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
98// Oi-NOT: -fno-builtin
99
100// RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
101// Oi_: -fno-builtin
102
Saleem Abdulrasool5860fe12015-10-03 07:15:28 +0000103// RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
104// RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
David Majnemer015ce0f2015-07-27 07:32:11 +0000105// Os-NOT: -mdisable-fp-elim
106// Os: -momit-leaf-frame-pointer
Hans Wennborg96d54842013-08-02 22:24:50 +0000107// Os: -Os
108
Saleem Abdulrasool5860fe12015-10-03 07:15:28 +0000109// RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
110// RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
David Majnemer015ce0f2015-07-27 07:32:11 +0000111// Ot-NOT: -mdisable-fp-elim
112// Ot: -momit-leaf-frame-pointer
Hans Wennborg96d54842013-08-02 22:24:50 +0000113// Ot: -O2
114
Saleem Abdulrasool5860fe12015-10-03 07:15:28 +0000115// RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
116// RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
David Majnemer015ce0f2015-07-27 07:32:11 +0000117// Ox-NOT: -mdisable-fp-elim
118// Ox: -momit-leaf-frame-pointer
119// Ox: -O2
120
David Majnemer7ab76f22015-08-25 00:46:45 +0000121// RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s
David Majnemer015ce0f2015-07-27 07:32:11 +0000122// PR24003: -mdisable-fp-elim
123// PR24003: -momit-leaf-frame-pointer
124// PR24003: -Os
Hans Wennborg96d54842013-08-02 22:24:50 +0000125
Nico Weber9c3fca32016-03-23 15:37:41 +0000126// RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s
David Majnemer259d71a2016-01-21 23:01:11 +0000127// Oy_2: -momit-leaf-frame-pointer
128// Oy_2: -O2
129
Nico Weber9c3fca32016-03-23 15:37:41 +0000130// RUN: %clang_cl /Zs -Werror /Oy -- %s 2>&1
Hans Wennborg96d54842013-08-02 22:24:50 +0000131
Nico Weber9c3fca32016-03-23 15:37:41 +0000132// RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
Hans Wennborg96d54842013-08-02 22:24:50 +0000133// Oy_: -mdisable-fp-elim
134
David Majnemer87b853c2015-05-14 05:19:17 +0000135// RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s
136// Qvec: -vectorize-loops
137
138// RUN: %clang_cl /Qvec /Qvec- -### -- %s 2>&1 | FileCheck -check-prefix=Qvec_ %s
139// Qvec_-NOT: -vectorize-loops
140
Hans Wennborg0fd62072013-08-09 00:32:23 +0000141// RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
142// showIncludes: --show-includes
143
Hans Wennborg8858a032014-07-21 23:42:07 +0000144// RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
145// RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
146// showIncludes_E: warning: argument unused during compilation: '--show-includes'
147
Hans Wennborg96d54842013-08-02 22:24:50 +0000148// RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
149// RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
150// U: "-U" "mymacro"
151
David Majnemerca116412014-03-23 17:47:18 +0000152// RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
153// VD2: -vtordisp-mode=2
154
David Majnemer86c318f2014-02-11 21:05:00 +0000155// RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s
156// VMG: "-fms-memptr-rep=virtual"
157
158// RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s
159// VMS: "-fms-memptr-rep=single"
160
161// RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s
162// VMM: "-fms-memptr-rep=multiple"
163
164// RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s
165// VMV: "-fms-memptr-rep=virtual"
166
167// RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s
168// VMB: '/vmg' not allowed with '/vmb'
169
170// RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s
171// VMX: '/vms' not allowed with '/vmm'
172
David Majnemera5b195a2015-02-14 01:35:12 +0000173// RUN: %clang_cl /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s
174// VOLATILE-ISO-NOT: "-fms-volatile"
175
176// RUN: %clang_cl /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s
177// VOLATILE-MS: "-fms-volatile"
178
Hans Wennborg96d54842013-08-02 22:24:50 +0000179// RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
180// W0: -w
181
182// RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
183// RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
184// RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
Nico Weberc8036742015-12-11 22:31:16 +0000185// RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
Hans Wennborg4ae76c22015-12-14 18:46:11 +0000186// RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
Hans Wennborg96d54842013-08-02 22:24:50 +0000187// W1: -Wall
Nico Weberc8036742015-12-11 22:31:16 +0000188// W4: -WCL4
Hans Wennborg96d54842013-08-02 22:24:50 +0000189
190// RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
191// WX: -Werror
192
193// RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
194// WX_: -Wno-error
195
196// RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
197// w: -w
198
David Majnemer104fb542014-07-25 17:30:10 +0000199// RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s
200// ZP: -fpack-struct=1
201
202// RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s
203// ZP2: -fpack-struct=2
204
Hans Wennborg96d54842013-08-02 22:24:50 +0000205// RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
206// Zs: -fsyntax-only
207
Reid Kleckneraf1acd92013-09-26 17:41:14 +0000208// RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s
209// FI: "-include" "asdf.h"
210
Rafael Espindola8c871122013-10-29 19:42:01 +0000211// RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
212// FI_: "-include" "asdf.h"
213
David Majnemercd5855e2016-02-29 01:40:36 +0000214// RUN: %clang_cl /TP /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s
David Majnemera7bdc5a2016-02-22 17:44:51 +0000215// NO-GX-NOT: "-fcxx-exceptions" "-fexceptions"
216
David Majnemercd5855e2016-02-29 01:40:36 +0000217// RUN: %clang_cl /TP /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s
David Majnemerb8809092016-02-20 09:23:44 +0000218// GX: "-fcxx-exceptions" "-fexceptions"
219
David Majnemercd5855e2016-02-29 01:40:36 +0000220// RUN: %clang_cl /TP /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s
David Majnemerb8809092016-02-20 09:23:44 +0000221// GX_-NOT: "-fcxx-exceptions" "-fexceptions"
222
Reid Klecknerf3ad7202013-09-03 23:18:43 +0000223// We forward any unrecognized -W diagnostic options to cc1.
224// RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
225// WJoined: "-cc1"
226// WJoined: "-Wunused-pragmas"
Hans Wennborg96d54842013-08-02 22:24:50 +0000227
Reid Kleckner2a24e3a2014-04-09 20:07:39 +0000228// We recognize -f[no-]strict-aliasing.
229// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s
230// DEFAULTSTRICT: "-relaxed-aliasing"
231// RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s
232// STRICT-NOT: "-relaxed-aliasing"
233// RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s
234// NOSTRICT: "-relaxed-aliasing"
235
Reid Kleckner9307fba2014-04-04 01:36:55 +0000236// For some warning ids, we can map from MSVC warning to Clang warning.
Nico Weber0d10b2c2015-12-15 17:07:16 +0000237// RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s
Reid Kleckner469b6bc2015-02-17 23:28:19 +0000238// Wno: "-cc1"
239// Wno: "-Wno-macro-redefined"
Nico Weber0d10b2c2015-12-15 17:07:16 +0000240// Wno: "-Wno-unused-parameter"
Hans Wennborg89e39a72015-06-11 18:14:11 +0000241// Wno: "-Wno-dllexport-explicit-instantiation-decl"
Nico Weber0d10b2c2015-12-15 17:07:16 +0000242// Wno: "-Wno-deprecated-declarations"
Hans Wennborga8ef14f2013-09-17 00:03:41 +0000243
Hans Wennborg96d54842013-08-02 22:24:50 +0000244// Ignored options. Check that we don't get "unused during compilation" errors.
Hans Wennborge2155942015-03-02 22:09:05 +0000245// RUN: %clang_cl /c \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000246// RUN: /analyze- \
Nico Weber4cc796a2015-09-18 20:49:33 +0000247// RUN: /bigobj \
Hans Wennborga41faed2014-12-13 22:24:16 +0000248// RUN: /cgthreads4 \
249// RUN: /cgthreads8 \
Nico Weber4884dcf2016-03-29 19:41:02 +0000250// RUN: /d2FastFail \
Hans Wennborg05d50a92014-11-14 18:24:08 +0000251// RUN: /d2Zi+ \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000252// RUN: /errorReport:foo \
Nico Weber32b70e02016-03-21 17:19:31 +0000253// RUN: /FC \
Reid Klecknerc00927c2015-02-25 19:17:50 +0000254// RUN: /Fdfoo \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000255// RUN: /FS \
Hans Wennborg951f1cc2014-12-13 22:13:23 +0000256// RUN: /Gd \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000257// RUN: /GF \
258// RUN: /GS- \
259// RUN: /kernel- \
260// RUN: /nologo \
261// RUN: /Ob1 \
262// RUN: /Ob2 \
Hans Wennborge2155942015-03-02 22:09:05 +0000263// RUN: /openmp- \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000264// RUN: /RTC1 \
265// RUN: /sdl \
266// RUN: /sdl- \
267// RUN: /vmg \
Hans Wennborg1fda2162014-12-13 22:44:46 +0000268// RUN: /volatile:iso \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000269// RUN: /w12345 \
270// RUN: /wd1234 \
Hans Wennborg05d50a92014-11-14 18:24:08 +0000271// RUN: /Zo \
272// RUN: /Zo- \
Hans Wennborg5e91ef62014-03-28 20:45:05 +0000273// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
274// IGNORED-NOT: argument unused during compilation
Hans Wennborg05d50a92014-11-14 18:24:08 +0000275// IGNORED-NOT: no such file or directory
Hans Wennborge2155942015-03-02 22:09:05 +0000276// Don't confuse /openmp- with the /o flag:
277// IGNORED-NOT: "-o" "penmp-.obj"
Hans Wennborg96d54842013-08-02 22:24:50 +0000278
Hans Wennborga8ef14f2013-09-17 00:03:41 +0000279// Ignored options and compile-only options are ignored for link jobs.
Hans Wennborg1f849802013-09-17 00:50:43 +0000280// RUN: touch %t.obj
Hans Wennborga8ef14f2013-09-17 00:03:41 +0000281// RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
282// RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
283// RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
284// LINKUNUSED-NOT: argument unused during compilation
285
Chandler Carruth576a3692013-09-05 10:09:03 +0000286// Support ignoring warnings about unused arguments.
287// RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
Hans Wennborg5e91ef62014-03-28 20:45:05 +0000288// UNUSED-NOT: argument unused during compilation
Chandler Carruth576a3692013-09-05 10:09:03 +0000289
Hans Wennborg96d54842013-08-02 22:24:50 +0000290// Unsupported but parsed options. Check that we don't error on them.
291// (/Zs is for syntax-only)
Hans Wennborg444c37d2013-11-15 18:29:58 +0000292// RUN: %clang_cl /Zs \
293// RUN: /AIfoo \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000294// RUN: /clr:pure \
295// RUN: /docname \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000296// RUN: /EHsc \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000297// RUN: /F \
298// RUN: /FA \
299// RUN: /FAc \
300// RUN: /Fafilename \
301// RUN: /FAs \
302// RUN: /FAu \
303// RUN: /favor:blend \
304// RUN: /FC \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000305// RUN: /Fifoo \
306// RUN: /Fmfoo \
307// RUN: /FpDebug\main.pch \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000308// RUN: /Frfoo \
309// RUN: /FRfoo \
310// RUN: /FU foo \
311// RUN: /Fx \
312// RUN: /G1 \
313// RUN: /G2 \
314// RUN: /GA \
315// RUN: /Gd \
316// RUN: /Ge \
317// RUN: /Gh \
318// RUN: /GH \
319// RUN: /GL \
320// RUN: /GL- \
321// RUN: /Gm \
322// RUN: /Gm- \
323// RUN: /Gr \
324// RUN: /GS \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000325// RUN: /GT \
Hans Wennborgd6e069f2015-11-04 16:11:56 +0000326// RUN: /guard:cf \
327// RUN: /guard:cf- \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000328// RUN: /GX \
Hans Wennborg92391ce2014-12-13 22:06:23 +0000329// RUN: /Gv \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000330// RUN: /Gz \
331// RUN: /GZ \
332// RUN: /H \
333// RUN: /homeparams \
334// RUN: /hotpatch \
335// RUN: /kernel \
336// RUN: /LN \
337// RUN: /MP \
338// RUN: /o foo.obj \
339// RUN: /ofoo.obj \
340// RUN: /openmp \
341// RUN: /Qfast_transcendentals \
342// RUN: /QIfist \
343// RUN: /Qimprecise_fwaits \
344// RUN: /Qpar \
345// RUN: /Qvec-report:2 \
346// RUN: /u \
347// RUN: /V \
Hans Wennborg1fda2162014-12-13 22:44:46 +0000348// RUN: /volatile:ms \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000349// RUN: /wfoo \
350// RUN: /WL \
351// RUN: /Wp64 \
352// RUN: /X \
353// RUN: /Y- \
354// RUN: /Yc \
355// RUN: /Ycstdafx.h \
356// RUN: /Yd \
357// RUN: /Yl- \
358// RUN: /Ylfoo \
359// RUN: /Yustdafx.h \
360// RUN: /Z7 \
361// RUN: /Za \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000362// RUN: /Ze \
363// RUN: /Zg \
364// RUN: /Zi \
365// RUN: /ZI \
366// RUN: /Zl \
Hans Wennborg444c37d2013-11-15 18:29:58 +0000367// RUN: /ZW:nostdlib \
368// RUN: -- %s 2>&1
Hans Wennborgc0fbccc2013-08-19 18:32:59 +0000369
370// We support -Xclang for forwarding options to cc1.
371// RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
372// Xclang: "-cc1"
373// Xclang: "hellocc1"
Hans Wennborga8ef14f2013-09-17 00:03:41 +0000374
David Majnemerf6072342014-07-01 22:24:56 +0000375// RTTI is on by default. /GR- controls -fno-rtti-data.
376// RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s
377// NoRTTI: "-fno-rtti-data"
378// NoRTTI-NOT: "-fno-rtti"
Hans Wennborg7b0dcef2014-02-25 18:36:22 +0000379// RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s
David Majnemerf6072342014-07-01 22:24:56 +0000380// RTTI-NOT: "-fno-rtti-data"
Hans Wennborg7b0dcef2014-02-25 18:36:22 +0000381// RTTI-NOT: "-fno-rtti"
382
David Majnemerc371ff02015-03-22 08:39:22 +0000383// thread safe statics are off for versions < 19.
384// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
385// RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
386// NoThreadSafeStatics: "-fno-threadsafe-statics"
387
388// RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s
389// ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
390
Reid Kleckner124955a2015-08-05 18:51:13 +0000391// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
Reid Kleckner124955a2015-08-05 18:51:13 +0000392// Zi: "-gcodeview"
Reid Kleckner9ce06a4a2016-02-10 21:28:38 +0000393// Zi: "-debug-info-kind=limited"
Reid Kleckner124955a2015-08-05 18:51:13 +0000394
395// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s
Reid Kleckner124955a2015-08-05 18:51:13 +0000396// Z7: "-gcodeview"
Reid Kleckner9ce06a4a2016-02-10 21:28:38 +0000397// Z7: "-debug-info-kind=limited"
Reid Kleckner124955a2015-08-05 18:51:13 +0000398
Reid Kleckner72a9d152016-03-18 18:42:56 +0000399// RUN: %clang_cl -gline-tables-only /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s
400// Z7GMLT: "-gcodeview"
401// Z7GMLT: "-debug-info-kind=line-tables-only"
402
David Majnemer2b9349d2015-12-21 22:09:34 +0000403// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s
404// BreproDefault: "-mincremental-linker-compatible"
405
406// RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s
407// Brepro: "-mincremental-linker-compatible"
408
409// RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s
410// Brepro_-NOT: "-mincremental-linker-compatible"
411
Douglas Katzman3459ce22015-10-08 04:24:12 +0000412// This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs
413// later on the command line, so it should win. Interestingly the cc1 arguments
414// came out right, but had wrong semantics, because an invariant assumed by
415// CompilerInvocation was violated: it expects that at most one of {gdwarfN,
416// line-tables-only} appear. If you assume that, then you can safely use
417// Args.hasArg to test whether a boolean flag is present without caring
418// where it appeared. And for this test, it appeared to the left of -gdwarf
419// which made it "win". This test could not detect that bug.
Reid Kleckner124955a2015-08-05 18:51:13 +0000420// RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
Reid Kleckner124955a2015-08-05 18:51:13 +0000421// Z7_gdwarf: "-gcodeview"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000422// Z7_gdwarf: "-debug-info-kind=limited"
423// Z7_gdwarf: "-dwarf-version=4"
Reid Kleckner124955a2015-08-05 18:51:13 +0000424
David Majnemer8db91762015-05-18 04:49:30 +0000425// RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
426// CXX11: -std=c++11
427
428// RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s
429// CXX14: -std=c++14
430
David Majnemer3a4f9582015-08-10 18:16:32 +0000431// RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s
432// ENV-CL: "-ffunction-sections"
433
434// RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s
435// ENV-_CL_-NOT: "-ffunction-sections"
436
Hans Wennborg8a7c47f2014-07-16 16:03:56 +0000437// Accept "core" clang options.
Hans Wennborgc296b042015-04-11 11:44:44 +0000438// (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
Hans Wennborgdb829de2014-07-16 16:29:00 +0000439// RUN: %clang_cl \
440// RUN: --driver-mode=cl \
Hans Wennborgbec52352015-04-11 12:27:56 +0000441// RUN: -fcolor-diagnostics \
442// RUN: -fno-color-diagnostics \
Hans Wennborg7aeeb922015-04-12 07:12:19 +0000443// RUN: -fdiagnostics-color \
444// RUN: -fno-diagnostics-color \
Hans Wennborg0260ee12015-04-21 23:12:03 +0000445// RUN: -fdiagnostics-parseable-fixits \
Hans Wennborgdb829de2014-07-16 16:29:00 +0000446// RUN: -ferror-limit=10 \
Hans Wennborg8a7c47f2014-07-16 16:03:56 +0000447// RUN: -fmsc-version=1800 \
Hans Wennborgdb829de2014-07-16 16:29:00 +0000448// RUN: -fno-strict-aliasing \
449// RUN: -fstrict-aliasing \
Hans Wennborg5615f6b2015-04-15 10:02:21 +0000450// RUN: -fsyntax-only \
Hans Wennborg1f53eb62015-10-08 23:13:28 +0000451// RUN: -fms-compatibility \
452// RUN: -fno-ms-compatibility \
453// RUN: -fms-extensions \
454// RUN: -fno-ms-extensions \
Nico Weber8714c122016-02-16 19:05:50 +0000455// RUN: -isystem=some/path \
Hans Wennborgdb829de2014-07-16 16:29:00 +0000456// RUN: -mllvm -disable-llvm-optzns \
Hans Wennborgc296b042015-04-11 11:44:44 +0000457// RUN: -Wunused-variable \
458// RUN: -fmacro-backtrace-limit=0 \
459// RUN: -Werror /Zs -- %s 2>&1
Hans Wennborg8a7c47f2014-07-16 16:03:56 +0000460
Hans Wennborg65a008682013-10-10 22:36:20 +0000461
Hans Wennborga8ef14f2013-09-17 00:03:41 +0000462void f() { }