[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / CodeCompletion / ordinary-name-cxx11.cpp
blob7593d00210e7c74064b0af9095f239ecb7c3ea05
1 struct X { int x; };
2 void z(int);
3 typedef struct t TYPEDEF;
5 void foo() {
6 int y = 17;
7 // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:14 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
8 // CHECK-CC1: COMPLETION: bool
9 // CHECK-CC1-NEXT: COMPLETION: char
10 // CHECK-CC1-NEXT: COMPLETION: char16
11 // CHECK-CC1-NEXT: COMPLETION: char32
12 // CHECK-CC1-NEXT: COMPLETION: class
13 // CHECK-CC1-NEXT: COMPLETION: const
14 // CHECK-CC1-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
15 // CHECK-CC1: COMPLETION: Pattern : [#void#]delete <#expression#>
16 // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
17 // CHECK-CC1-NEXT: COMPLETION: Pattern : do {
18 // CHECK-CC1-NEXT: <#statements#>
19 // CHECK-CC1-NEXT: }
20 // CHECK-CC1: COMPLETION: double
21 // CHECK-CC1-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
22 // CHECK-CC1-NEXT: COMPLETION: enum
23 // CHECK-CC1-NEXT: COMPLETION: extern
24 // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]false
25 // CHECK-CC1-NEXT: COMPLETION: float
26 // CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo()
27 // CHECK-CC1-NEXT: COMPLETION: Pattern : for (<#init-statement#>; <#condition#>; <#inc-expression#>) {
28 // CHECK-CC1: COMPLETION: Pattern : goto <#label#>;
29 // CHECK-CC1-NEXT: COMPLETION: Pattern : if (<#condition#>) {
30 // CHECK-CC1-NEXT: <#statements#>
31 // CHECK-CC1-NEXT: }
32 // CHECK-CC1: COMPLETION: int
33 // CHECK-CC1-NEXT: COMPLETION: long
34 // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
35 // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
36 // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expression#>)
37 // CHECK-CC1-NEXT: COMPLETION: Pattern : [#std::nullptr_t#]nullptr
38 // CHECK-CC1-NEXT: COMPLETION: operator
39 // CHECK-CC1-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
40 // CHECK-CC1-NEXT: COMPLETION: Pattern : return;
41 // CHECK-CC1-NEXT: COMPLETION: short
42 // CHECK-CC1-NEXT: COMPLETION: signed
43 // CHECK-CC1-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
44 // CHECK-CC1-NEXT: COMPLETION: Pattern : [#size_t#]sizeof...(<#parameter-pack#>)
45 // CHECK-CC1-NEXT: COMPLETION: static
46 // CHECK-CC1-NEXT: COMPLETION: Pattern : static_assert(<#expression#>, <#message#>);
47 // CHECK-CC1-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
48 // CHECK-CC1-NEXT: COMPLETION: struct
49 // CHECK-CC1-NEXT: COMPLETION: Pattern : switch (<#condition#>) {
50 // CHECK-CC1: COMPLETION: t : t
51 // CHECK-CC1-NEXT: COMPLETION: thread_local
52 // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]throw <#expression#>
53 // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]true
54 // CHECK-CC1-NEXT: COMPLETION: Pattern : try {
55 // CHECK-CC1-NEXT: <#statements#>
56 // CHECK-CC1-NEXT: }
57 // CHECK-CC1: COMPLETION: TYPEDEF : TYPEDEF
58 // CHECK-CC1-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>;
59 // CHECK-CC1-NEXT: COMPLETION: Pattern : [#std::type_info#]typeid(<#expression-or-type#>)
60 // CHECK-CC1-NEXT: COMPLETION: Pattern : typename <#name#>
61 // CHECK-CC1-NEXT: COMPLETION: Pattern : typeof <#expression#>
62 // CHECK-CC1-NEXT: COMPLETION: Pattern : typeof(<#type#>)
63 // CHECK-CC1-NEXT: COMPLETION: union
64 // CHECK-CC1-NEXT: COMPLETION: unsigned
65 // CHECK-CC1-NEXT: COMPLETION: Pattern : using <#name#> = <#type#>;
66 // CHECK-CC1-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
67 // CHECK-CC1-NEXT: COMPLETION: void
68 // CHECK-CC1-NEXT: COMPLETION: volatile
69 // CHECK-CC1-NEXT: COMPLETION: wchar_t
70 // CHECK-CC1-NEXT: COMPLETION: Pattern : while (<#condition#>) {
71 // CHECK-CC1-NEXT: <#statements#>
72 // CHECK-CC1-NEXT: }
73 // CHECK-CC1: COMPLETION: X : X
74 // CHECK-CC1-NEXT: COMPLETION: y : [#int#]y
75 // CHECK-CC1-NEXT: COMPLETION: z : [#void#]z(<#int#>)
77 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:4:1 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
78 // CHECK-CC2: COMPLETION: Pattern : asm(<#string-literal#>)
79 // CHECK-CC2: COMPLETION: auto
80 // CHECK-CC2-NEXT: COMPLETION: bool
81 // CHECK-CC2-NEXT: COMPLETION: char
82 // CHECK-CC2-NEXT: COMPLETION: char16
83 // CHECK-CC2-NEXT: COMPLETION: char32
84 // CHECK-CC2-NEXT: COMPLETION: class
85 // CHECK-CC2-NEXT: COMPLETION: const
86 // CHECK-CC2-NEXT: COMPLETION: constexpr
87 // CHECK-CC2-NEXT: COMPLETION: Pattern : decltype(<#expression#>)
88 // CHECK-CC2-NEXT: COMPLETION: double
89 // CHECK-CC2-NEXT: COMPLETION: enum
90 // CHECK-CC2-NEXT: COMPLETION: extern
91 // CHECK-CC2-NEXT: COMPLETION: float
92 // CHECK-CC2-NEXT: COMPLETION: inline
93 // CHECK-CC2-NEXT: COMPLETION: int
94 // CHECK-CC2-NEXT: COMPLETION: long
95 // CHECK-CC2-NEXT: COMPLETION: Pattern : namespace <#identifier#> {
96 // CHECK-CC2-NEXT: <#declarations#>
97 // CHECK-CC2-NEXT: }
98 // CHECK-CC2: COMPLETION: Pattern : namespace <#name#> = <#namespace#>;
99 // CHECK-CC2-NEXT: COMPLETION: operator
100 // CHECK-CC2-NEXT: COMPLETION: short
101 // CHECK-CC2-NEXT: COMPLETION: signed
102 // CHECK-CC2-NEXT: COMPLETION: static
103 // CHECK-CC2-NEXT: COMPLETION: Pattern : static_assert(<#expression#>, <#message#>);
104 // CHECK-CC2-NEXT: COMPLETION: struct
105 // CHECK-CC2-NEXT: COMPLETION: t : t
106 // CHECK-CC2-NEXT: COMPLETION: Pattern : template <#declaration#>
107 // CHECK-CC2-NEXT: COMPLETION: Pattern : template<<#parameters#>>
108 // CHECK-CC2-NEXT: COMPLETION: thread_local
109 // CHECK-CC2-NEXT: COMPLETION: TYPEDEF : TYPEDEF
110 // CHECK-CC2-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>;
111 // CHECK-CC2-NEXT: COMPLETION: Pattern : typename <#name#>
112 // CHECK-CC2-NEXT: COMPLETION: Pattern : typeof <#expression#>
113 // CHECK-CC2-NEXT: COMPLETION: Pattern : typeof(<#type#>)
114 // CHECK-CC2-NEXT: COMPLETION: union
115 // CHECK-CC2-NEXT: COMPLETION: unsigned
116 // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>;
117 // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#name#> = <#type#>;
118 // CHECK-CC2-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
119 // CHECK-CC2-NEXT: COMPLETION: void
120 // CHECK-CC2-NEXT: COMPLETION: volatile
121 // CHECK-CC2-NEXT: COMPLETION: wchar_t
122 // CHECK-CC2-NEXT: COMPLETION: X : X
124 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:1:19 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
125 // CHECK-CC3: COMPLETION: bool
126 // CHECK-CC3-NEXT: COMPLETION: char
127 // CHECK-CC3-NEXT: COMPLETION: char16_t
128 // CHECK-CC3-NEXT: COMPLETION: char32_t
129 // CHECK-CC3-NEXT: COMPLETION: class
130 // CHECK-CC3-NEXT: COMPLETION: const
131 // CHECK-CC3-NEXT: COMPLETION: constexpr
132 // CHECK-CC3-NEXT: COMPLETION: Pattern : decltype(<#expression#>)
133 // CHECK-CC3-NEXT: COMPLETION: double
134 // CHECK-CC3-NEXT: COMPLETION: enum
135 // CHECK-CC3-NEXT: COMPLETION: explicit
136 // CHECK-CC3-NEXT: COMPLETION: extern
137 // CHECK-CC3-NEXT: COMPLETION: float
138 // CHECK-CC3-NEXT: COMPLETION: friend
139 // CHECK-CC3-NEXT: COMPLETION: inline
140 // CHECK-CC3-NEXT: COMPLETION: int
141 // CHECK-CC3-NEXT: COMPLETION: long
142 // CHECK-CC3-NEXT: COMPLETION: mutable
143 // CHECK-CC3-NEXT: COMPLETION: operator
144 // CHECK-CC3-NEXT: COMPLETION: Pattern : private:
145 // CHECK-CC3-NEXT: COMPLETION: Pattern : protected:
146 // CHECK-CC3-NEXT: COMPLETION: Pattern : public:
147 // CHECK-CC3-NEXT: COMPLETION: short
148 // CHECK-CC3-NEXT: COMPLETION: signed
149 // CHECK-CC3-NEXT: COMPLETION: static
150 // CHECK-CC3-NEXT: COMPLETION: Pattern : static_assert(<#expression#>, <#message#>);
151 // CHECK-CC3-NEXT: COMPLETION: struct
152 // CHECK-CC3-NEXT: COMPLETION: Pattern : template<<#parameters#>>
153 // CHECK-CC3-NEXT: COMPLETION: thread_local
154 // CHECK-CC3-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>;
155 // CHECK-CC3-NEXT: COMPLETION: Pattern : typename <#name#>
156 // CHECK-CC3-NEXT: COMPLETION: Pattern : typeof <#expression#>
157 // CHECK-CC3-NEXT: COMPLETION: Pattern : typeof(<#type#>)
158 // CHECK-CC3-NEXT: COMPLETION: union
159 // CHECK-CC3-NEXT: COMPLETION: unsigned
160 // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>
161 // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#name#> = <#type#>;
162 // CHECK-CC3-NEXT: COMPLETION: virtual
163 // CHECK-CC3-NEXT: COMPLETION: void
164 // CHECK-CC3-NEXT: COMPLETION: volatile
165 // CHECK-CC3-NEXT: COMPLETION: wchar_t
166 // CHECK-CC3-NEXT: COMPLETION: X : X
168 // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:11 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
169 // CHECK-CC4: COMPLETION: bool
170 // CHECK-CC4-NEXT: COMPLETION: char
171 // CHECK-CC4-NEXT: COMPLETION: char16_t
172 // CHECK-CC4-NEXT: COMPLETION: char32_t
173 // CHECK-CC4-NEXT: COMPLETION: class
174 // CHECK-CC4-NEXT: COMPLETION: const
175 // CHECK-CC4-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
176 // CHECK-CC4-NEXT: COMPLETION: Pattern : decltype(<#expression#>)
177 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]delete <#expression#>
178 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
179 // CHECK-CC4-NEXT: COMPLETION: double
180 // CHECK-CC4-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
181 // CHECK-CC4-NEXT: COMPLETION: enum
182 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]false
183 // CHECK-CC4-NEXT: COMPLETION: float
184 // CHECK-CC4-NEXT: COMPLETION: foo : [#void#]foo()
185 // CHECK-CC4-NEXT: COMPLETION: int
186 // CHECK-CC4-NEXT: COMPLETION: long
187 // CHECK-CC4-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
188 // CHECK-CC4-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
189 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expression#>)
190 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#std::nullptr_t#]nullptr
191 // CHECK-CC4-NEXT: COMPLETION: operator
192 // CHECK-CC4-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
193 // CHECK-CC4-NEXT: COMPLETION: short
194 // CHECK-CC4-NEXT: COMPLETION: signed
195 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
196 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#size_t#]sizeof...(<#parameter-pack#>)
197 // CHECK-CC4-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
198 // CHECK-CC4-NEXT: COMPLETION: struct
199 // CHECK-CC4-NEXT: COMPLETION: t : t
200 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]throw <#expression#>
201 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]true
202 // CHECK-CC4-NEXT: COMPLETION: TYPEDEF : TYPEDEF
203 // CHECK-CC4-NEXT: COMPLETION: Pattern : [#std::type_info#]typeid(<#expression-or-type#>)
204 // CHECK-CC4-NEXT: COMPLETION: Pattern : typename <#name#>
205 // CHECK-CC4-NEXT: COMPLETION: Pattern : typeof <#expression#>
206 // CHECK-CC4-NEXT: COMPLETION: Pattern : typeof(<#type#>)
207 // CHECK-CC4-NEXT: COMPLETION: union
208 // CHECK-CC4-NEXT: COMPLETION: unsigned
209 // CHECK-CC4-NEXT: COMPLETION: void
210 // CHECK-CC4-NEXT: COMPLETION: volatile
211 // CHECK-CC4-NEXT: COMPLETION: wchar_t
212 // CHECK-CC4-NEXT: COMPLETION: X : X
213 // CHECK-CC4-NEXT: COMPLETION: z : [#void#]z(<#int#>)
215 // RUN: %clang_cc1 -fsyntax-only -fno-rtti -code-completion-patterns -code-completion-at=%s:6:14 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-NO-RTTI %s
216 // CHECK-NO-RTTI: COMPLETION: bool
217 // CHECK-NO-RTTI-NEXT: COMPLETION: char
218 // CHECK-NO-RTTI-NEXT: COMPLETION: char16_t
219 // CHECK-NO-RTTI-NEXT: COMPLETION: char32_t
220 // CHECK-NO-RTTI-NEXT: COMPLETION: class
221 // CHECK-NO-RTTI-NEXT: COMPLETION: const
222 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
223 // CHECK-NO-RTTI: COMPLETION: Pattern : [#void#]delete <#expression#>
224 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
225 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : do {
226 // CHECK-NO-RTTI-NEXT: <#statements#>
227 // CHECK-NO-RTTI-NEXT: }
228 // CHECK-NO-RTTI: COMPLETION: double
229 // CHECK-NO-RTTI-NOT: dynamic_cast
230 // CHECK-NO-RTTI: COMPLETION: enum
231 // CHECK-NO-RTTI-NEXT: COMPLETION: extern
232 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#bool#]false
233 // CHECK-NO-RTTI-NEXT: COMPLETION: float
234 // CHECK-NO-RTTI-NEXT: COMPLETION: foo : [#void#]foo()
235 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : for (<#init-statement#>; <#condition#>; <#inc-expression#>) {
236 // CHECK-NO-RTTI: COMPLETION: Pattern : goto <#label#>;
237 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : if (<#condition#>) {
238 // CHECK-NO-RTTI-NEXT: <#statements#>
239 // CHECK-NO-RTTI-NEXT: }
240 // CHECK-NO-RTTI: COMPLETION: int
241 // CHECK-NO-RTTI-NEXT: COMPLETION: long
242 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
243 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
244 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expression#>)
245 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#std::nullptr_t#]nullptr
246 // CHECK-NO-RTTI-NEXT: COMPLETION: operator
247 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
248 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : return;
249 // CHECK-NO-RTTI-NEXT: COMPLETION: short
250 // CHECK-NO-RTTI-NEXT: COMPLETION: signed
251 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
252 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#size_t#]sizeof...(<#parameter-pack#>)
253 // CHECK-NO-RTTI-NEXT: COMPLETION: static
254 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : static_assert(<#expression#>, <#message#>);
255 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
256 // CHECK-NO-RTTI-NEXT: COMPLETION: struct
257 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : switch (<#condition#>) {
258 // CHECK-NO-RTTI: COMPLETION: t : t
259 // CHECK-NO-RTTI-NOT: throw
260 // CHECK-NO-RTTI: COMPLETION: Pattern : [#bool#]true
261 // CHECK-NO-RTTI-NOT: try
262 // CHECK-NO-RTTI: COMPLETION: TYPEDEF : TYPEDEF
263 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>;
264 // CHECK-NO-RTTI-NOT: typeid
265 // CHECK-NO-RTTI: COMPLETION: Pattern : typename <#name#>
266 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof <#expression#>
267 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof(<#type#>)
268 // CHECK-NO-RTTI-NEXT: COMPLETION: union
269 // CHECK-NO-RTTI-NEXT: COMPLETION: unsigned
270 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : using <#name#> = <#type#>;
271 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
272 // CHECK-NO-RTTI-NEXT: COMPLETION: void
273 // CHECK-NO-RTTI-NEXT: COMPLETION: volatile
274 // CHECK-NO-RTTI-NEXT: COMPLETION: wchar_t
275 // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : while (<#condition#>) {
276 // CHECK-NO-RTTI: COMPLETION: X : X
277 // CHECK-NO-RTTI-NEXT: COMPLETION: y : [#int#]y
278 // CHECK-NO-RTTI-NEXT: COMPLETION: z : [#void#]z(<#int#>)