1 // UNSUPPORTED: target={{.*}}-aix{{.*}}
2 // RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fsplit-stack %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
3 // RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-asm -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-enums -fprotect-parens %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
5 // CHECK-OPTIONS1: -fsplit-stack
6 // CHECK-OPTIONS1: -fgnu-keywords
7 // CHECK-OPTIONS1: -fblocks
8 // CHECK-OPTIONS1: -fpascal-strings
10 // CHECK-OPTIONS2: -fprotect-parens
11 // CHECK-OPTIONS2: -fmath-errno
12 // CHECK-OPTIONS2: -fno-gnu-keywords
13 // CHECK-OPTIONS2: -fno-builtin
14 // CHECK-OPTIONS2: -fshort-enums
15 // CHECK-OPTIONS2-NOT: -fcommon
16 // CHECK-OPTIONS2: -fno-show-source-location
18 // RUN: %clang -### -S -Wwrite-strings %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS1 %s
19 // WRITE-STRINGS1: -fconst-strings
20 // RUN: %clang -### -S -Wwrite-strings -Wno-write-strings %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS2 %s
21 // WRITE-STRINGS2-NOT: -fconst-strings
22 // RUN: %clang -### -S -Wwrite-strings -w %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS3 %s
23 // WRITE-STRINGS3-NOT: -fconst-strings
25 // RUN: %clang -### -x c++ -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
26 // RUN: %clang -### -x c++ -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
27 // RUN: %clang -### -x c++ -c -Wno-deprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
28 // RUN: %clang -### -x c++ -c -Wno-deprecated -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
29 // RUN: %clang -### -x c++ -c -w %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
30 // RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
31 // RUN: %clang -### -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
32 // DEPRECATED-ON-CHECK: -fdeprecated-macro
33 // DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
35 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
36 // RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
37 // RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
38 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
39 // FP-CONTRACT-OFF-CHECK: -ffp-contract=off
41 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
42 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
43 // RUN: %clang -### -S -fno-unroll-loops -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
44 // RUN: %clang -### -S -funroll-loops -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
45 // CHECK-UNROLL-LOOPS: "-funroll-loops"
46 // CHECK-NO-UNROLL-LOOPS: "-fno-unroll-loops"
48 // RUN: %clang -### -S -fprofile-sample-accurate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-SAMPLE-ACCURATE %s
49 // CHECK-PROFILE-SAMPLE-ACCURATE: "-fprofile-sample-accurate"
51 // RUN: %clang -### -S -fprofile-sample-use=%S/Inputs/file.prof %s 2>&1 | FileCheck -check-prefix=CHECK-SAMPLE-PROFILE %s
52 // CHECK-SAMPLE-PROFILE: "-fprofile-sample-use={{.*}}/file.prof"
55 // RUN: %clang -### -x cuda -nocudainc -nocudalib \
56 // RUN: -c -fprofile-sample-use=%S/Inputs/file.prof --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
57 // RUN: | FileCheck -check-prefix=CHECK-CUDA-SAMPLE-PROFILE %s
58 // -fprofile-sample-use should not be passed to the GPU compilation
59 // CHECK-CUDA-SAMPLE-PROFILE: "-cc1"
60 // CHECK-CUDA-SAMPLE-PROFILE-SAME: "-triple" "nvptx
61 // CHECK-CUDA-SAMPLE-PROFILE-NOT: "-fprofile-sample-use={{.*}}/file.prof"
62 // Host compilation should still have the option.
63 // CHECK-CUDA-SAMPLE-PROFILE: "-cc1"
64 // CHECK-CUDA-SAMPLE-PROFILE-SAME: "-fprofile-sample-use={{.*}}/file.prof"
67 // RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof %s 2>&1 | FileCheck -check-prefix=CHECK-AUTO-PROFILE %s
68 // CHECK-AUTO-PROFILE: "-fprofile-sample-use={{.*}}/file.prof"
70 // RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof -fno-profile-sample-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-AUTO-PROFILE %s
71 // RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof -fno-auto-profile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-AUTO-PROFILE %s
72 // CHECK-NO-AUTO-PROFILE-NOT: "-fprofile-sample-use={{.*}}/file.prof"
74 // RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof -fno-profile-sample-use -fauto-profile %s 2>&1 | FileCheck -check-prefix=CHECK-AUTO-PROFILE %s
75 // RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof -fno-auto-profile -fprofile-sample-use %s 2>&1 | FileCheck -check-prefix=CHECK-AUTO-PROFILE %s
77 // RUN: %clang -### -S -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-LLVM %s
78 // RUN: %clang -### -S -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
79 // RUN: %clang -### -S -fprofile-generate=/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-DIR %s
80 // RUN: %clang -### -S -fprofile-instr-generate=/tmp/somefile.profraw %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-FILE %s
81 // RUN: not %clang -### -S -fprofile-generate -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
82 // RUN: not %clang -### -S -fprofile-generate -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
83 // RUN: not %clang -### -S -fprofile-generate -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
84 // RUN: not %clang -### -S -fprofile-generate -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
85 // RUN: not %clang -### -S -fprofile-instr-generate -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
86 // RUN: not %clang -### -S -fprofile-instr-generate -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
87 // RUN: not %clang -### -S -fprofile-instr-generate -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
88 // RUN: not %clang -### -S -fprofile-instr-generate -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
89 // RUN: not %clang -### -S -fprofile-instr-generate=file -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
90 // RUN: not %clang -### -S -fprofile-instr-generate=file -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
91 // RUN: not %clang -### -S -fprofile-instr-generate=file -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
92 // RUN: not %clang -### -S -fprofile-instr-generate=file -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
93 // RUN: not %clang -### -S -fprofile-generate=dir -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
94 // RUN: not %clang -### -S -fprofile-generate=dir -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
95 // RUN: not %clang -### -S -fprofile-generate=dir -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
96 // RUN: not %clang -### -S -fprofile-generate=dir -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
97 // RUN: %clang -### -S -fprofile-instr-generate=file -fno-profile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-GEN %s
98 // RUN: not %clang -### -S -fprofile-instr-generate -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GENERATE %s
99 // RUN: not %clang -### -S -fprofile-instr-generate -fprofile-generate=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GENERATE %s
100 // RUN: %clang -### -S -fprofile-generate=dir -fno-profile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-GEN %s
101 // RUN: %clang -### -S -fprofile-instr-use=file -fno-profile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s
102 // RUN: %clang -### -S -fprofile-instr-use=file -fno-profile-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s
103 // RUN: %clang -### -S -fprofile-use=file -fno-profile-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s
104 // RUN: %clang -### -S -fprofile-use=file -fno-profile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s
105 // RUN: not %clang -### -S -fcoverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-AND-GEN %s
106 // RUN: %clang -### -S -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
107 // RUN: %clang -### -S -fprofile-instr-generate -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
108 // RUN: %clang -### -S -fprofile-remapping-file=foo/bar.txt %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-REMAP %s
109 // RUN: %clang -### -S -forder-file-instrumentation %s 2>&1 | FileCheck -check-prefix=CHECK-ORDERFILE-INSTR %s
110 // RUN: %clang -### --target=x86_64-linux-gnu -flto -forder-file-instrumentation %s 2>&1 | FileCheck -check-prefix=CHECK-ORDERFILE-INSTR-LTO %s
111 // CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang"
112 // CHECK-PROFILE-GENERATE-LLVM: "-fprofile-instrument=llvm"
113 // CHECK-PROFILE-GENERATE-DIR: "-fprofile-instrument-path=/some/dir{{/|\\\\}}{{.*}}"
114 // CHECK-PROFILE-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw"
115 // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
116 // CHECK-NO-MIX-GENERATE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
117 // CHECK-DISABLE-GEN-NOT: "-fprofile-instrument=clang"
118 // CHECK-DISABLE-USE-NOT: "-fprofile-instr-use"
119 // CHECK-COVERAGE-AND-GEN: '-fcoverage-mapping' only allowed with '-fprofile-instr-generate'
120 // CHECK-DISABLE-COVERAGE-NOT: "-fcoverage-mapping"
121 // CHECK-PROFILE-REMAP: "-fprofile-remapping-file=foo/bar.txt"
122 // CHECK-ORDERFILE-INSTR: "-forder-file-instrumentation"
123 // CHECK-ORDERFILE-INSTR: "-enable-order-file-instrumentation"
124 // CHECK-ORDERFILE-INSTR-LTO: "-forder-file-instrumentation"
125 // CHECK-ORDERFILE-INSTR-LTO-NOT: "-enable-order-file-instrumentation"
127 // RUN: %clang -### -S -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
128 // RUN: %clang -### -S -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
129 // RUN: mkdir -p %t.d/some/dir
130 // RUN: %clang -### -S -fprofile-use=%t.d/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-DIR %s
131 // RUN: %clang -### -S -fprofile-instr-use=/tmp/somefile.prof %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
132 // CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata"
133 // CHECK-PROFILE-USE-DIR: "-fprofile-instrument-use-path={{.*}}.d/some/dir{{/|\\\\}}default.profdata"
134 // CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof"
136 // RUN: %clang -### -S -fprofile-instr-use=%t.profdata -fdiagnostics-misexpect-tolerance=10 -Wmisexpect %s 2>&1 | FileCheck %s --check-prefix=CHECK-MISEXPECT-TOLLERANCE
137 // CHECK-MISEXPECT-TOLLERANCE: "-fdiagnostics-misexpect-tolerance=10"
138 // CHECK-MISEXPECT-TOLLERANCE-NOT: argument unused
140 // RUN: %clang -### -S -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
141 // RUN: %clang -### -S -fno-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
142 // RUN: %clang -### -S -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
143 // RUN: %clang -### -S -fvectorize -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
144 // RUN: %clang -### -S -ftree-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
145 // RUN: %clang -### -S -fno-tree-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
146 // RUN: %clang -### -S -fno-tree-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
147 // RUN: %clang -### -S -ftree-vectorize -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
148 // RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
149 // RUN: %clang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
150 // RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
151 // RUN: %clang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
152 // RUN: %clang -### -S -fno-vectorize -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
153 // RUN: %clang -### -S -O1 -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
154 // RUN: %clang -### -S -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
155 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
156 // RUN: %clang -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
157 // RUN: %clang -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
158 // RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
159 // CHECK-VECTORIZE: "-vectorize-loops"
160 // CHECK-NO-VECTORIZE-NOT: "-vectorize-loops"
162 // RUN: %clang -### -S -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
163 // RUN: %clang -### -S -fno-slp-vectorize -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
164 // RUN: %clang -### -S -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
165 // RUN: %clang -### -S -fslp-vectorize -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
166 // RUN: %clang -### -S -ftree-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
167 // RUN: %clang -### -S -fno-tree-slp-vectorize -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
168 // RUN: %clang -### -S -fno-tree-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
169 // RUN: %clang -### -S -ftree-slp-vectorize -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
170 // RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
171 // RUN: %clang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
172 // RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
173 // RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
174 // RUN: %clang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
175 // RUN: %clang -### -S -fno-slp-vectorize -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
176 // RUN: %clang -### -S -O1 -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
177 // RUN: %clang -### -S -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
178 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
179 // RUN: %clang -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
180 // RUN: %clang -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
181 // CHECK-SLP-VECTORIZE: "-vectorize-slp"
182 // CHECK-NO-SLP-VECTORIZE-NOT: "-vectorize-slp"
184 // RUN: %clang -### -S -fextended-identifiers %s 2>&1 | FileCheck -check-prefix=CHECK-EXTENDED-IDENTIFIERS %s
185 // RUN: not %clang -### -S -fno-extended-identifiers %s 2>&1 | FileCheck -check-prefix=CHECK-NO-EXTENDED-IDENTIFIERS %s
186 // CHECK-EXTENDED-IDENTIFIERS: "-cc1"
187 // CHECK-EXTENDED-IDENTIFIERS-NOT: "-fextended-identifiers"
188 // CHECK-NO-EXTENDED-IDENTIFIERS: error: unsupported option '-fno-extended-identifiers'
190 // RUN: %clang -### -S -frounding-math %s 2>&1 | FileCheck -check-prefix=CHECK-ROUNDING-MATH %s
191 // CHECK-ROUNDING-MATH: "-cc1"
192 // CHECK-ROUNDING-MATH: "-frounding-math"
193 // CHECK-ROUNDING-MATH-NOT: "-fno-rounding-math"
194 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-ROUNDING-MATH-NOT %s
195 // RUN: not %clang -### -S -ffp-model=imprecise %s 2>&1 | FileCheck -check-prefix=CHECK-FPMODEL %s
196 // CHECK-FPMODEL: unsupported argument 'imprecise' to option '-ffp-model='
197 // RUN: %clang -### -S -ffp-model=precise %s 2>&1 | FileCheck -check-prefix=IGNORE %s
198 // RUN: %clang -### -S -ffp-model=strict %s 2>&1 | FileCheck -check-prefix=IGNORE %s
199 // RUN: %clang -### -S -ffp-model=fast %s 2>&1 | FileCheck -check-prefix=IGNORE %s
200 // RUN: not %clang -### -S -ffp-exception-behavior=trap %s 2>&1 | FileCheck -check-prefix=CHECK-FPEB %s
201 // CHECK-FPEB: unsupported argument 'trap' to option '-ffp-exception-behavior='
202 // RUN: %clang -### -S -ffp-exception-behavior=maytrap %s 2>&1 | FileCheck -check-prefix=IGNORE %s
203 // RUN: %clang -### -S -ffp-exception-behavior=ignore %s 2>&1 | FileCheck -check-prefix=IGNORE %s
204 // RUN: %clang -### -S -ffp-exception-behavior=strict %s 2>&1 | FileCheck -check-prefix=IGNORE %s
206 // RUN: %clang -### -S -fno-pascal-strings -mpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-M-PASCAL-STRINGS %s
207 // CHECK-M-PASCAL-STRINGS: "-fpascal-strings"
209 // RUN: %clang -### -S -fpascal-strings -mno-pascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-NO-M-PASCAL-STRINGS %s
210 // CHECK-NO-M-PASCAL-STRINGS-NOT: "-fpascal-strings"
212 // RUN: %clang -### -S -O4 %s 2>&1 | FileCheck -check-prefix=CHECK-MAX-O %s
213 // CHECK-MAX-O: warning: -O4 is equivalent to -O3
216 // RUN: %clang -S -O20 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-O %s
217 // CHECK-INVALID-O: warning: optimization level '-O20' is not supported; using '-O3' instead
219 // RUN: not %clang -### -S -finput-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-CHARSET %s
220 // CHECK-INVALID-CHARSET: error: invalid value 'iso-8859-1' in '-finput-charset=iso-8859-1'
222 // RUN: not %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s
223 // CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in '-fexec-charset=iso-8859-1'
225 // Test that we don't error on these.
226 // RUN: not %clang -### -S -Werror \
227 // RUN: -falign-functions -falign-functions=2 -fno-align-functions \
228 // RUN: -fasynchronous-unwind-tables -fno-asynchronous-unwind-tables \
229 // RUN: -fbuiltin -fno-builtin \
230 // RUN: -fdiagnostics-show-location=once \
231 // RUN: -ffloat-store -fno-float-store \
232 // RUN: -feliminate-unused-debug-types -fno-eliminate-unused-debug-types \
233 // RUN: -fgcse -fno-gcse \
234 // RUN: -fident -fno-ident \
235 // RUN: -fimplicit-templates -fno-implicit-templates \
236 // RUN: -finput-charset=UTF-8 \
237 // RUN: -fexec-charset=UTF-8 \
238 // RUN: -fivopts -fno-ivopts \
239 // RUN: -fnon-call-exceptions -fno-non-call-exceptions \
240 // RUN: -fpermissive -fno-permissive \
241 // RUN: -fdefer-pop -fno-defer-pop \
242 // RUN: -fprefetch-loop-arrays -fno-prefetch-loop-arrays \
243 // RUN: -fprofile-correction -fno-profile-correction \
244 // RUN: -fprofile-values -fno-profile-values \
245 // RUN: -frounding-math -fno-rounding-math \
246 // RUN: -fsee -fno-see \
247 // RUN: -ftracer -fno-tracer \
248 // RUN: -funroll-all-loops -fno-unroll-all-loops \
249 // RUN: -fuse-ld=gold \
250 // RUN: -fno-builtin-foobar \
251 // RUN: -fno-builtin-strcat -fno-builtin-strcpy \
252 // RUN: -fno-var-tracking \
253 // RUN: -fno-unsigned-char \
254 // RUN: -fno-signed-char \
255 // RUN: -fstrength-reduce -fno-strength-reduce \
256 // RUN: -finline-limit=1000 \
257 // RUN: -finline-limit \
259 // RUN: -falign-labels \
260 // RUN: -falign-labels=100 \
261 // RUN: -falign-loops \
262 // RUN: -falign-loops=100 \
263 // RUN: -falign-jumps \
264 // RUN: -falign-jumps=100 \
265 // RUN: -fexcess-precision=100 \
266 // RUN: -fbranch-count-reg \
267 // RUN: -fcaller-saves \
268 // RUN: -fno-default-inline -fdefault-inline \
269 // RUN: -fgcse-after-reload \
273 // RUN: -finline-functions-called-once \
274 // RUN: -fmodulo-sched \
275 // RUN: -fmodulo-sched-allow-regmoves \
276 // RUN: -fpeel-loops \
277 // RUN: -frename-registers \
278 // RUN: -fschedule-insns2 \
279 // RUN: -fsingle-precision-constant \
280 // RUN: -funsafe-loop-optimizations \
281 // RUN: -fuse-linker-plugin \
282 // RUN: -fvect-cost-model \
283 // RUN: -fvariable-expansion-in-unroller \
285 // RUN: -fwhole-program \
286 // RUN: -fno-tree-dce -ftree-dce \
287 // RUN: -fno-tree-ter -ftree-ter \
288 // RUN: -fno-tree-vrp -ftree-vrp \
289 // RUN: -fno-delete-null-pointer-checks -fdelete-null-pointer-checks \
290 // RUN: -fno-inline-small-functions -finline-small-functions \
291 // RUN: -fno-fat-lto-objects -ffat-lto-objects \
292 // RUN: -flto=auto -flto=jobserver \
293 // RUN: -fno-merge-constants -fmerge-constants \
294 // RUN: -fno-caller-saves -fcaller-saves \
295 // RUN: -fno-reorder-blocks -freorder-blocks \
296 // RUN: -fno-schedule-insns2 -fschedule-insns2 \
297 // RUN: -fno-stack-check \
298 // RUN: -ffriend-injection \
299 // RUN: -fno-implement-inlines -fimplement-inlines \
300 // RUN: -fstack-check \
301 // RUN: -fforce-addr \
302 // RUN: -malign-functions=100 \
303 // RUN: -malign-loops=100 \
304 // RUN: -malign-jumps=100 \
305 // RUN: %s 2>&1 | FileCheck --check-prefix=IGNORE %s
306 // IGNORE-NOT: error: unknown argument
308 // Test that the warning is displayed on these.
309 // RUN: not %clang -### \
310 // RUN: -finline-limit=1000 \
311 // RUN: -finline-limit \
312 // RUN: -fexpensive-optimizations \
313 // RUN: -fno-expensive-optimizations \
314 // RUN: -fno-defer-pop \
315 // RUN: -fkeep-inline-functions \
316 // RUN: -fno-keep-inline-functions \
317 // RUN: -freorder-blocks \
318 // RUN: -ffloat-store \
321 // RUN: -fprefetch-loop-arrays \
322 // RUN: -fprofile-correction \
323 // RUN: -fprofile-values \
324 // RUN: -fschedule-insns \
325 // RUN: -fsignaling-nans \
326 // RUN: -fstrength-reduce \
328 // RUN: -funroll-all-loops \
329 // RUN: -funswitch-loops \
331 // RUN: -falign-labels \
332 // RUN: -falign-labels=100 \
333 // RUN: -falign-loops \
334 // RUN: -falign-loops=100 \
335 // RUN: -falign-jumps \
336 // RUN: -falign-jumps=100 \
337 // RUN: -fexcess-precision=100 \
338 // RUN: -fbranch-count-reg \
339 // RUN: -fcaller-saves \
340 // RUN: -fno-default-inline \
341 // RUN: -fgcse-after-reload \
345 // RUN: -finline-functions-called-once \
346 // RUN: -fmodulo-sched \
347 // RUN: -fmodulo-sched-allow-regmoves \
348 // RUN: -fpeel-loops \
349 // RUN: -frename-registers \
350 // RUN: -fschedule-insns2 \
351 // RUN: -fsingle-precision-constant \
352 // RUN: -funsafe-loop-optimizations \
353 // RUN: -fuse-linker-plugin \
354 // RUN: -fvect-cost-model \
355 // RUN: -fvariable-expansion-in-unroller \
357 // RUN: -fwhole-program \
358 // RUN: -fcaller-saves \
359 // RUN: -freorder-blocks \
360 // RUN: -ffat-lto-objects \
361 // RUN: -fmerge-constants \
362 // RUN: -finline-small-functions \
366 // RUN: -fno-devirtualize \
367 // RUN: -fno-devirtualize-speculatively \
368 // RUN: -fslp-vectorize-aggressive \
369 // RUN: -fno-slp-vectorize-aggressive \
370 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s
371 // CHECK-WARNING-DAG: optimization flag '-finline-limit=1000' is not supported
372 // CHECK-WARNING-DAG: optimization flag '-finline-limit' is not supported
373 // CHECK-WARNING-DAG: optimization flag '-fexpensive-optimizations' is not supported
374 // CHECK-WARNING-DAG: optimization flag '-fno-expensive-optimizations' is not supported
375 // CHECK-WARNING-DAG: optimization flag '-fno-defer-pop' is not supported
376 // CHECK-WARNING-DAG: optimization flag '-fkeep-inline-functions' is not supported
377 // CHECK-WARNING-DAG: optimization flag '-fno-keep-inline-functions' is not supported
378 // CHECK-WARNING-DAG: optimization flag '-freorder-blocks' is not supported
379 // CHECK-WARNING-DAG: optimization flag '-ffloat-store' is not supported
380 // CHECK-WARNING-DAG: optimization flag '-fgcse' is not supported
381 // CHECK-WARNING-DAG: optimization flag '-fivopts' is not supported
382 // CHECK-WARNING-DAG: optimization flag '-fprefetch-loop-arrays' is not supported
383 // CHECK-WARNING-DAG: optimization flag '-fprofile-correction' is not supported
384 // CHECK-WARNING-DAG: optimization flag '-fprofile-values' is not supported
385 // CHECK-WARNING-DAG: optimization flag '-fschedule-insns' is not supported
386 // CHECK-WARNING-DAG: optimization flag '-fsignaling-nans' is not supported
387 // CHECK-WARNING-DAG: optimization flag '-fstrength-reduce' is not supported
388 // CHECK-WARNING-DAG: optimization flag '-ftracer' is not supported
389 // CHECK-WARNING-DAG: optimization flag '-funroll-all-loops' is not supported
390 // CHECK-WARNING-DAG: optimization flag '-funswitch-loops' is not supported
391 // CHECK-WARNING-DAG: unsupported argument '1' to option '-flto='
392 // CHECK-WARNING-DAG: optimization flag '-falign-labels' is not supported
393 // CHECK-WARNING-DAG: optimization flag '-falign-labels=100' is not supported
394 // CHECK-WARNING-DAG: optimization flag '-falign-loops' is not supported
395 // CHECK-WARNING-DAG: optimization flag '-falign-jumps' is not supported
396 // CHECK-WARNING-DAG: optimization flag '-falign-jumps=100' is not supported
397 // CHECK-WARNING-DAG: unsupported argument '100' to option '-fexcess-precision='
398 // CHECK-WARNING-DAG: optimization flag '-fbranch-count-reg' is not supported
399 // CHECK-WARNING-DAG: optimization flag '-fcaller-saves' is not supported
400 // CHECK-WARNING-DAG: optimization flag '-fno-default-inline' is not supported
401 // CHECK-WARNING-DAG: optimization flag '-fgcse-after-reload' is not supported
402 // CHECK-WARNING-DAG: optimization flag '-fgcse-las' is not supported
403 // CHECK-WARNING-DAG: optimization flag '-fgcse-sm' is not supported
404 // CHECK-WARNING-DAG: optimization flag '-fipa-cp' is not supported
405 // CHECK-WARNING-DAG: optimization flag '-finline-functions-called-once' is not supported
406 // CHECK-WARNING-DAG: optimization flag '-fmodulo-sched' is not supported
407 // CHECK-WARNING-DAG: optimization flag '-fmodulo-sched-allow-regmoves' is not supported
408 // CHECK-WARNING-DAG: optimization flag '-fpeel-loops' is not supported
409 // CHECK-WARNING-DAG: optimization flag '-frename-registers' is not supported
410 // CHECK-WARNING-DAG: optimization flag '-fschedule-insns2' is not supported
411 // CHECK-WARNING-DAG: optimization flag '-fsingle-precision-constant' is not supported
412 // CHECK-WARNING-DAG: optimization flag '-funsafe-loop-optimizations' is not supported
413 // CHECK-WARNING-DAG: optimization flag '-fuse-linker-plugin' is not supported
414 // CHECK-WARNING-DAG: optimization flag '-fvect-cost-model' is not supported
415 // CHECK-WARNING-DAG: optimization flag '-fvariable-expansion-in-unroller' is not supported
416 // CHECK-WARNING-DAG: optimization flag '-fweb' is not supported
417 // CHECK-WARNING-DAG: optimization flag '-fwhole-program' is not supported
418 // CHECK-WARNING-DAG: optimization flag '-fcaller-saves' is not supported
419 // CHECK-WARNING-DAG: optimization flag '-freorder-blocks' is not supported
420 // CHECK-WARNING-DAG: optimization flag '-fmerge-constants' is not supported
421 // CHECK-WARNING-DAG: optimization flag '-finline-small-functions' is not supported
422 // CHECK-WARNING-DAG: optimization flag '-ftree-dce' is not supported
423 // CHECK-WARNING-DAG: optimization flag '-ftree-ter' is not supported
424 // CHECK-WARNING-DAG: optimization flag '-ftree-vrp' is not supported
425 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize' is not supported
426 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize-speculatively' is not supported
427 // CHECK-WARNING-DAG: the flag '-fslp-vectorize-aggressive' has been deprecated and will be ignored
428 // CHECK-WARNING-DAG: the flag '-fno-slp-vectorize-aggressive' has been deprecated and will be ignored
430 // Test that we mute the warning on these
431 // RUN: %clang -### -finline-limit=1000 -Wno-invalid-command-line-argument \
432 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING1 %s
433 // RUN: %clang -### -finline-limit -Wno-invalid-command-line-argument \
434 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING2 %s
435 // RUN: %clang -### -finline-limit \
436 // RUN: -Winvalid-command-line-argument -Wno-ignored-optimization-argument \
437 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING2 %s
438 // CHECK-NO-WARNING1-NOT: optimization flag '-finline-limit=1000' is not supported
439 // CHECK-NO-WARNING2-NOT: optimization flag '-finline-limit' is not supported
441 // Test that an ignored optimization argument only prints 1 warning,
442 // not both a warning about not claiming the arg, *and* about not supporting
443 // the arg; and that adding -Wno-ignored-optimization silences the warning.
445 // RUN: %clang -### -fprofile-correction %s 2>&1 \
446 // RUN: | FileCheck --check-prefix=CHECK-NO-WARNING3 %s
447 // CHECK-NO-WARNING3: optimization flag '-fprofile-correction' is not supported
448 // CHECK-NO-WARNING3-NOT: argument unused
449 // RUN: %clang -### -fprofile-correction -Wno-ignored-optimization-argument %s 2>&1 \
450 // RUN: | FileCheck --check-prefix=CHECK-NO-WARNING4 %s
451 // CHECK-NO-WARNING4-NOT: not supported
452 // CHECK-NO-WARNING4-NOT: argument unused
454 // RUN: %clang -### -S -fsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN1 %s
455 // CHAR-SIGN1-NOT: -fno-signed-char
457 // RUN: %clang -### -S -funsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN2 %s
458 // CHAR-SIGN2: -fno-signed-char
460 // RUN: %clang -### -S -fno-signed-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN3 %s
461 // CHAR-SIGN3: -fno-signed-char
463 // RUN: %clang -### -S -fno-unsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN4 %s
464 // CHAR-SIGN4-NOT: -fno-signed-char
466 // RUN: %clang --target=x86_64-unknown-none-none -### -fshort-wchar -fno-short-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR1 -check-prefix=DELIMITERS %s
467 // RUN: %clang --target=x86_64-unknown-none-none -### -fno-short-wchar -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR2 -check-prefix=DELIMITERS %s
468 // Make sure we don't match the -NOT lines with the linker invocation.
469 // Delimiters match the start of the cc1 and the start of the linker lines
470 // DELIMITERS: {{^ (\(in-process\)|")}}
471 // CHECK-WCHAR1: -fwchar-type=int
472 // CHECK-WCHAR1-NOT: -fwchar-type=short
473 // CHECK-WCHAR2: -fwchar-type=short
474 // CHECK-WCHAR2-NOT: -fwchar-type=int
475 // DELIMITERS: {{^ *"}}
477 // RUN: %clang -### -S -fstrict-return %s 2>&1 | FileCheck -check-prefix=CHECK-STRICT-RETURN %s
478 // RUN: %clang -### -S -fno-strict-return %s 2>&1 | FileCheck -check-prefix=CHECK-NO-STRICT-RETURN %s
479 // CHECK-STRICT-RETURN-NOT: "-fno-strict-return"
480 // CHECK-NO-STRICT-RETURN: "-fno-strict-return"
482 // RUN: %clang -### -S -fno-debug-info-for-profiling -fdebug-info-for-profiling %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DEBUG %s
483 // RUN: %clang -### -S -fdebug-info-for-profiling -fno-debug-info-for-profiling %s 2>&1 | FileCheck -check-prefix=CHECK-NO-PROFILE-DEBUG %s
484 // CHECK-PROFILE-DEBUG: -fdebug-info-for-profiling
485 // CHECK-NO-PROFILE-DEBUG-NOT: -fdebug-info-for-profiling
487 // RUN: %clang -### -S -fallow-editor-placeholders %s 2>&1 | FileCheck -check-prefix=CHECK-ALLOW-PLACEHOLDERS %s
488 // RUN: %clang -### -S -fno-allow-editor-placeholders %s 2>&1 | FileCheck -check-prefix=CHECK-NO-ALLOW-PLACEHOLDERS %s
489 // CHECK-ALLOW-PLACEHOLDERS: -fallow-editor-placeholders
490 // CHECK-NO-ALLOW-PLACEHOLDERS-NOT: -fallow-editor-placeholders
492 // RUN: %clang -### --target=x86_64-unknown-windows-msvc -fno-short-wchar %s 2>&1 | FileCheck -check-prefix CHECK-WINDOWS-ISO10646 %s
493 // CHECK-WINDOWS-ISO10646: "-fwchar-type=int"
494 // CHECK-WINDOWS-ISO10646: "-fsigned-wchar"
496 // RUN: %clang -### -S -fcf-protection %s 2>&1 | FileCheck -check-prefix=CHECK-CF-PROTECTION-FULL %s
497 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CF-PROTECTION-FULL %s
498 // RUN: %clang -### -S -fcf-protection=full %s 2>&1 | FileCheck -check-prefix=CHECK-CF-PROTECTION-FULL %s
499 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CF-PROTECTION-FULL %s
500 // CHECK-CF-PROTECTION-FULL: -fcf-protection=full
501 // CHECK-NO-CF-PROTECTION-FULL-NOT: -fcf-protection=full
502 // RUN: %clang -### -S -fcf-protection=return %s 2>&1 | FileCheck -check-prefix=CHECK-CF-PROTECTION-RETURN %s
503 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CF-PROTECTION-RETURN %s
504 // CHECK-CF-PROTECTION-RETURN: -fcf-protection=return
505 // CHECK-NO-CF-PROTECTION-RETURN-NOT: -fcf-protection=return
506 // RUN: %clang -### -S -fcf-protection=branch %s 2>&1 | FileCheck -check-prefix=CHECK-CF-PROTECTION-BRANCH %s
507 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CF-PROTECTION-BRANCH %s
508 // CHECK-CF-PROTECTION-BRANCH: -fcf-protection=branch
509 // CHECK-NO-CF-PROTECTION-BRANCH-NOT: -fcf-protection=branch
511 // RUN: %clang -### -S -fprofile-instr-generate -fcoverage-compilation-dir=. %s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-COMPILATION-DIR %s
512 // RUN: %clang -### -S -fprofile-instr-generate -ffile-compilation-dir=. %s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-COMPILATION-DIR %s
513 // CHECK-COVERAGE-COMPILATION-DIR: "-fcoverage-compilation-dir=."
514 // CHECK-COVERAGE-COMPILATION-DIR-NOT: "-ffile-compilation-dir=."
516 // RUN: %clang -### -S -fverify-intermediate-code %s 2>&1 | FileCheck -check-prefix=CHECK-VERIFY-INTERMEDIATE-CODE %s
517 // RUN: %clang -### -S -fno-verify-intermediate-code %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VERIFY-INTERMEDIATE-CODE %s
518 // CHECK-VERIFY-INTERMEDIATE-CODE-NOT: "-disable-llvm-verifier"
519 // CHECK-NO-VERIFY-INTERMEDIATE-CODE: "-disable-llvm-verifier"
521 // RUN: %clang -### -S -fdiscard-value-names %s 2>&1 | FileCheck -check-prefix=CHECK-DISCARD-NAMES %s
522 // RUN: %clang -### -S -fno-discard-value-names %s 2>&1 | FileCheck -check-prefix=CHECK-NO-DISCARD-NAMES %s
523 // CHECK-DISCARD-NAMES: "-discard-value-names"
524 // CHECK-NO-DISCARD-NAMES-NOT: "-discard-value-names"
526 // RUN: %clang -### -S -fdelete-null-pointer-checks %s 2>&1 | FileCheck -check-prefix=CHECK-NULL-POINTER-CHECKS %s
527 // RUN: %clang -### -S -fno-delete-null-pointer-checks %s 2>&1 | FileCheck -check-prefix=CHECK-NO-NULL-POINTER-CHECKS %s
528 // RUN: %clang -### -S -fdelete-null-pointer-checks -fno-delete-null-pointer-checks %s 2>&1 | FileCheck -check-prefix=CHECK-NO-NULL-POINTER-CHECKS %s
529 // RUN: %clang -### -S -fno-delete-null-pointer-checks -fdelete-null-pointer-checks %s 2>&1 | FileCheck -check-prefix=CHECK-NULL-POINTER-CHECKS %s
530 // CHECK-NO-NULL-POINTER-CHECKS: "-fno-delete-null-pointer-checks"
531 // CHECK-NULL-POINTER-CHECKS-NOT: "-fno-delete-null-pointer-checks"
533 // RUN: %clang -### -S --target=x86_64-unknown-linux -frecord-gcc-switches %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES %s
534 // RUN: %clang -### -S --target=x86_64-unknown-linux -fno-record-gcc-switches %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RECORD-GCC-SWITCHES %s
535 // RUN: %clang -### -S --target=x86_64-unknown-linux -fno-record-gcc-switches -frecord-gcc-switches %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES %s
536 // RUN: %clang -### -S --target=x86_64-unknown-linux -frecord-gcc-switches -fno-record-gcc-switches %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RECORD-GCC-SWITCHES %s
537 // RUN: %clang -### -S --target=x86_64-unknown-linux -frecord-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES %s
538 // RUN: %clang -### -S --target=x86_64-unknown-linux -fno-record-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RECORD-GCC-SWITCHES %s
539 // RUN: %clang -### -S --target=x86_64-unknown-linux -fno-record-command-line -frecord-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES %s
540 // RUN: %clang -### -S --target=x86_64-unknown-linux -frecord-command-line -fno-record-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RECORD-GCC-SWITCHES %s
541 // Test with a couple examples of non-ELF object file formats
542 // RUN: %clang -### -S --target=x86_64-unknown-macosx -frecord-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES %s
543 // RUN: not %clang -### -S --target=x86_64-unknown-windows -frecord-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES-ERROR %s
544 // CHECK-RECORD-GCC-SWITCHES: "-record-command-line"
545 // CHECK-NO-RECORD-GCC-SWITCHES-NOT: "-record-command-line"
546 // CHECK-RECORD-GCC-SWITCHES-ERROR: error: unsupported option '-frecord-command-line' for target
547 // Test when clang is in a path containing a space.
548 // The initial `rm` is a workaround for https://openradar.appspot.com/FB8914243
549 // (Scenario: Run tests once, `clang` gets copied and run at new location and signature
550 // is cached at the new clang's inode, then clang is changed, tests run again, old signature
551 // is still cached with old clang's inode, so it won't execute this time. Removing the dir
552 // first guarantees a new inode without old cache entries.)
553 // RUN: rm -rf "%t.r/with spaces"
554 // RUN: mkdir -p "%t.r/with spaces"
555 // RUN: cp %clang "%t.r/with spaces/clang"
556 // RUN: "%t.r/with spaces/clang" -### -S --target=x86_64-unknown-linux -frecord-gcc-switches %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES-ESCAPED %s
557 // CHECK-RECORD-GCC-SWITCHES-ESCAPED: "-record-command-line" "{{.+}}with\\ spaces{{.+}}"
558 // Clean up copy of large binary copied into temp directory to avoid bloat.
559 // RUN: rm -f "%t.r/with spaces/clang" || true
561 // RUN: %clang -### -S -ftrivial-auto-var-init=uninitialized %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-UNINIT %s
562 // RUN: %clang -### -S -ftrivial-auto-var-init=pattern %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-PATTERN %s
563 // RUN: %clang -### -S -ftrivial-auto-var-init=zero %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-ZERO %s
564 // CHECK-TRIVIAL-UNINIT-NOT: hasn't been enabled
565 // CHECK-TRIVIAL-PATTERN-NOT: hasn't been enabled
566 // CHECK-TRIVIAL-ZERO-NOT: hasn't been enabled
568 // RUN: %clang -### -S -ftrivial-auto-var-init=pattern -ftrivial-auto-var-init-stop-after=1 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-PATTERN-STOP-AFTER %s
569 // RUN: %clang -### -S -ftrivial-auto-var-init=zero -ftrivial-auto-var-init-stop-after=1 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-ZERO-STOP-AFTER %s
570 // RUN: not %clang -### -S -ftrivial-auto-var-init-stop-after=0 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-STOP-AFTER-MISSING-DEPENDENCY %s
571 // RUN: not %clang -### -S -ftrivial-auto-var-init=pattern -ftrivial-auto-var-init-stop-after=0 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-PATTERN-STOP-AFTER-INVALID-VALUE %s
572 // RUN: not %clang -### -S -ftrivial-auto-var-init=zero -ftrivial-auto-var-init-stop-after=0 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-ZERO-STOP-AFTER-INVALID-VALUE %s
573 // CHECK-TRIVIAL-PATTERN-STOP-AFTER-NOT: is used without '-ftrivial-auto-var-init'
574 // CHECK-TRIVIAL-PATTERN-STOP-AFTER-NOT: only accepts positive integers
575 // CHECK-TRIVIAL-ZERO-STOP-AFTER-NOT: is used without '-ftrivial-auto-var-init'
576 // CHECK-TRIVIAL-ZERO-STOP-AFTER-NOT: only accepts positive integers
577 // CHECK-TRIVIAL-STOP-AFTER-MISSING-DEPENDENCY: used without '-ftrivial-auto-var-init=zero' or
578 // CHECK-TRIVIAL-PATTERN-STOP-AFTER-INVALID-VALUE: only accepts positive integers
579 // CHECK-TRIVIAL-ZERO-STOP-AFTER-INVALID-VALUE: only accepts positive integers
581 // RUN: %clang -### -S -ftrivial-auto-var-init=pattern -ftrivial-auto-var-init-max-size=1024 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-PATTERN-MAX-SIZE %s
582 // RUN: %clang -### -S -ftrivial-auto-var-init=zero -ftrivial-auto-var-init-max-size=1024 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-ZERO-MAX-SIZE %s
583 // RUN: not %clang -### -S -ftrivial-auto-var-init-max-size=1024 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-MAX-SIZE-MISSING-DEPENDENCY %s
584 // RUN: not %clang -### -S -ftrivial-auto-var-init=pattern -ftrivial-auto-var-init-max-size=0 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-PATTERN-MAX-SIZE-INVALID-VALUE %s
585 // RUN: not %clang -### -S -ftrivial-auto-var-init=zero -ftrivial-auto-var-init-max-size=0 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-ZERO-MAX-SIZE-INVALID-VALUE %s
586 // CHECK-TRIVIAL-PATTERN-MAX-SIZE-NOT: is used without '-ftrivial-auto-var-init'
587 // CHECK-TRIVIAL-PATTERN-MAX-SIZE-NOT: only accepts positive integers (in bytes)
588 // CHECK-TRIVIAL-ZERO-MAX-SIZE-NOT: is used without '-ftrivial-auto-var-init'
589 // CHECK-TRIVIAL-ZERO-MAX-SIZE-NOT: only accepts positive integers (in bytes)
590 // CHECK-TRIVIAL-MAX-SIZE-MISSING-DEPENDENCY: used without '-ftrivial-auto-var-init=zero' or
591 // CHECK-TRIVIAL-PATTERN-MAX-SIZE-INVALID-VALUE: only accepts positive integers (in bytes)
592 // CHECK-TRIVIAL-ZERO-MAX-SIZE-INVALID-VALUE: only accepts positive integers (in bytes)
594 // RUN: %clang -### -S -fno-temp-file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-TEMP-FILE %s
595 // CHECK-NO-TEMP-FILE: "-fno-temp-file"
597 // RUN: %clang -### -xobjective-c -fobjc-disable-direct-methods-for-testing %s 2>&1 | FileCheck -check-prefix=CHECK_DISABLE_DIRECT %s
598 // RUN: %clang -### -xobjective-c %s 2>&1 | FileCheck -check-prefix=CHECK_NO_DISABLE_DIRECT %s
599 // CHECK_DISABLE_DIRECT: -fobjc-disable-direct-methods-for-testing
600 // CHECK_NO_DISABLE_DIRECT-NOT: -fobjc-disable-direct-methods-for-testing
602 // RUN: %clang -### -S -fjmc --target=x86_64-unknown-linux %s 2>&1 | FileCheck -check-prefixes=CHECK_JMC_WARN,CHECK_NOJMC %s
603 // RUN: %clang -### -S -fjmc --target=x86_64-pc-windows-msvc %s 2>&1 | FileCheck -check-prefixes=CHECK_JMC_WARN,CHECK_NOJMC %s
604 // RUN: %clang -### -S -fjmc -g --target=x86_64-pc-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK_JMC %s
605 // RUN: %clang -### -S -fjmc -g -fno-jmc --target=x86_64-pc-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK_NOJMC %s
606 // RUN: %clang -### -S -fjmc -g --target=x86_64-unknown-linux %s 2>&1 | FileCheck -check-prefix=CHECK_JMC %s
607 // RUN: %clang -### -S -fjmc -g -fno-jmc --target=x86_64-unknown-linux %s 2>&1 | FileCheck -check-prefix=CHECK_NOJMC %s
608 // RUN: %clang -### -fjmc -g -flto -fuse-ld=lld --target=x86_64-pc-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK_NOJMC_LTO %s
609 // RUN: %clang -### -fjmc -g -flto -fuse-ld=lld-link --target=x86_64-pc-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK_NOJMC_LTO %s
610 // RUN: %clang -### -fjmc -g -flto --target=x86_64-unknown-linux %s 2>&1 | FileCheck -check-prefix=CHECK_JMC_LTO %s
611 // RUN: %clang -### -fjmc -g -flto -fno-jmc --target=x86_64-unknown-linux %s 2>&1 | FileCheck -check-prefix=CHECK_NOJMC_LTO %s
612 // CHECK_JMC_WARN: -fjmc requires debug info. Use -g or debug options that enable debugger's stepping function; option ignored
613 // CHECK_JMC_WARN_NOT_ELF: -fjmc works only for ELF; option ignored
614 // CHECK_NOJMC-NOT: -fjmc
616 // CHECK_NOJMC_LTO-NOT: -plugin-opt=-enable-jmc-instrument
617 // CHECK_JMC_LTO: -plugin-opt=-enable-jmc-instrument
619 // RUN: %clang -### -fintegrated-objemitter --target=x86_64 %s 2>&1 | FileCheck -check-prefix=CHECK-INT-OBJEMITTER %s
620 // CHECK-INT-OBJEMITTER-NOT: unsupported option '-fintegrated-objemitter' for target
621 // RUN: not %clang -### -fno-integrated-objemitter --target=x86_64 %s 2>&1 | FileCheck -check-prefix=CHECK-NOINT-OBJEMITTER %s
622 // CHECK-NOINT-OBJEMITTER: unsupported option '-fno-integrated-objemitter' for target
624 // RUN: %clang -### --target=aarch64-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
625 // RUN: %clang -### --target=aarch64-windows-msvc -fms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s
626 // RUN: %clang -### --target=aarch64-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
627 // RUN: %clang -### --target=x86_64-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s
628 // RUN: %clang -### --target=x86_64-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
629 // RUN: %clang -### --target=i686-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s
630 // RUN: %clang -### --target=i686-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
631 // CHECK-MS-VOLATILE: -fms-volatile
632 // CHECK-NO-MS-VOLATILE-NOT: -fms-volatile
634 // RUN: %clang -### --target=x86_64-pc-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-NO-STRICT-ALIASING %s
635 // RUN: %clang -### --target=x86_64-pc-windows-msvc -fstrict-aliasing %s 2>&1 | FileCheck -check-prefix=CHECK-STRICT-ALIASING %s
636 // RUN: %clang -### --target=x86_64-pc-windows-msvc -fno-strict-aliasing %s 2>&1 | FileCheck -check-prefix=CHECK-NO-STRICT-ALIASING %s
637 // CHECK-STRICT-ALIASING-NOT: -relaxed-aliasing
638 // CHECK-NO-STRICT-ALIASING: -relaxed-aliasing