Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | |* *| |
||
3 | |* Attribute classes' member function definitions *| |
||
4 | |* *| |
||
5 | |* Automatically generated file, do not edit! *| |
||
6 | |* *| |
||
7 | \*===----------------------------------------------------------------------===*/ |
||
8 | |||
9 | static inline void DelimitAttributeArgument(raw_ostream& OS, bool& IsFirst) { |
||
10 | if (IsFirst) { |
||
11 | IsFirst = false; |
||
12 | OS << "("; |
||
13 | } else |
||
14 | OS << ", "; |
||
15 | } |
||
16 | |||
17 | // AArch64SVEPcsAttr implementation |
||
18 | |||
19 | AArch64SVEPcsAttr *AArch64SVEPcsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20 | auto *A = new (Ctx) AArch64SVEPcsAttr(Ctx, CommonInfo); |
||
21 | A->setImplicit(true); |
||
22 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23 | A->setAttributeSpellingListIndex(0); |
||
24 | return A; |
||
25 | } |
||
26 | |||
27 | AArch64SVEPcsAttr *AArch64SVEPcsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28 | auto *A = new (Ctx) AArch64SVEPcsAttr(Ctx, CommonInfo); |
||
29 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30 | A->setAttributeSpellingListIndex(0); |
||
31 | return A; |
||
32 | } |
||
33 | |||
34 | AArch64SVEPcsAttr *AArch64SVEPcsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
35 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
36 | return CreateImplicit(Ctx, I); |
||
37 | } |
||
38 | |||
39 | AArch64SVEPcsAttr *AArch64SVEPcsAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
40 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
41 | return Create(Ctx, I); |
||
42 | } |
||
43 | |||
44 | AArch64SVEPcsAttr::AArch64SVEPcsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
45 | ) |
||
46 | : InheritableAttr(Ctx, CommonInfo, attr::AArch64SVEPcs, false, false) |
||
47 | { |
||
48 | } |
||
49 | |||
50 | AArch64SVEPcsAttr *AArch64SVEPcsAttr::clone(ASTContext &C) const { |
||
51 | auto *A = new (C) AArch64SVEPcsAttr(C, *this); |
||
52 | A->Inherited = Inherited; |
||
53 | A->IsPackExpansion = IsPackExpansion; |
||
54 | A->setImplicit(Implicit); |
||
55 | return A; |
||
56 | } |
||
57 | |||
58 | void AArch64SVEPcsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
59 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
60 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
61 | switch (getAttributeSpellingListIndex()) { |
||
62 | default: |
||
63 | llvm_unreachable("Unknown attribute spelling!"); |
||
64 | break; |
||
65 | case 0 : { |
||
66 | OS << " __attribute__((aarch64_sve_pcs"; |
||
67 | OS << "))"; |
||
68 | break; |
||
69 | } |
||
70 | case 1 : { |
||
71 | OS << " [[clang::aarch64_sve_pcs"; |
||
72 | OS << "]]"; |
||
73 | break; |
||
74 | } |
||
75 | case 2 : { |
||
76 | OS << " [[clang::aarch64_sve_pcs"; |
||
77 | OS << "]]"; |
||
78 | break; |
||
79 | } |
||
80 | } |
||
81 | } |
||
82 | |||
83 | const char *AArch64SVEPcsAttr::getSpelling() const { |
||
84 | switch (getAttributeSpellingListIndex()) { |
||
85 | default: |
||
86 | llvm_unreachable("Unknown attribute spelling!"); |
||
87 | return "(No spelling)"; |
||
88 | case 0: |
||
89 | return "aarch64_sve_pcs"; |
||
90 | case 1: |
||
91 | return "aarch64_sve_pcs"; |
||
92 | case 2: |
||
93 | return "aarch64_sve_pcs"; |
||
94 | } |
||
95 | } |
||
96 | |||
97 | |||
98 | // AArch64VectorPcsAttr implementation |
||
99 | |||
100 | AArch64VectorPcsAttr *AArch64VectorPcsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
101 | auto *A = new (Ctx) AArch64VectorPcsAttr(Ctx, CommonInfo); |
||
102 | A->setImplicit(true); |
||
103 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
104 | A->setAttributeSpellingListIndex(0); |
||
105 | return A; |
||
106 | } |
||
107 | |||
108 | AArch64VectorPcsAttr *AArch64VectorPcsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
109 | auto *A = new (Ctx) AArch64VectorPcsAttr(Ctx, CommonInfo); |
||
110 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
111 | A->setAttributeSpellingListIndex(0); |
||
112 | return A; |
||
113 | } |
||
114 | |||
115 | AArch64VectorPcsAttr *AArch64VectorPcsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
116 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
117 | return CreateImplicit(Ctx, I); |
||
118 | } |
||
119 | |||
120 | AArch64VectorPcsAttr *AArch64VectorPcsAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
121 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
122 | return Create(Ctx, I); |
||
123 | } |
||
124 | |||
125 | AArch64VectorPcsAttr::AArch64VectorPcsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
126 | ) |
||
127 | : InheritableAttr(Ctx, CommonInfo, attr::AArch64VectorPcs, false, false) |
||
128 | { |
||
129 | } |
||
130 | |||
131 | AArch64VectorPcsAttr *AArch64VectorPcsAttr::clone(ASTContext &C) const { |
||
132 | auto *A = new (C) AArch64VectorPcsAttr(C, *this); |
||
133 | A->Inherited = Inherited; |
||
134 | A->IsPackExpansion = IsPackExpansion; |
||
135 | A->setImplicit(Implicit); |
||
136 | return A; |
||
137 | } |
||
138 | |||
139 | void AArch64VectorPcsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
140 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
141 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
142 | switch (getAttributeSpellingListIndex()) { |
||
143 | default: |
||
144 | llvm_unreachable("Unknown attribute spelling!"); |
||
145 | break; |
||
146 | case 0 : { |
||
147 | OS << " __attribute__((aarch64_vector_pcs"; |
||
148 | OS << "))"; |
||
149 | break; |
||
150 | } |
||
151 | case 1 : { |
||
152 | OS << " [[clang::aarch64_vector_pcs"; |
||
153 | OS << "]]"; |
||
154 | break; |
||
155 | } |
||
156 | case 2 : { |
||
157 | OS << " [[clang::aarch64_vector_pcs"; |
||
158 | OS << "]]"; |
||
159 | break; |
||
160 | } |
||
161 | } |
||
162 | } |
||
163 | |||
164 | const char *AArch64VectorPcsAttr::getSpelling() const { |
||
165 | switch (getAttributeSpellingListIndex()) { |
||
166 | default: |
||
167 | llvm_unreachable("Unknown attribute spelling!"); |
||
168 | return "(No spelling)"; |
||
169 | case 0: |
||
170 | return "aarch64_vector_pcs"; |
||
171 | case 1: |
||
172 | return "aarch64_vector_pcs"; |
||
173 | case 2: |
||
174 | return "aarch64_vector_pcs"; |
||
175 | } |
||
176 | } |
||
177 | |||
178 | |||
179 | // AMDGPUFlatWorkGroupSizeAttr implementation |
||
180 | |||
181 | AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) { |
||
182 | auto *A = new (Ctx) AMDGPUFlatWorkGroupSizeAttr(Ctx, CommonInfo, Min, Max); |
||
183 | A->setImplicit(true); |
||
184 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
185 | A->setAttributeSpellingListIndex(0); |
||
186 | return A; |
||
187 | } |
||
188 | |||
189 | AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) { |
||
190 | auto *A = new (Ctx) AMDGPUFlatWorkGroupSizeAttr(Ctx, CommonInfo, Min, Max); |
||
191 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
192 | A->setAttributeSpellingListIndex(0); |
||
193 | return A; |
||
194 | } |
||
195 | |||
196 | AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
197 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
198 | return CreateImplicit(Ctx, Min, Max, I); |
||
199 | } |
||
200 | |||
201 | AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
202 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
203 | return Create(Ctx, Min, Max, I); |
||
204 | } |
||
205 | |||
206 | AMDGPUFlatWorkGroupSizeAttr::AMDGPUFlatWorkGroupSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
207 | , Expr * Min |
||
208 | , Expr * Max |
||
209 | ) |
||
210 | : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUFlatWorkGroupSize, false, false) |
||
211 | , min(Min) |
||
212 | , max(Max) |
||
213 | { |
||
214 | } |
||
215 | |||
216 | |||
217 | |||
218 | |||
219 | |||
220 | AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::clone(ASTContext &C) const { |
||
221 | auto *A = new (C) AMDGPUFlatWorkGroupSizeAttr(C, *this, min, max); |
||
222 | A->Inherited = Inherited; |
||
223 | A->IsPackExpansion = IsPackExpansion; |
||
224 | A->setImplicit(Implicit); |
||
225 | return A; |
||
226 | } |
||
227 | |||
228 | void AMDGPUFlatWorkGroupSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
229 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
230 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
231 | switch (getAttributeSpellingListIndex()) { |
||
232 | default: |
||
233 | llvm_unreachable("Unknown attribute spelling!"); |
||
234 | break; |
||
235 | case 0 : { |
||
236 | OS << " __attribute__((amdgpu_flat_work_group_size"; |
||
237 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
238 | OS << ""; |
||
239 | getMin()->printPretty(OS, nullptr, Policy); |
||
240 | OS << ""; |
||
241 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
242 | OS << ""; |
||
243 | getMax()->printPretty(OS, nullptr, Policy); |
||
244 | OS << ""; |
||
245 | if (!IsFirstArgument) |
||
246 | OS << ")"; |
||
247 | OS << "))"; |
||
248 | break; |
||
249 | } |
||
250 | case 1 : { |
||
251 | OS << " [[clang::amdgpu_flat_work_group_size"; |
||
252 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
253 | OS << ""; |
||
254 | getMin()->printPretty(OS, nullptr, Policy); |
||
255 | OS << ""; |
||
256 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
257 | OS << ""; |
||
258 | getMax()->printPretty(OS, nullptr, Policy); |
||
259 | OS << ""; |
||
260 | if (!IsFirstArgument) |
||
261 | OS << ")"; |
||
262 | OS << "]]"; |
||
263 | break; |
||
264 | } |
||
265 | } |
||
266 | } |
||
267 | |||
268 | const char *AMDGPUFlatWorkGroupSizeAttr::getSpelling() const { |
||
269 | switch (getAttributeSpellingListIndex()) { |
||
270 | default: |
||
271 | llvm_unreachable("Unknown attribute spelling!"); |
||
272 | return "(No spelling)"; |
||
273 | case 0: |
||
274 | return "amdgpu_flat_work_group_size"; |
||
275 | case 1: |
||
276 | return "amdgpu_flat_work_group_size"; |
||
277 | } |
||
278 | } |
||
279 | |||
280 | |||
281 | // AMDGPUKernelCallAttr implementation |
||
282 | |||
283 | AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
284 | auto *A = new (Ctx) AMDGPUKernelCallAttr(Ctx, CommonInfo); |
||
285 | A->setImplicit(true); |
||
286 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
287 | A->setAttributeSpellingListIndex(0); |
||
288 | return A; |
||
289 | } |
||
290 | |||
291 | AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
292 | auto *A = new (Ctx) AMDGPUKernelCallAttr(Ctx, CommonInfo); |
||
293 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
294 | A->setAttributeSpellingListIndex(0); |
||
295 | return A; |
||
296 | } |
||
297 | |||
298 | AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
299 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
300 | return CreateImplicit(Ctx, I); |
||
301 | } |
||
302 | |||
303 | AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
304 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
305 | return Create(Ctx, I); |
||
306 | } |
||
307 | |||
308 | AMDGPUKernelCallAttr::AMDGPUKernelCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
309 | ) |
||
310 | : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUKernelCall, false, false) |
||
311 | { |
||
312 | } |
||
313 | |||
314 | AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::clone(ASTContext &C) const { |
||
315 | auto *A = new (C) AMDGPUKernelCallAttr(C, *this); |
||
316 | A->Inherited = Inherited; |
||
317 | A->IsPackExpansion = IsPackExpansion; |
||
318 | A->setImplicit(Implicit); |
||
319 | return A; |
||
320 | } |
||
321 | |||
322 | void AMDGPUKernelCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
323 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
324 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
325 | switch (getAttributeSpellingListIndex()) { |
||
326 | default: |
||
327 | llvm_unreachable("Unknown attribute spelling!"); |
||
328 | break; |
||
329 | case 0 : { |
||
330 | OS << " __attribute__((amdgpu_kernel"; |
||
331 | OS << "))"; |
||
332 | break; |
||
333 | } |
||
334 | case 1 : { |
||
335 | OS << " [[clang::amdgpu_kernel"; |
||
336 | OS << "]]"; |
||
337 | break; |
||
338 | } |
||
339 | case 2 : { |
||
340 | OS << " [[clang::amdgpu_kernel"; |
||
341 | OS << "]]"; |
||
342 | break; |
||
343 | } |
||
344 | } |
||
345 | } |
||
346 | |||
347 | const char *AMDGPUKernelCallAttr::getSpelling() const { |
||
348 | switch (getAttributeSpellingListIndex()) { |
||
349 | default: |
||
350 | llvm_unreachable("Unknown attribute spelling!"); |
||
351 | return "(No spelling)"; |
||
352 | case 0: |
||
353 | return "amdgpu_kernel"; |
||
354 | case 1: |
||
355 | return "amdgpu_kernel"; |
||
356 | case 2: |
||
357 | return "amdgpu_kernel"; |
||
358 | } |
||
359 | } |
||
360 | |||
361 | |||
362 | // AMDGPUNumSGPRAttr implementation |
||
363 | |||
364 | AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumSGPR, const AttributeCommonInfo &CommonInfo) { |
||
365 | auto *A = new (Ctx) AMDGPUNumSGPRAttr(Ctx, CommonInfo, NumSGPR); |
||
366 | A->setImplicit(true); |
||
367 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
368 | A->setAttributeSpellingListIndex(0); |
||
369 | return A; |
||
370 | } |
||
371 | |||
372 | AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::Create(ASTContext &Ctx, unsigned NumSGPR, const AttributeCommonInfo &CommonInfo) { |
||
373 | auto *A = new (Ctx) AMDGPUNumSGPRAttr(Ctx, CommonInfo, NumSGPR); |
||
374 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
375 | A->setAttributeSpellingListIndex(0); |
||
376 | return A; |
||
377 | } |
||
378 | |||
379 | AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumSGPR, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
380 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
381 | return CreateImplicit(Ctx, NumSGPR, I); |
||
382 | } |
||
383 | |||
384 | AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::Create(ASTContext &Ctx, unsigned NumSGPR, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
385 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
386 | return Create(Ctx, NumSGPR, I); |
||
387 | } |
||
388 | |||
389 | AMDGPUNumSGPRAttr::AMDGPUNumSGPRAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
390 | , unsigned NumSGPR |
||
391 | ) |
||
392 | : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUNumSGPR, false, false) |
||
393 | , numSGPR(NumSGPR) |
||
394 | { |
||
395 | } |
||
396 | |||
397 | |||
398 | |||
399 | AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::clone(ASTContext &C) const { |
||
400 | auto *A = new (C) AMDGPUNumSGPRAttr(C, *this, numSGPR); |
||
401 | A->Inherited = Inherited; |
||
402 | A->IsPackExpansion = IsPackExpansion; |
||
403 | A->setImplicit(Implicit); |
||
404 | return A; |
||
405 | } |
||
406 | |||
407 | void AMDGPUNumSGPRAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
408 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
409 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
410 | switch (getAttributeSpellingListIndex()) { |
||
411 | default: |
||
412 | llvm_unreachable("Unknown attribute spelling!"); |
||
413 | break; |
||
414 | case 0 : { |
||
415 | OS << " __attribute__((amdgpu_num_sgpr"; |
||
416 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
417 | OS << "" << getNumSGPR() << ""; |
||
418 | if (!IsFirstArgument) |
||
419 | OS << ")"; |
||
420 | OS << "))"; |
||
421 | break; |
||
422 | } |
||
423 | case 1 : { |
||
424 | OS << " [[clang::amdgpu_num_sgpr"; |
||
425 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
426 | OS << "" << getNumSGPR() << ""; |
||
427 | if (!IsFirstArgument) |
||
428 | OS << ")"; |
||
429 | OS << "]]"; |
||
430 | break; |
||
431 | } |
||
432 | } |
||
433 | } |
||
434 | |||
435 | const char *AMDGPUNumSGPRAttr::getSpelling() const { |
||
436 | switch (getAttributeSpellingListIndex()) { |
||
437 | default: |
||
438 | llvm_unreachable("Unknown attribute spelling!"); |
||
439 | return "(No spelling)"; |
||
440 | case 0: |
||
441 | return "amdgpu_num_sgpr"; |
||
442 | case 1: |
||
443 | return "amdgpu_num_sgpr"; |
||
444 | } |
||
445 | } |
||
446 | |||
447 | |||
448 | // AMDGPUNumVGPRAttr implementation |
||
449 | |||
450 | AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumVGPR, const AttributeCommonInfo &CommonInfo) { |
||
451 | auto *A = new (Ctx) AMDGPUNumVGPRAttr(Ctx, CommonInfo, NumVGPR); |
||
452 | A->setImplicit(true); |
||
453 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
454 | A->setAttributeSpellingListIndex(0); |
||
455 | return A; |
||
456 | } |
||
457 | |||
458 | AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::Create(ASTContext &Ctx, unsigned NumVGPR, const AttributeCommonInfo &CommonInfo) { |
||
459 | auto *A = new (Ctx) AMDGPUNumVGPRAttr(Ctx, CommonInfo, NumVGPR); |
||
460 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
461 | A->setAttributeSpellingListIndex(0); |
||
462 | return A; |
||
463 | } |
||
464 | |||
465 | AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumVGPR, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
466 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
467 | return CreateImplicit(Ctx, NumVGPR, I); |
||
468 | } |
||
469 | |||
470 | AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::Create(ASTContext &Ctx, unsigned NumVGPR, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
471 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
472 | return Create(Ctx, NumVGPR, I); |
||
473 | } |
||
474 | |||
475 | AMDGPUNumVGPRAttr::AMDGPUNumVGPRAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
476 | , unsigned NumVGPR |
||
477 | ) |
||
478 | : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUNumVGPR, false, false) |
||
479 | , numVGPR(NumVGPR) |
||
480 | { |
||
481 | } |
||
482 | |||
483 | |||
484 | |||
485 | AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::clone(ASTContext &C) const { |
||
486 | auto *A = new (C) AMDGPUNumVGPRAttr(C, *this, numVGPR); |
||
487 | A->Inherited = Inherited; |
||
488 | A->IsPackExpansion = IsPackExpansion; |
||
489 | A->setImplicit(Implicit); |
||
490 | return A; |
||
491 | } |
||
492 | |||
493 | void AMDGPUNumVGPRAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
494 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
495 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
496 | switch (getAttributeSpellingListIndex()) { |
||
497 | default: |
||
498 | llvm_unreachable("Unknown attribute spelling!"); |
||
499 | break; |
||
500 | case 0 : { |
||
501 | OS << " __attribute__((amdgpu_num_vgpr"; |
||
502 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
503 | OS << "" << getNumVGPR() << ""; |
||
504 | if (!IsFirstArgument) |
||
505 | OS << ")"; |
||
506 | OS << "))"; |
||
507 | break; |
||
508 | } |
||
509 | case 1 : { |
||
510 | OS << " [[clang::amdgpu_num_vgpr"; |
||
511 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
512 | OS << "" << getNumVGPR() << ""; |
||
513 | if (!IsFirstArgument) |
||
514 | OS << ")"; |
||
515 | OS << "]]"; |
||
516 | break; |
||
517 | } |
||
518 | } |
||
519 | } |
||
520 | |||
521 | const char *AMDGPUNumVGPRAttr::getSpelling() const { |
||
522 | switch (getAttributeSpellingListIndex()) { |
||
523 | default: |
||
524 | llvm_unreachable("Unknown attribute spelling!"); |
||
525 | return "(No spelling)"; |
||
526 | case 0: |
||
527 | return "amdgpu_num_vgpr"; |
||
528 | case 1: |
||
529 | return "amdgpu_num_vgpr"; |
||
530 | } |
||
531 | } |
||
532 | |||
533 | |||
534 | // AMDGPUWavesPerEUAttr implementation |
||
535 | |||
536 | AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) { |
||
537 | auto *A = new (Ctx) AMDGPUWavesPerEUAttr(Ctx, CommonInfo, Min, Max); |
||
538 | A->setImplicit(true); |
||
539 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
540 | A->setAttributeSpellingListIndex(0); |
||
541 | return A; |
||
542 | } |
||
543 | |||
544 | AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) { |
||
545 | auto *A = new (Ctx) AMDGPUWavesPerEUAttr(Ctx, CommonInfo, Min, Max); |
||
546 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
547 | A->setAttributeSpellingListIndex(0); |
||
548 | return A; |
||
549 | } |
||
550 | |||
551 | AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
552 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
553 | return CreateImplicit(Ctx, Min, Max, I); |
||
554 | } |
||
555 | |||
556 | AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
557 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
558 | return Create(Ctx, Min, Max, I); |
||
559 | } |
||
560 | |||
561 | AMDGPUWavesPerEUAttr::AMDGPUWavesPerEUAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
562 | , Expr * Min |
||
563 | , Expr * Max |
||
564 | ) |
||
565 | : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUWavesPerEU, false, false) |
||
566 | , min(Min) |
||
567 | , max(Max) |
||
568 | { |
||
569 | } |
||
570 | |||
571 | AMDGPUWavesPerEUAttr::AMDGPUWavesPerEUAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
572 | , Expr * Min |
||
573 | ) |
||
574 | : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUWavesPerEU, false, false) |
||
575 | , min(Min) |
||
576 | , max() |
||
577 | { |
||
578 | } |
||
579 | |||
580 | |||
581 | |||
582 | |||
583 | |||
584 | AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::clone(ASTContext &C) const { |
||
585 | auto *A = new (C) AMDGPUWavesPerEUAttr(C, *this, min, max); |
||
586 | A->Inherited = Inherited; |
||
587 | A->IsPackExpansion = IsPackExpansion; |
||
588 | A->setImplicit(Implicit); |
||
589 | return A; |
||
590 | } |
||
591 | |||
592 | void AMDGPUWavesPerEUAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
593 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
594 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
595 | switch (getAttributeSpellingListIndex()) { |
||
596 | default: |
||
597 | llvm_unreachable("Unknown attribute spelling!"); |
||
598 | break; |
||
599 | case 0 : { |
||
600 | OS << " __attribute__((amdgpu_waves_per_eu"; |
||
601 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
602 | OS << ""; |
||
603 | getMin()->printPretty(OS, nullptr, Policy); |
||
604 | OS << ""; |
||
605 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
606 | OS << ""; |
||
607 | getMax()->printPretty(OS, nullptr, Policy); |
||
608 | OS << ""; |
||
609 | if (!IsFirstArgument) |
||
610 | OS << ")"; |
||
611 | OS << "))"; |
||
612 | break; |
||
613 | } |
||
614 | case 1 : { |
||
615 | OS << " [[clang::amdgpu_waves_per_eu"; |
||
616 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
617 | OS << ""; |
||
618 | getMin()->printPretty(OS, nullptr, Policy); |
||
619 | OS << ""; |
||
620 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
621 | OS << ""; |
||
622 | getMax()->printPretty(OS, nullptr, Policy); |
||
623 | OS << ""; |
||
624 | if (!IsFirstArgument) |
||
625 | OS << ")"; |
||
626 | OS << "]]"; |
||
627 | break; |
||
628 | } |
||
629 | } |
||
630 | } |
||
631 | |||
632 | const char *AMDGPUWavesPerEUAttr::getSpelling() const { |
||
633 | switch (getAttributeSpellingListIndex()) { |
||
634 | default: |
||
635 | llvm_unreachable("Unknown attribute spelling!"); |
||
636 | return "(No spelling)"; |
||
637 | case 0: |
||
638 | return "amdgpu_waves_per_eu"; |
||
639 | case 1: |
||
640 | return "amdgpu_waves_per_eu"; |
||
641 | } |
||
642 | } |
||
643 | |||
644 | |||
645 | // ARMInterruptAttr implementation |
||
646 | |||
647 | ARMInterruptAttr *ARMInterruptAttr::CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { |
||
648 | auto *A = new (Ctx) ARMInterruptAttr(Ctx, CommonInfo, Interrupt); |
||
649 | A->setImplicit(true); |
||
650 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
651 | A->setAttributeSpellingListIndex(0); |
||
652 | return A; |
||
653 | } |
||
654 | |||
655 | ARMInterruptAttr *ARMInterruptAttr::Create(ASTContext &Ctx, InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { |
||
656 | auto *A = new (Ctx) ARMInterruptAttr(Ctx, CommonInfo, Interrupt); |
||
657 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
658 | A->setAttributeSpellingListIndex(0); |
||
659 | return A; |
||
660 | } |
||
661 | |||
662 | ARMInterruptAttr *ARMInterruptAttr::CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
663 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
664 | return CreateImplicit(Ctx, Interrupt, I); |
||
665 | } |
||
666 | |||
667 | ARMInterruptAttr *ARMInterruptAttr::Create(ASTContext &Ctx, InterruptType Interrupt, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
668 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
669 | return Create(Ctx, Interrupt, I); |
||
670 | } |
||
671 | |||
672 | ARMInterruptAttr::ARMInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
673 | , InterruptType Interrupt |
||
674 | ) |
||
675 | : InheritableAttr(Ctx, CommonInfo, attr::ARMInterrupt, false, false) |
||
676 | , interrupt(Interrupt) |
||
677 | { |
||
678 | } |
||
679 | |||
680 | ARMInterruptAttr::ARMInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
681 | ) |
||
682 | : InheritableAttr(Ctx, CommonInfo, attr::ARMInterrupt, false, false) |
||
683 | , interrupt(InterruptType(0)) |
||
684 | { |
||
685 | } |
||
686 | |||
687 | |||
688 | |||
689 | bool ARMInterruptAttr::ConvertStrToInterruptType(StringRef Val, InterruptType &Out) { |
||
690 | std::optional<InterruptType> R = llvm::StringSwitch<std::optional<InterruptType>>(Val) |
||
691 | .Case("IRQ", ARMInterruptAttr::IRQ) |
||
692 | .Case("FIQ", ARMInterruptAttr::FIQ) |
||
693 | .Case("SWI", ARMInterruptAttr::SWI) |
||
694 | .Case("ABORT", ARMInterruptAttr::ABORT) |
||
695 | .Case("UNDEF", ARMInterruptAttr::UNDEF) |
||
696 | .Case("", ARMInterruptAttr::Generic) |
||
697 | .Default(std::optional<InterruptType>()); |
||
698 | if (R) { |
||
699 | Out = *R; |
||
700 | return true; |
||
701 | } |
||
702 | return false; |
||
703 | } |
||
704 | |||
705 | const char *ARMInterruptAttr::ConvertInterruptTypeToStr(InterruptType Val) { |
||
706 | switch(Val) { |
||
707 | case ARMInterruptAttr::IRQ: return "IRQ"; |
||
708 | case ARMInterruptAttr::FIQ: return "FIQ"; |
||
709 | case ARMInterruptAttr::SWI: return "SWI"; |
||
710 | case ARMInterruptAttr::ABORT: return "ABORT"; |
||
711 | case ARMInterruptAttr::UNDEF: return "UNDEF"; |
||
712 | case ARMInterruptAttr::Generic: return ""; |
||
713 | } |
||
714 | llvm_unreachable("No enumerator with that value"); |
||
715 | } |
||
716 | ARMInterruptAttr *ARMInterruptAttr::clone(ASTContext &C) const { |
||
717 | auto *A = new (C) ARMInterruptAttr(C, *this, interrupt); |
||
718 | A->Inherited = Inherited; |
||
719 | A->IsPackExpansion = IsPackExpansion; |
||
720 | A->setImplicit(Implicit); |
||
721 | return A; |
||
722 | } |
||
723 | |||
724 | void ARMInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
725 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
726 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
727 | switch (getAttributeSpellingListIndex()) { |
||
728 | default: |
||
729 | llvm_unreachable("Unknown attribute spelling!"); |
||
730 | break; |
||
731 | case 0 : { |
||
732 | OS << " __attribute__((interrupt"; |
||
733 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
734 | OS << "\"" << ARMInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; |
||
735 | if (!IsFirstArgument) |
||
736 | OS << ")"; |
||
737 | OS << "))"; |
||
738 | break; |
||
739 | } |
||
740 | case 1 : { |
||
741 | OS << " [[gnu::interrupt"; |
||
742 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
743 | OS << "\"" << ARMInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; |
||
744 | if (!IsFirstArgument) |
||
745 | OS << ")"; |
||
746 | OS << "]]"; |
||
747 | break; |
||
748 | } |
||
749 | case 2 : { |
||
750 | OS << " [[gnu::interrupt"; |
||
751 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
752 | OS << "\"" << ARMInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; |
||
753 | if (!IsFirstArgument) |
||
754 | OS << ")"; |
||
755 | OS << "]]"; |
||
756 | break; |
||
757 | } |
||
758 | } |
||
759 | } |
||
760 | |||
761 | const char *ARMInterruptAttr::getSpelling() const { |
||
762 | switch (getAttributeSpellingListIndex()) { |
||
763 | default: |
||
764 | llvm_unreachable("Unknown attribute spelling!"); |
||
765 | return "(No spelling)"; |
||
766 | case 0: |
||
767 | return "interrupt"; |
||
768 | case 1: |
||
769 | return "interrupt"; |
||
770 | case 2: |
||
771 | return "interrupt"; |
||
772 | } |
||
773 | } |
||
774 | |||
775 | |||
776 | // AVRInterruptAttr implementation |
||
777 | |||
778 | AVRInterruptAttr *AVRInterruptAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
779 | auto *A = new (Ctx) AVRInterruptAttr(Ctx, CommonInfo); |
||
780 | A->setImplicit(true); |
||
781 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
782 | A->setAttributeSpellingListIndex(0); |
||
783 | return A; |
||
784 | } |
||
785 | |||
786 | AVRInterruptAttr *AVRInterruptAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
787 | auto *A = new (Ctx) AVRInterruptAttr(Ctx, CommonInfo); |
||
788 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
789 | A->setAttributeSpellingListIndex(0); |
||
790 | return A; |
||
791 | } |
||
792 | |||
793 | AVRInterruptAttr *AVRInterruptAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
794 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
795 | return CreateImplicit(Ctx, I); |
||
796 | } |
||
797 | |||
798 | AVRInterruptAttr *AVRInterruptAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
799 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
800 | return Create(Ctx, I); |
||
801 | } |
||
802 | |||
803 | AVRInterruptAttr::AVRInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
804 | ) |
||
805 | : InheritableAttr(Ctx, CommonInfo, attr::AVRInterrupt, false, false) |
||
806 | { |
||
807 | } |
||
808 | |||
809 | AVRInterruptAttr *AVRInterruptAttr::clone(ASTContext &C) const { |
||
810 | auto *A = new (C) AVRInterruptAttr(C, *this); |
||
811 | A->Inherited = Inherited; |
||
812 | A->IsPackExpansion = IsPackExpansion; |
||
813 | A->setImplicit(Implicit); |
||
814 | return A; |
||
815 | } |
||
816 | |||
817 | void AVRInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
818 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
819 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
820 | switch (getAttributeSpellingListIndex()) { |
||
821 | default: |
||
822 | llvm_unreachable("Unknown attribute spelling!"); |
||
823 | break; |
||
824 | case 0 : { |
||
825 | OS << " __attribute__((interrupt"; |
||
826 | OS << "))"; |
||
827 | break; |
||
828 | } |
||
829 | case 1 : { |
||
830 | OS << " [[gnu::interrupt"; |
||
831 | OS << "]]"; |
||
832 | break; |
||
833 | } |
||
834 | case 2 : { |
||
835 | OS << " [[gnu::interrupt"; |
||
836 | OS << "]]"; |
||
837 | break; |
||
838 | } |
||
839 | } |
||
840 | } |
||
841 | |||
842 | const char *AVRInterruptAttr::getSpelling() const { |
||
843 | switch (getAttributeSpellingListIndex()) { |
||
844 | default: |
||
845 | llvm_unreachable("Unknown attribute spelling!"); |
||
846 | return "(No spelling)"; |
||
847 | case 0: |
||
848 | return "interrupt"; |
||
849 | case 1: |
||
850 | return "interrupt"; |
||
851 | case 2: |
||
852 | return "interrupt"; |
||
853 | } |
||
854 | } |
||
855 | |||
856 | |||
857 | // AVRSignalAttr implementation |
||
858 | |||
859 | AVRSignalAttr *AVRSignalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
860 | auto *A = new (Ctx) AVRSignalAttr(Ctx, CommonInfo); |
||
861 | A->setImplicit(true); |
||
862 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
863 | A->setAttributeSpellingListIndex(0); |
||
864 | return A; |
||
865 | } |
||
866 | |||
867 | AVRSignalAttr *AVRSignalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
868 | auto *A = new (Ctx) AVRSignalAttr(Ctx, CommonInfo); |
||
869 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
870 | A->setAttributeSpellingListIndex(0); |
||
871 | return A; |
||
872 | } |
||
873 | |||
874 | AVRSignalAttr *AVRSignalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
875 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
876 | return CreateImplicit(Ctx, I); |
||
877 | } |
||
878 | |||
879 | AVRSignalAttr *AVRSignalAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
880 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
881 | return Create(Ctx, I); |
||
882 | } |
||
883 | |||
884 | AVRSignalAttr::AVRSignalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
885 | ) |
||
886 | : InheritableAttr(Ctx, CommonInfo, attr::AVRSignal, false, false) |
||
887 | { |
||
888 | } |
||
889 | |||
890 | AVRSignalAttr *AVRSignalAttr::clone(ASTContext &C) const { |
||
891 | auto *A = new (C) AVRSignalAttr(C, *this); |
||
892 | A->Inherited = Inherited; |
||
893 | A->IsPackExpansion = IsPackExpansion; |
||
894 | A->setImplicit(Implicit); |
||
895 | return A; |
||
896 | } |
||
897 | |||
898 | void AVRSignalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
899 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
900 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
901 | switch (getAttributeSpellingListIndex()) { |
||
902 | default: |
||
903 | llvm_unreachable("Unknown attribute spelling!"); |
||
904 | break; |
||
905 | case 0 : { |
||
906 | OS << " __attribute__((signal"; |
||
907 | OS << "))"; |
||
908 | break; |
||
909 | } |
||
910 | case 1 : { |
||
911 | OS << " [[gnu::signal"; |
||
912 | OS << "]]"; |
||
913 | break; |
||
914 | } |
||
915 | case 2 : { |
||
916 | OS << " [[gnu::signal"; |
||
917 | OS << "]]"; |
||
918 | break; |
||
919 | } |
||
920 | } |
||
921 | } |
||
922 | |||
923 | const char *AVRSignalAttr::getSpelling() const { |
||
924 | switch (getAttributeSpellingListIndex()) { |
||
925 | default: |
||
926 | llvm_unreachable("Unknown attribute spelling!"); |
||
927 | return "(No spelling)"; |
||
928 | case 0: |
||
929 | return "signal"; |
||
930 | case 1: |
||
931 | return "signal"; |
||
932 | case 2: |
||
933 | return "signal"; |
||
934 | } |
||
935 | } |
||
936 | |||
937 | |||
938 | // AbiTagAttr implementation |
||
939 | |||
940 | AbiTagAttr *AbiTagAttr::CreateImplicit(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, const AttributeCommonInfo &CommonInfo) { |
||
941 | auto *A = new (Ctx) AbiTagAttr(Ctx, CommonInfo, Tags, TagsSize); |
||
942 | A->setImplicit(true); |
||
943 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
944 | A->setAttributeSpellingListIndex(0); |
||
945 | return A; |
||
946 | } |
||
947 | |||
948 | AbiTagAttr *AbiTagAttr::Create(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, const AttributeCommonInfo &CommonInfo) { |
||
949 | auto *A = new (Ctx) AbiTagAttr(Ctx, CommonInfo, Tags, TagsSize); |
||
950 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
951 | A->setAttributeSpellingListIndex(0); |
||
952 | return A; |
||
953 | } |
||
954 | |||
955 | AbiTagAttr *AbiTagAttr::CreateImplicit(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
956 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
957 | return CreateImplicit(Ctx, Tags, TagsSize, I); |
||
958 | } |
||
959 | |||
960 | AbiTagAttr *AbiTagAttr::Create(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
961 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
962 | return Create(Ctx, Tags, TagsSize, I); |
||
963 | } |
||
964 | |||
965 | AbiTagAttr::AbiTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
966 | , StringRef *Tags, unsigned TagsSize |
||
967 | ) |
||
968 | : Attr(Ctx, CommonInfo, attr::AbiTag, false) |
||
969 | , tags_Size(TagsSize), tags_(new (Ctx, 16) StringRef[tags_Size]) |
||
970 | { |
||
971 | for (size_t I = 0, E = tags_Size; I != E; |
||
972 | ++I) { |
||
973 | StringRef Ref = Tags[I]; |
||
974 | if (!Ref.empty()) { |
||
975 | char *Mem = new (Ctx, 1) char[Ref.size()]; |
||
976 | std::memcpy(Mem, Ref.data(), Ref.size()); |
||
977 | tags_[I] = StringRef(Mem, Ref.size()); |
||
978 | } |
||
979 | } |
||
980 | } |
||
981 | |||
982 | AbiTagAttr::AbiTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
983 | ) |
||
984 | : Attr(Ctx, CommonInfo, attr::AbiTag, false) |
||
985 | , tags_Size(0), tags_(nullptr) |
||
986 | { |
||
987 | } |
||
988 | |||
989 | |||
990 | |||
991 | AbiTagAttr *AbiTagAttr::clone(ASTContext &C) const { |
||
992 | auto *A = new (C) AbiTagAttr(C, *this, tags_, tags_Size); |
||
993 | A->Inherited = Inherited; |
||
994 | A->IsPackExpansion = IsPackExpansion; |
||
995 | A->setImplicit(Implicit); |
||
996 | return A; |
||
997 | } |
||
998 | |||
999 | void AbiTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1000 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
1001 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
1002 | switch (getAttributeSpellingListIndex()) { |
||
1003 | default: |
||
1004 | llvm_unreachable("Unknown attribute spelling!"); |
||
1005 | break; |
||
1006 | case 0 : { |
||
1007 | OS << " __attribute__((abi_tag"; |
||
1008 | OS << ""; |
||
1009 | for (const auto &Val : tags()) { |
||
1010 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1011 | OS << "\"" << Val << "\""; |
||
1012 | } |
||
1013 | OS << ""; |
||
1014 | if (!IsFirstArgument) |
||
1015 | OS << ")"; |
||
1016 | OS << "))"; |
||
1017 | break; |
||
1018 | } |
||
1019 | case 1 : { |
||
1020 | OS << " [[gnu::abi_tag"; |
||
1021 | OS << ""; |
||
1022 | for (const auto &Val : tags()) { |
||
1023 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1024 | OS << "\"" << Val << "\""; |
||
1025 | } |
||
1026 | OS << ""; |
||
1027 | if (!IsFirstArgument) |
||
1028 | OS << ")"; |
||
1029 | OS << "]]"; |
||
1030 | break; |
||
1031 | } |
||
1032 | } |
||
1033 | } |
||
1034 | |||
1035 | const char *AbiTagAttr::getSpelling() const { |
||
1036 | switch (getAttributeSpellingListIndex()) { |
||
1037 | default: |
||
1038 | llvm_unreachable("Unknown attribute spelling!"); |
||
1039 | return "(No spelling)"; |
||
1040 | case 0: |
||
1041 | return "abi_tag"; |
||
1042 | case 1: |
||
1043 | return "abi_tag"; |
||
1044 | } |
||
1045 | } |
||
1046 | |||
1047 | |||
1048 | // AcquireCapabilityAttr implementation |
||
1049 | |||
1050 | AcquireCapabilityAttr *AcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
1051 | auto *A = new (Ctx) AcquireCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
1052 | A->setImplicit(true); |
||
1053 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1054 | A->setAttributeSpellingListIndex(0); |
||
1055 | return A; |
||
1056 | } |
||
1057 | |||
1058 | AcquireCapabilityAttr *AcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
1059 | auto *A = new (Ctx) AcquireCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
1060 | return A; |
||
1061 | } |
||
1062 | |||
1063 | AcquireCapabilityAttr *AcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, AcquireCapabilityAttr::Spelling S) { |
||
1064 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
1065 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
1066 | } |
||
1067 | |||
1068 | AcquireCapabilityAttr *AcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, AcquireCapabilityAttr::Spelling S) { |
||
1069 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
1070 | return Create(Ctx, Args, ArgsSize, I); |
||
1071 | } |
||
1072 | |||
1073 | AcquireCapabilityAttr::AcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1074 | , Expr * *Args, unsigned ArgsSize |
||
1075 | ) |
||
1076 | : InheritableAttr(Ctx, CommonInfo, attr::AcquireCapability, true, true) |
||
1077 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
1078 | { |
||
1079 | std::copy(Args, Args + args_Size, args_); |
||
1080 | } |
||
1081 | |||
1082 | AcquireCapabilityAttr::AcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1083 | ) |
||
1084 | : InheritableAttr(Ctx, CommonInfo, attr::AcquireCapability, true, true) |
||
1085 | , args_Size(0), args_(nullptr) |
||
1086 | { |
||
1087 | } |
||
1088 | |||
1089 | AcquireCapabilityAttr::Spelling AcquireCapabilityAttr::getSemanticSpelling() const { |
||
1090 | switch (getAttributeSpellingListIndex()) { |
||
1091 | default: llvm_unreachable("Unknown spelling list index"); |
||
1092 | case 0: return GNU_acquire_capability; |
||
1093 | case 1: return CXX11_clang_acquire_capability; |
||
1094 | case 2: return GNU_acquire_shared_capability; |
||
1095 | case 3: return CXX11_clang_acquire_shared_capability; |
||
1096 | case 4: return GNU_exclusive_lock_function; |
||
1097 | case 5: return GNU_shared_lock_function; |
||
1098 | } |
||
1099 | } |
||
1100 | |||
1101 | |||
1102 | AcquireCapabilityAttr *AcquireCapabilityAttr::clone(ASTContext &C) const { |
||
1103 | auto *A = new (C) AcquireCapabilityAttr(C, *this, args_, args_Size); |
||
1104 | A->Inherited = Inherited; |
||
1105 | A->IsPackExpansion = IsPackExpansion; |
||
1106 | A->setImplicit(Implicit); |
||
1107 | return A; |
||
1108 | } |
||
1109 | |||
1110 | void AcquireCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1111 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
1112 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
1113 | switch (getAttributeSpellingListIndex()) { |
||
1114 | default: |
||
1115 | llvm_unreachable("Unknown attribute spelling!"); |
||
1116 | break; |
||
1117 | case 0 : { |
||
1118 | OS << " __attribute__((acquire_capability"; |
||
1119 | OS << ""; |
||
1120 | for (const auto &Val : args()) { |
||
1121 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1122 | OS << Val; |
||
1123 | } |
||
1124 | OS << ""; |
||
1125 | if (!IsFirstArgument) |
||
1126 | OS << ")"; |
||
1127 | OS << "))"; |
||
1128 | break; |
||
1129 | } |
||
1130 | case 1 : { |
||
1131 | OS << " [[clang::acquire_capability"; |
||
1132 | OS << ""; |
||
1133 | for (const auto &Val : args()) { |
||
1134 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1135 | OS << Val; |
||
1136 | } |
||
1137 | OS << ""; |
||
1138 | if (!IsFirstArgument) |
||
1139 | OS << ")"; |
||
1140 | OS << "]]"; |
||
1141 | break; |
||
1142 | } |
||
1143 | case 2 : { |
||
1144 | OS << " __attribute__((acquire_shared_capability"; |
||
1145 | OS << ""; |
||
1146 | for (const auto &Val : args()) { |
||
1147 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1148 | OS << Val; |
||
1149 | } |
||
1150 | OS << ""; |
||
1151 | if (!IsFirstArgument) |
||
1152 | OS << ")"; |
||
1153 | OS << "))"; |
||
1154 | break; |
||
1155 | } |
||
1156 | case 3 : { |
||
1157 | OS << " [[clang::acquire_shared_capability"; |
||
1158 | OS << ""; |
||
1159 | for (const auto &Val : args()) { |
||
1160 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1161 | OS << Val; |
||
1162 | } |
||
1163 | OS << ""; |
||
1164 | if (!IsFirstArgument) |
||
1165 | OS << ")"; |
||
1166 | OS << "]]"; |
||
1167 | break; |
||
1168 | } |
||
1169 | case 4 : { |
||
1170 | OS << " __attribute__((exclusive_lock_function"; |
||
1171 | OS << ""; |
||
1172 | for (const auto &Val : args()) { |
||
1173 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1174 | OS << Val; |
||
1175 | } |
||
1176 | OS << ""; |
||
1177 | if (!IsFirstArgument) |
||
1178 | OS << ")"; |
||
1179 | OS << "))"; |
||
1180 | break; |
||
1181 | } |
||
1182 | case 5 : { |
||
1183 | OS << " __attribute__((shared_lock_function"; |
||
1184 | OS << ""; |
||
1185 | for (const auto &Val : args()) { |
||
1186 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1187 | OS << Val; |
||
1188 | } |
||
1189 | OS << ""; |
||
1190 | if (!IsFirstArgument) |
||
1191 | OS << ")"; |
||
1192 | OS << "))"; |
||
1193 | break; |
||
1194 | } |
||
1195 | } |
||
1196 | } |
||
1197 | |||
1198 | const char *AcquireCapabilityAttr::getSpelling() const { |
||
1199 | switch (getAttributeSpellingListIndex()) { |
||
1200 | default: |
||
1201 | llvm_unreachable("Unknown attribute spelling!"); |
||
1202 | return "(No spelling)"; |
||
1203 | case 0: |
||
1204 | return "acquire_capability"; |
||
1205 | case 1: |
||
1206 | return "acquire_capability"; |
||
1207 | case 2: |
||
1208 | return "acquire_shared_capability"; |
||
1209 | case 3: |
||
1210 | return "acquire_shared_capability"; |
||
1211 | case 4: |
||
1212 | return "exclusive_lock_function"; |
||
1213 | case 5: |
||
1214 | return "shared_lock_function"; |
||
1215 | } |
||
1216 | } |
||
1217 | |||
1218 | |||
1219 | // AcquireHandleAttr implementation |
||
1220 | |||
1221 | AcquireHandleAttr *AcquireHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { |
||
1222 | auto *A = new (Ctx) AcquireHandleAttr(Ctx, CommonInfo, HandleType); |
||
1223 | A->setImplicit(true); |
||
1224 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1225 | A->setAttributeSpellingListIndex(0); |
||
1226 | return A; |
||
1227 | } |
||
1228 | |||
1229 | AcquireHandleAttr *AcquireHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { |
||
1230 | auto *A = new (Ctx) AcquireHandleAttr(Ctx, CommonInfo, HandleType); |
||
1231 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1232 | A->setAttributeSpellingListIndex(0); |
||
1233 | return A; |
||
1234 | } |
||
1235 | |||
1236 | AcquireHandleAttr *AcquireHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1237 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1238 | return CreateImplicit(Ctx, HandleType, I); |
||
1239 | } |
||
1240 | |||
1241 | AcquireHandleAttr *AcquireHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1242 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1243 | return Create(Ctx, HandleType, I); |
||
1244 | } |
||
1245 | |||
1246 | AcquireHandleAttr::AcquireHandleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1247 | , llvm::StringRef HandleType |
||
1248 | ) |
||
1249 | : InheritableAttr(Ctx, CommonInfo, attr::AcquireHandle, false, false) |
||
1250 | , handleTypeLength(HandleType.size()),handleType(new (Ctx, 1) char[handleTypeLength]) |
||
1251 | { |
||
1252 | if (!HandleType.empty()) |
||
1253 | std::memcpy(handleType, HandleType.data(), handleTypeLength); |
||
1254 | } |
||
1255 | |||
1256 | |||
1257 | |||
1258 | AcquireHandleAttr *AcquireHandleAttr::clone(ASTContext &C) const { |
||
1259 | auto *A = new (C) AcquireHandleAttr(C, *this, getHandleType()); |
||
1260 | A->Inherited = Inherited; |
||
1261 | A->IsPackExpansion = IsPackExpansion; |
||
1262 | A->setImplicit(Implicit); |
||
1263 | return A; |
||
1264 | } |
||
1265 | |||
1266 | void AcquireHandleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1267 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
1268 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
1269 | switch (getAttributeSpellingListIndex()) { |
||
1270 | default: |
||
1271 | llvm_unreachable("Unknown attribute spelling!"); |
||
1272 | break; |
||
1273 | case 0 : { |
||
1274 | OS << " __attribute__((acquire_handle"; |
||
1275 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1276 | OS << "\"" << getHandleType() << "\""; |
||
1277 | if (!IsFirstArgument) |
||
1278 | OS << ")"; |
||
1279 | OS << "))"; |
||
1280 | break; |
||
1281 | } |
||
1282 | case 1 : { |
||
1283 | OS << " [[clang::acquire_handle"; |
||
1284 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1285 | OS << "\"" << getHandleType() << "\""; |
||
1286 | if (!IsFirstArgument) |
||
1287 | OS << ")"; |
||
1288 | OS << "]]"; |
||
1289 | break; |
||
1290 | } |
||
1291 | case 2 : { |
||
1292 | OS << " [[clang::acquire_handle"; |
||
1293 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1294 | OS << "\"" << getHandleType() << "\""; |
||
1295 | if (!IsFirstArgument) |
||
1296 | OS << ")"; |
||
1297 | OS << "]]"; |
||
1298 | break; |
||
1299 | } |
||
1300 | } |
||
1301 | } |
||
1302 | |||
1303 | const char *AcquireHandleAttr::getSpelling() const { |
||
1304 | switch (getAttributeSpellingListIndex()) { |
||
1305 | default: |
||
1306 | llvm_unreachable("Unknown attribute spelling!"); |
||
1307 | return "(No spelling)"; |
||
1308 | case 0: |
||
1309 | return "acquire_handle"; |
||
1310 | case 1: |
||
1311 | return "acquire_handle"; |
||
1312 | case 2: |
||
1313 | return "acquire_handle"; |
||
1314 | } |
||
1315 | } |
||
1316 | |||
1317 | |||
1318 | // AcquiredAfterAttr implementation |
||
1319 | |||
1320 | AcquiredAfterAttr *AcquiredAfterAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
1321 | auto *A = new (Ctx) AcquiredAfterAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
1322 | A->setImplicit(true); |
||
1323 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1324 | A->setAttributeSpellingListIndex(0); |
||
1325 | return A; |
||
1326 | } |
||
1327 | |||
1328 | AcquiredAfterAttr *AcquiredAfterAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
1329 | auto *A = new (Ctx) AcquiredAfterAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
1330 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1331 | A->setAttributeSpellingListIndex(0); |
||
1332 | return A; |
||
1333 | } |
||
1334 | |||
1335 | AcquiredAfterAttr *AcquiredAfterAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1336 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1337 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
1338 | } |
||
1339 | |||
1340 | AcquiredAfterAttr *AcquiredAfterAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1341 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1342 | return Create(Ctx, Args, ArgsSize, I); |
||
1343 | } |
||
1344 | |||
1345 | AcquiredAfterAttr::AcquiredAfterAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1346 | , Expr * *Args, unsigned ArgsSize |
||
1347 | ) |
||
1348 | : InheritableAttr(Ctx, CommonInfo, attr::AcquiredAfter, true, true) |
||
1349 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
1350 | { |
||
1351 | std::copy(Args, Args + args_Size, args_); |
||
1352 | } |
||
1353 | |||
1354 | AcquiredAfterAttr::AcquiredAfterAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1355 | ) |
||
1356 | : InheritableAttr(Ctx, CommonInfo, attr::AcquiredAfter, true, true) |
||
1357 | , args_Size(0), args_(nullptr) |
||
1358 | { |
||
1359 | } |
||
1360 | |||
1361 | |||
1362 | |||
1363 | AcquiredAfterAttr *AcquiredAfterAttr::clone(ASTContext &C) const { |
||
1364 | auto *A = new (C) AcquiredAfterAttr(C, *this, args_, args_Size); |
||
1365 | A->Inherited = Inherited; |
||
1366 | A->IsPackExpansion = IsPackExpansion; |
||
1367 | A->setImplicit(Implicit); |
||
1368 | return A; |
||
1369 | } |
||
1370 | |||
1371 | void AcquiredAfterAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1372 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
1373 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
1374 | switch (getAttributeSpellingListIndex()) { |
||
1375 | default: |
||
1376 | llvm_unreachable("Unknown attribute spelling!"); |
||
1377 | break; |
||
1378 | case 0 : { |
||
1379 | OS << " __attribute__((acquired_after"; |
||
1380 | OS << ""; |
||
1381 | for (const auto &Val : args()) { |
||
1382 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1383 | OS << Val; |
||
1384 | } |
||
1385 | OS << ""; |
||
1386 | if (!IsFirstArgument) |
||
1387 | OS << ")"; |
||
1388 | OS << "))"; |
||
1389 | break; |
||
1390 | } |
||
1391 | } |
||
1392 | } |
||
1393 | |||
1394 | const char *AcquiredAfterAttr::getSpelling() const { |
||
1395 | switch (getAttributeSpellingListIndex()) { |
||
1396 | default: |
||
1397 | llvm_unreachable("Unknown attribute spelling!"); |
||
1398 | return "(No spelling)"; |
||
1399 | case 0: |
||
1400 | return "acquired_after"; |
||
1401 | } |
||
1402 | } |
||
1403 | |||
1404 | |||
1405 | // AcquiredBeforeAttr implementation |
||
1406 | |||
1407 | AcquiredBeforeAttr *AcquiredBeforeAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
1408 | auto *A = new (Ctx) AcquiredBeforeAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
1409 | A->setImplicit(true); |
||
1410 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1411 | A->setAttributeSpellingListIndex(0); |
||
1412 | return A; |
||
1413 | } |
||
1414 | |||
1415 | AcquiredBeforeAttr *AcquiredBeforeAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
1416 | auto *A = new (Ctx) AcquiredBeforeAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
1417 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1418 | A->setAttributeSpellingListIndex(0); |
||
1419 | return A; |
||
1420 | } |
||
1421 | |||
1422 | AcquiredBeforeAttr *AcquiredBeforeAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1423 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1424 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
1425 | } |
||
1426 | |||
1427 | AcquiredBeforeAttr *AcquiredBeforeAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1428 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1429 | return Create(Ctx, Args, ArgsSize, I); |
||
1430 | } |
||
1431 | |||
1432 | AcquiredBeforeAttr::AcquiredBeforeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1433 | , Expr * *Args, unsigned ArgsSize |
||
1434 | ) |
||
1435 | : InheritableAttr(Ctx, CommonInfo, attr::AcquiredBefore, true, true) |
||
1436 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
1437 | { |
||
1438 | std::copy(Args, Args + args_Size, args_); |
||
1439 | } |
||
1440 | |||
1441 | AcquiredBeforeAttr::AcquiredBeforeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1442 | ) |
||
1443 | : InheritableAttr(Ctx, CommonInfo, attr::AcquiredBefore, true, true) |
||
1444 | , args_Size(0), args_(nullptr) |
||
1445 | { |
||
1446 | } |
||
1447 | |||
1448 | |||
1449 | |||
1450 | AcquiredBeforeAttr *AcquiredBeforeAttr::clone(ASTContext &C) const { |
||
1451 | auto *A = new (C) AcquiredBeforeAttr(C, *this, args_, args_Size); |
||
1452 | A->Inherited = Inherited; |
||
1453 | A->IsPackExpansion = IsPackExpansion; |
||
1454 | A->setImplicit(Implicit); |
||
1455 | return A; |
||
1456 | } |
||
1457 | |||
1458 | void AcquiredBeforeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1459 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
1460 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
1461 | switch (getAttributeSpellingListIndex()) { |
||
1462 | default: |
||
1463 | llvm_unreachable("Unknown attribute spelling!"); |
||
1464 | break; |
||
1465 | case 0 : { |
||
1466 | OS << " __attribute__((acquired_before"; |
||
1467 | OS << ""; |
||
1468 | for (const auto &Val : args()) { |
||
1469 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1470 | OS << Val; |
||
1471 | } |
||
1472 | OS << ""; |
||
1473 | if (!IsFirstArgument) |
||
1474 | OS << ")"; |
||
1475 | OS << "))"; |
||
1476 | break; |
||
1477 | } |
||
1478 | } |
||
1479 | } |
||
1480 | |||
1481 | const char *AcquiredBeforeAttr::getSpelling() const { |
||
1482 | switch (getAttributeSpellingListIndex()) { |
||
1483 | default: |
||
1484 | llvm_unreachable("Unknown attribute spelling!"); |
||
1485 | return "(No spelling)"; |
||
1486 | case 0: |
||
1487 | return "acquired_before"; |
||
1488 | } |
||
1489 | } |
||
1490 | |||
1491 | |||
1492 | // AddressSpaceAttr implementation |
||
1493 | |||
1494 | AddressSpaceAttr *AddressSpaceAttr::CreateImplicit(ASTContext &Ctx, int AddressSpace, const AttributeCommonInfo &CommonInfo) { |
||
1495 | auto *A = new (Ctx) AddressSpaceAttr(Ctx, CommonInfo, AddressSpace); |
||
1496 | A->setImplicit(true); |
||
1497 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1498 | A->setAttributeSpellingListIndex(0); |
||
1499 | return A; |
||
1500 | } |
||
1501 | |||
1502 | AddressSpaceAttr *AddressSpaceAttr::Create(ASTContext &Ctx, int AddressSpace, const AttributeCommonInfo &CommonInfo) { |
||
1503 | auto *A = new (Ctx) AddressSpaceAttr(Ctx, CommonInfo, AddressSpace); |
||
1504 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1505 | A->setAttributeSpellingListIndex(0); |
||
1506 | return A; |
||
1507 | } |
||
1508 | |||
1509 | AddressSpaceAttr *AddressSpaceAttr::CreateImplicit(ASTContext &Ctx, int AddressSpace, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1510 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1511 | return CreateImplicit(Ctx, AddressSpace, I); |
||
1512 | } |
||
1513 | |||
1514 | AddressSpaceAttr *AddressSpaceAttr::Create(ASTContext &Ctx, int AddressSpace, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1515 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1516 | return Create(Ctx, AddressSpace, I); |
||
1517 | } |
||
1518 | |||
1519 | AddressSpaceAttr::AddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1520 | , int AddressSpace |
||
1521 | ) |
||
1522 | : TypeAttr(Ctx, CommonInfo, attr::AddressSpace, false) |
||
1523 | , addressSpace(AddressSpace) |
||
1524 | { |
||
1525 | } |
||
1526 | |||
1527 | |||
1528 | |||
1529 | AddressSpaceAttr *AddressSpaceAttr::clone(ASTContext &C) const { |
||
1530 | auto *A = new (C) AddressSpaceAttr(C, *this, addressSpace); |
||
1531 | A->Inherited = Inherited; |
||
1532 | A->IsPackExpansion = IsPackExpansion; |
||
1533 | A->setImplicit(Implicit); |
||
1534 | return A; |
||
1535 | } |
||
1536 | |||
1537 | void AddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1538 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
1539 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
1540 | switch (getAttributeSpellingListIndex()) { |
||
1541 | default: |
||
1542 | llvm_unreachable("Unknown attribute spelling!"); |
||
1543 | break; |
||
1544 | case 0 : { |
||
1545 | OS << " __attribute__((address_space"; |
||
1546 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1547 | OS << "" << getAddressSpace() << ""; |
||
1548 | if (!IsFirstArgument) |
||
1549 | OS << ")"; |
||
1550 | OS << "))"; |
||
1551 | break; |
||
1552 | } |
||
1553 | case 1 : { |
||
1554 | OS << " [[clang::address_space"; |
||
1555 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1556 | OS << "" << getAddressSpace() << ""; |
||
1557 | if (!IsFirstArgument) |
||
1558 | OS << ")"; |
||
1559 | OS << "]]"; |
||
1560 | break; |
||
1561 | } |
||
1562 | case 2 : { |
||
1563 | OS << " [[clang::address_space"; |
||
1564 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1565 | OS << "" << getAddressSpace() << ""; |
||
1566 | if (!IsFirstArgument) |
||
1567 | OS << ")"; |
||
1568 | OS << "]]"; |
||
1569 | break; |
||
1570 | } |
||
1571 | } |
||
1572 | } |
||
1573 | |||
1574 | const char *AddressSpaceAttr::getSpelling() const { |
||
1575 | switch (getAttributeSpellingListIndex()) { |
||
1576 | default: |
||
1577 | llvm_unreachable("Unknown attribute spelling!"); |
||
1578 | return "(No spelling)"; |
||
1579 | case 0: |
||
1580 | return "address_space"; |
||
1581 | case 1: |
||
1582 | return "address_space"; |
||
1583 | case 2: |
||
1584 | return "address_space"; |
||
1585 | } |
||
1586 | } |
||
1587 | |||
1588 | |||
1589 | // AliasAttr implementation |
||
1590 | |||
1591 | AliasAttr *AliasAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) { |
||
1592 | auto *A = new (Ctx) AliasAttr(Ctx, CommonInfo, Aliasee); |
||
1593 | A->setImplicit(true); |
||
1594 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1595 | A->setAttributeSpellingListIndex(0); |
||
1596 | return A; |
||
1597 | } |
||
1598 | |||
1599 | AliasAttr *AliasAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) { |
||
1600 | auto *A = new (Ctx) AliasAttr(Ctx, CommonInfo, Aliasee); |
||
1601 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1602 | A->setAttributeSpellingListIndex(0); |
||
1603 | return A; |
||
1604 | } |
||
1605 | |||
1606 | AliasAttr *AliasAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1607 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1608 | return CreateImplicit(Ctx, Aliasee, I); |
||
1609 | } |
||
1610 | |||
1611 | AliasAttr *AliasAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1612 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1613 | return Create(Ctx, Aliasee, I); |
||
1614 | } |
||
1615 | |||
1616 | AliasAttr::AliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1617 | , llvm::StringRef Aliasee |
||
1618 | ) |
||
1619 | : Attr(Ctx, CommonInfo, attr::Alias, false) |
||
1620 | , aliaseeLength(Aliasee.size()),aliasee(new (Ctx, 1) char[aliaseeLength]) |
||
1621 | { |
||
1622 | if (!Aliasee.empty()) |
||
1623 | std::memcpy(aliasee, Aliasee.data(), aliaseeLength); |
||
1624 | } |
||
1625 | |||
1626 | |||
1627 | |||
1628 | AliasAttr *AliasAttr::clone(ASTContext &C) const { |
||
1629 | auto *A = new (C) AliasAttr(C, *this, getAliasee()); |
||
1630 | A->Inherited = Inherited; |
||
1631 | A->IsPackExpansion = IsPackExpansion; |
||
1632 | A->setImplicit(Implicit); |
||
1633 | return A; |
||
1634 | } |
||
1635 | |||
1636 | void AliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1637 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
1638 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
1639 | switch (getAttributeSpellingListIndex()) { |
||
1640 | default: |
||
1641 | llvm_unreachable("Unknown attribute spelling!"); |
||
1642 | break; |
||
1643 | case 0 : { |
||
1644 | OS << " __attribute__((alias"; |
||
1645 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1646 | OS << "\"" << getAliasee() << "\""; |
||
1647 | if (!IsFirstArgument) |
||
1648 | OS << ")"; |
||
1649 | OS << "))"; |
||
1650 | break; |
||
1651 | } |
||
1652 | case 1 : { |
||
1653 | OS << " [[gnu::alias"; |
||
1654 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1655 | OS << "\"" << getAliasee() << "\""; |
||
1656 | if (!IsFirstArgument) |
||
1657 | OS << ")"; |
||
1658 | OS << "]]"; |
||
1659 | break; |
||
1660 | } |
||
1661 | case 2 : { |
||
1662 | OS << " [[gnu::alias"; |
||
1663 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1664 | OS << "\"" << getAliasee() << "\""; |
||
1665 | if (!IsFirstArgument) |
||
1666 | OS << ")"; |
||
1667 | OS << "]]"; |
||
1668 | break; |
||
1669 | } |
||
1670 | } |
||
1671 | } |
||
1672 | |||
1673 | const char *AliasAttr::getSpelling() const { |
||
1674 | switch (getAttributeSpellingListIndex()) { |
||
1675 | default: |
||
1676 | llvm_unreachable("Unknown attribute spelling!"); |
||
1677 | return "(No spelling)"; |
||
1678 | case 0: |
||
1679 | return "alias"; |
||
1680 | case 1: |
||
1681 | return "alias"; |
||
1682 | case 2: |
||
1683 | return "alias"; |
||
1684 | } |
||
1685 | } |
||
1686 | |||
1687 | |||
1688 | // AlignMac68kAttr implementation |
||
1689 | |||
1690 | AlignMac68kAttr *AlignMac68kAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
1691 | auto *A = new (Ctx) AlignMac68kAttr(Ctx, CommonInfo); |
||
1692 | A->setImplicit(true); |
||
1693 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1694 | A->setAttributeSpellingListIndex(0); |
||
1695 | return A; |
||
1696 | } |
||
1697 | |||
1698 | AlignMac68kAttr *AlignMac68kAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
1699 | auto *A = new (Ctx) AlignMac68kAttr(Ctx, CommonInfo); |
||
1700 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1701 | A->setAttributeSpellingListIndex(0); |
||
1702 | return A; |
||
1703 | } |
||
1704 | |||
1705 | AlignMac68kAttr *AlignMac68kAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1706 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1707 | return CreateImplicit(Ctx, I); |
||
1708 | } |
||
1709 | |||
1710 | AlignMac68kAttr *AlignMac68kAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1711 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1712 | return Create(Ctx, I); |
||
1713 | } |
||
1714 | |||
1715 | AlignMac68kAttr::AlignMac68kAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1716 | ) |
||
1717 | : InheritableAttr(Ctx, CommonInfo, attr::AlignMac68k, false, false) |
||
1718 | { |
||
1719 | } |
||
1720 | |||
1721 | AlignMac68kAttr *AlignMac68kAttr::clone(ASTContext &C) const { |
||
1722 | auto *A = new (C) AlignMac68kAttr(C, *this); |
||
1723 | A->Inherited = Inherited; |
||
1724 | A->IsPackExpansion = IsPackExpansion; |
||
1725 | A->setImplicit(Implicit); |
||
1726 | return A; |
||
1727 | } |
||
1728 | |||
1729 | void AlignMac68kAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1730 | } |
||
1731 | |||
1732 | const char *AlignMac68kAttr::getSpelling() const { |
||
1733 | return "(No spelling)"; |
||
1734 | } |
||
1735 | |||
1736 | |||
1737 | // AlignNaturalAttr implementation |
||
1738 | |||
1739 | AlignNaturalAttr *AlignNaturalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
1740 | auto *A = new (Ctx) AlignNaturalAttr(Ctx, CommonInfo); |
||
1741 | A->setImplicit(true); |
||
1742 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1743 | A->setAttributeSpellingListIndex(0); |
||
1744 | return A; |
||
1745 | } |
||
1746 | |||
1747 | AlignNaturalAttr *AlignNaturalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
1748 | auto *A = new (Ctx) AlignNaturalAttr(Ctx, CommonInfo); |
||
1749 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1750 | A->setAttributeSpellingListIndex(0); |
||
1751 | return A; |
||
1752 | } |
||
1753 | |||
1754 | AlignNaturalAttr *AlignNaturalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1755 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1756 | return CreateImplicit(Ctx, I); |
||
1757 | } |
||
1758 | |||
1759 | AlignNaturalAttr *AlignNaturalAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1760 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1761 | return Create(Ctx, I); |
||
1762 | } |
||
1763 | |||
1764 | AlignNaturalAttr::AlignNaturalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1765 | ) |
||
1766 | : InheritableAttr(Ctx, CommonInfo, attr::AlignNatural, false, false) |
||
1767 | { |
||
1768 | } |
||
1769 | |||
1770 | AlignNaturalAttr *AlignNaturalAttr::clone(ASTContext &C) const { |
||
1771 | auto *A = new (C) AlignNaturalAttr(C, *this); |
||
1772 | A->Inherited = Inherited; |
||
1773 | A->IsPackExpansion = IsPackExpansion; |
||
1774 | A->setImplicit(Implicit); |
||
1775 | return A; |
||
1776 | } |
||
1777 | |||
1778 | void AlignNaturalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1779 | } |
||
1780 | |||
1781 | const char *AlignNaturalAttr::getSpelling() const { |
||
1782 | return "(No spelling)"; |
||
1783 | } |
||
1784 | |||
1785 | |||
1786 | // AlignValueAttr implementation |
||
1787 | |||
1788 | AlignValueAttr *AlignValueAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { |
||
1789 | auto *A = new (Ctx) AlignValueAttr(Ctx, CommonInfo, Alignment); |
||
1790 | A->setImplicit(true); |
||
1791 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1792 | A->setAttributeSpellingListIndex(0); |
||
1793 | return A; |
||
1794 | } |
||
1795 | |||
1796 | AlignValueAttr *AlignValueAttr::Create(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { |
||
1797 | auto *A = new (Ctx) AlignValueAttr(Ctx, CommonInfo, Alignment); |
||
1798 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1799 | A->setAttributeSpellingListIndex(0); |
||
1800 | return A; |
||
1801 | } |
||
1802 | |||
1803 | AlignValueAttr *AlignValueAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1804 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1805 | return CreateImplicit(Ctx, Alignment, I); |
||
1806 | } |
||
1807 | |||
1808 | AlignValueAttr *AlignValueAttr::Create(ASTContext &Ctx, Expr * Alignment, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
1809 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
1810 | return Create(Ctx, Alignment, I); |
||
1811 | } |
||
1812 | |||
1813 | AlignValueAttr::AlignValueAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1814 | , Expr * Alignment |
||
1815 | ) |
||
1816 | : Attr(Ctx, CommonInfo, attr::AlignValue, false) |
||
1817 | , alignment(Alignment) |
||
1818 | { |
||
1819 | } |
||
1820 | |||
1821 | |||
1822 | |||
1823 | AlignValueAttr *AlignValueAttr::clone(ASTContext &C) const { |
||
1824 | auto *A = new (C) AlignValueAttr(C, *this, alignment); |
||
1825 | A->Inherited = Inherited; |
||
1826 | A->IsPackExpansion = IsPackExpansion; |
||
1827 | A->setImplicit(Implicit); |
||
1828 | return A; |
||
1829 | } |
||
1830 | |||
1831 | void AlignValueAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1832 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
1833 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
1834 | switch (getAttributeSpellingListIndex()) { |
||
1835 | default: |
||
1836 | llvm_unreachable("Unknown attribute spelling!"); |
||
1837 | break; |
||
1838 | case 0 : { |
||
1839 | OS << " __attribute__((align_value"; |
||
1840 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1841 | OS << ""; |
||
1842 | getAlignment()->printPretty(OS, nullptr, Policy); |
||
1843 | OS << ""; |
||
1844 | if (!IsFirstArgument) |
||
1845 | OS << ")"; |
||
1846 | OS << "))"; |
||
1847 | break; |
||
1848 | } |
||
1849 | } |
||
1850 | } |
||
1851 | |||
1852 | const char *AlignValueAttr::getSpelling() const { |
||
1853 | switch (getAttributeSpellingListIndex()) { |
||
1854 | default: |
||
1855 | llvm_unreachable("Unknown attribute spelling!"); |
||
1856 | return "(No spelling)"; |
||
1857 | case 0: |
||
1858 | return "align_value"; |
||
1859 | } |
||
1860 | } |
||
1861 | |||
1862 | |||
1863 | // AlignedAttr implementation |
||
1864 | |||
1865 | AlignedAttr *AlignedAttr::CreateImplicit(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, const AttributeCommonInfo &CommonInfo) { |
||
1866 | auto *A = new (Ctx) AlignedAttr(Ctx, CommonInfo, IsAlignmentExpr, Alignment); |
||
1867 | A->setImplicit(true); |
||
1868 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
1869 | A->setAttributeSpellingListIndex(0); |
||
1870 | return A; |
||
1871 | } |
||
1872 | |||
1873 | AlignedAttr *AlignedAttr::Create(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, const AttributeCommonInfo &CommonInfo) { |
||
1874 | auto *A = new (Ctx) AlignedAttr(Ctx, CommonInfo, IsAlignmentExpr, Alignment); |
||
1875 | return A; |
||
1876 | } |
||
1877 | |||
1878 | AlignedAttr *AlignedAttr::CreateImplicit(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, SourceRange Range, AttributeCommonInfo::Syntax Syntax, AlignedAttr::Spelling S) { |
||
1879 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
1880 | return CreateImplicit(Ctx, IsAlignmentExpr, Alignment, I); |
||
1881 | } |
||
1882 | |||
1883 | AlignedAttr *AlignedAttr::Create(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, SourceRange Range, AttributeCommonInfo::Syntax Syntax, AlignedAttr::Spelling S) { |
||
1884 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
1885 | return Create(Ctx, IsAlignmentExpr, Alignment, I); |
||
1886 | } |
||
1887 | |||
1888 | AlignedAttr::AlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1889 | , bool IsAlignmentExpr, void *Alignment |
||
1890 | ) |
||
1891 | : InheritableAttr(Ctx, CommonInfo, attr::Aligned, false, false) |
||
1892 | , isalignmentExpr(IsAlignmentExpr) |
||
1893 | { |
||
1894 | if (isalignmentExpr) |
||
1895 | alignmentExpr = reinterpret_cast<Expr *>(Alignment); |
||
1896 | else |
||
1897 | alignmentType = reinterpret_cast<TypeSourceInfo *>(Alignment); |
||
1898 | } |
||
1899 | |||
1900 | AlignedAttr::AlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
1901 | ) |
||
1902 | : InheritableAttr(Ctx, CommonInfo, attr::Aligned, false, false) |
||
1903 | , isalignmentExpr(false) |
||
1904 | { |
||
1905 | } |
||
1906 | |||
1907 | AlignedAttr::Spelling AlignedAttr::getSemanticSpelling() const { |
||
1908 | switch (getAttributeSpellingListIndex()) { |
||
1909 | default: llvm_unreachable("Unknown spelling list index"); |
||
1910 | case 0: return GNU_aligned; |
||
1911 | case 1: return CXX11_gnu_aligned; |
||
1912 | case 2: return C2x_gnu_aligned; |
||
1913 | case 3: return Declspec_align; |
||
1914 | case 4: return Keyword_alignas; |
||
1915 | case 5: return Keyword_Alignas; |
||
1916 | } |
||
1917 | } |
||
1918 | bool AlignedAttr::isAlignmentDependent() const { |
||
1919 | if (isalignmentExpr) |
||
1920 | return alignmentExpr && (alignmentExpr->isValueDependent() || alignmentExpr->isTypeDependent()); |
||
1921 | else |
||
1922 | return alignmentType->getType()->isDependentType(); |
||
1923 | } |
||
1924 | bool AlignedAttr::isAlignmentErrorDependent() const { |
||
1925 | if (isalignmentExpr) |
||
1926 | return alignmentExpr && alignmentExpr->containsErrors(); |
||
1927 | return alignmentType->getType()->containsErrors(); |
||
1928 | } |
||
1929 | unsigned AlignedAttr::getAlignment(ASTContext &Ctx) const { |
||
1930 | assert(!isAlignmentDependent()); |
||
1931 | if (isalignmentExpr) |
||
1932 | return alignmentExpr ? alignmentExpr->EvaluateKnownConstInt(Ctx).getZExtValue() * Ctx.getCharWidth() : Ctx.getTargetDefaultAlignForAttributeAligned(); |
||
1933 | else |
||
1934 | return 0; // FIXME |
||
1935 | } |
||
1936 | |||
1937 | |||
1938 | AlignedAttr *AlignedAttr::clone(ASTContext &C) const { |
||
1939 | auto *A = new (C) AlignedAttr(C, *this, isalignmentExpr, isalignmentExpr ? static_cast<void*>(alignmentExpr) : alignmentType); |
||
1940 | A->Inherited = Inherited; |
||
1941 | A->IsPackExpansion = IsPackExpansion; |
||
1942 | A->setImplicit(Implicit); |
||
1943 | return A; |
||
1944 | } |
||
1945 | |||
1946 | void AlignedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
1947 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
1948 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
1949 | switch (getAttributeSpellingListIndex()) { |
||
1950 | default: |
||
1951 | llvm_unreachable("Unknown attribute spelling!"); |
||
1952 | break; |
||
1953 | case 0 : { |
||
1954 | OS << " __attribute__((aligned"; |
||
1955 | if (!isalignmentExpr || !alignmentExpr) |
||
1956 | ++TrailingOmittedArgs; |
||
1957 | if (!(!isalignmentExpr || !alignmentExpr)) { |
||
1958 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1959 | OS << ""; |
||
1960 | alignmentExpr->printPretty(OS, nullptr, Policy); |
||
1961 | OS << ""; |
||
1962 | } |
||
1963 | if (!IsFirstArgument) |
||
1964 | OS << ")"; |
||
1965 | OS << "))"; |
||
1966 | break; |
||
1967 | } |
||
1968 | case 1 : { |
||
1969 | OS << " [[gnu::aligned"; |
||
1970 | if (!isalignmentExpr || !alignmentExpr) |
||
1971 | ++TrailingOmittedArgs; |
||
1972 | if (!(!isalignmentExpr || !alignmentExpr)) { |
||
1973 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1974 | OS << ""; |
||
1975 | alignmentExpr->printPretty(OS, nullptr, Policy); |
||
1976 | OS << ""; |
||
1977 | } |
||
1978 | if (!IsFirstArgument) |
||
1979 | OS << ")"; |
||
1980 | OS << "]]"; |
||
1981 | break; |
||
1982 | } |
||
1983 | case 2 : { |
||
1984 | OS << " [[gnu::aligned"; |
||
1985 | if (!isalignmentExpr || !alignmentExpr) |
||
1986 | ++TrailingOmittedArgs; |
||
1987 | if (!(!isalignmentExpr || !alignmentExpr)) { |
||
1988 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
1989 | OS << ""; |
||
1990 | alignmentExpr->printPretty(OS, nullptr, Policy); |
||
1991 | OS << ""; |
||
1992 | } |
||
1993 | if (!IsFirstArgument) |
||
1994 | OS << ")"; |
||
1995 | OS << "]]"; |
||
1996 | break; |
||
1997 | } |
||
1998 | case 3 : { |
||
1999 | OS << " __declspec(align"; |
||
2000 | if (!isalignmentExpr || !alignmentExpr) |
||
2001 | ++TrailingOmittedArgs; |
||
2002 | if (!(!isalignmentExpr || !alignmentExpr)) { |
||
2003 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2004 | OS << ""; |
||
2005 | alignmentExpr->printPretty(OS, nullptr, Policy); |
||
2006 | OS << ""; |
||
2007 | } |
||
2008 | if (!IsFirstArgument) |
||
2009 | OS << ")"; |
||
2010 | OS << ")"; |
||
2011 | break; |
||
2012 | } |
||
2013 | case 4 : { |
||
2014 | OS << " alignas"; |
||
2015 | if (!isalignmentExpr || !alignmentExpr) |
||
2016 | ++TrailingOmittedArgs; |
||
2017 | if (!(!isalignmentExpr || !alignmentExpr)) { |
||
2018 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2019 | OS << ""; |
||
2020 | alignmentExpr->printPretty(OS, nullptr, Policy); |
||
2021 | OS << ""; |
||
2022 | } |
||
2023 | if (!IsFirstArgument) |
||
2024 | OS << ")"; |
||
2025 | OS << ""; |
||
2026 | break; |
||
2027 | } |
||
2028 | case 5 : { |
||
2029 | OS << " _Alignas"; |
||
2030 | if (!isalignmentExpr || !alignmentExpr) |
||
2031 | ++TrailingOmittedArgs; |
||
2032 | if (!(!isalignmentExpr || !alignmentExpr)) { |
||
2033 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2034 | OS << ""; |
||
2035 | alignmentExpr->printPretty(OS, nullptr, Policy); |
||
2036 | OS << ""; |
||
2037 | } |
||
2038 | if (!IsFirstArgument) |
||
2039 | OS << ")"; |
||
2040 | OS << ""; |
||
2041 | break; |
||
2042 | } |
||
2043 | } |
||
2044 | } |
||
2045 | |||
2046 | const char *AlignedAttr::getSpelling() const { |
||
2047 | switch (getAttributeSpellingListIndex()) { |
||
2048 | default: |
||
2049 | llvm_unreachable("Unknown attribute spelling!"); |
||
2050 | return "(No spelling)"; |
||
2051 | case 0: |
||
2052 | return "aligned"; |
||
2053 | case 1: |
||
2054 | return "aligned"; |
||
2055 | case 2: |
||
2056 | return "aligned"; |
||
2057 | case 3: |
||
2058 | return "align"; |
||
2059 | case 4: |
||
2060 | return "alignas"; |
||
2061 | case 5: |
||
2062 | return "_Alignas"; |
||
2063 | } |
||
2064 | } |
||
2065 | |||
2066 | |||
2067 | // AllocAlignAttr implementation |
||
2068 | |||
2069 | AllocAlignAttr *AllocAlignAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ParamIndex, const AttributeCommonInfo &CommonInfo) { |
||
2070 | auto *A = new (Ctx) AllocAlignAttr(Ctx, CommonInfo, ParamIndex); |
||
2071 | A->setImplicit(true); |
||
2072 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2073 | A->setAttributeSpellingListIndex(0); |
||
2074 | return A; |
||
2075 | } |
||
2076 | |||
2077 | AllocAlignAttr *AllocAlignAttr::Create(ASTContext &Ctx, ParamIdx ParamIndex, const AttributeCommonInfo &CommonInfo) { |
||
2078 | auto *A = new (Ctx) AllocAlignAttr(Ctx, CommonInfo, ParamIndex); |
||
2079 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2080 | A->setAttributeSpellingListIndex(0); |
||
2081 | return A; |
||
2082 | } |
||
2083 | |||
2084 | AllocAlignAttr *AllocAlignAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ParamIndex, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2085 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2086 | return CreateImplicit(Ctx, ParamIndex, I); |
||
2087 | } |
||
2088 | |||
2089 | AllocAlignAttr *AllocAlignAttr::Create(ASTContext &Ctx, ParamIdx ParamIndex, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2090 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2091 | return Create(Ctx, ParamIndex, I); |
||
2092 | } |
||
2093 | |||
2094 | AllocAlignAttr::AllocAlignAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2095 | , ParamIdx ParamIndex |
||
2096 | ) |
||
2097 | : InheritableAttr(Ctx, CommonInfo, attr::AllocAlign, false, false) |
||
2098 | , paramIndex(ParamIndex) |
||
2099 | { |
||
2100 | } |
||
2101 | |||
2102 | |||
2103 | |||
2104 | AllocAlignAttr *AllocAlignAttr::clone(ASTContext &C) const { |
||
2105 | auto *A = new (C) AllocAlignAttr(C, *this, paramIndex); |
||
2106 | A->Inherited = Inherited; |
||
2107 | A->IsPackExpansion = IsPackExpansion; |
||
2108 | A->setImplicit(Implicit); |
||
2109 | return A; |
||
2110 | } |
||
2111 | |||
2112 | void AllocAlignAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
2113 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
2114 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
2115 | switch (getAttributeSpellingListIndex()) { |
||
2116 | default: |
||
2117 | llvm_unreachable("Unknown attribute spelling!"); |
||
2118 | break; |
||
2119 | case 0 : { |
||
2120 | OS << " __attribute__((alloc_align"; |
||
2121 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2122 | OS << "" << getParamIndex().getSourceIndex() << ""; |
||
2123 | if (!IsFirstArgument) |
||
2124 | OS << ")"; |
||
2125 | OS << "))"; |
||
2126 | break; |
||
2127 | } |
||
2128 | case 1 : { |
||
2129 | OS << " [[gnu::alloc_align"; |
||
2130 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2131 | OS << "" << getParamIndex().getSourceIndex() << ""; |
||
2132 | if (!IsFirstArgument) |
||
2133 | OS << ")"; |
||
2134 | OS << "]]"; |
||
2135 | break; |
||
2136 | } |
||
2137 | case 2 : { |
||
2138 | OS << " [[gnu::alloc_align"; |
||
2139 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2140 | OS << "" << getParamIndex().getSourceIndex() << ""; |
||
2141 | if (!IsFirstArgument) |
||
2142 | OS << ")"; |
||
2143 | OS << "]]"; |
||
2144 | break; |
||
2145 | } |
||
2146 | } |
||
2147 | } |
||
2148 | |||
2149 | const char *AllocAlignAttr::getSpelling() const { |
||
2150 | switch (getAttributeSpellingListIndex()) { |
||
2151 | default: |
||
2152 | llvm_unreachable("Unknown attribute spelling!"); |
||
2153 | return "(No spelling)"; |
||
2154 | case 0: |
||
2155 | return "alloc_align"; |
||
2156 | case 1: |
||
2157 | return "alloc_align"; |
||
2158 | case 2: |
||
2159 | return "alloc_align"; |
||
2160 | } |
||
2161 | } |
||
2162 | |||
2163 | |||
2164 | // AllocSizeAttr implementation |
||
2165 | |||
2166 | AllocSizeAttr *AllocSizeAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, const AttributeCommonInfo &CommonInfo) { |
||
2167 | auto *A = new (Ctx) AllocSizeAttr(Ctx, CommonInfo, ElemSizeParam, NumElemsParam); |
||
2168 | A->setImplicit(true); |
||
2169 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2170 | A->setAttributeSpellingListIndex(0); |
||
2171 | return A; |
||
2172 | } |
||
2173 | |||
2174 | AllocSizeAttr *AllocSizeAttr::Create(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, const AttributeCommonInfo &CommonInfo) { |
||
2175 | auto *A = new (Ctx) AllocSizeAttr(Ctx, CommonInfo, ElemSizeParam, NumElemsParam); |
||
2176 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2177 | A->setAttributeSpellingListIndex(0); |
||
2178 | return A; |
||
2179 | } |
||
2180 | |||
2181 | AllocSizeAttr *AllocSizeAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2182 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2183 | return CreateImplicit(Ctx, ElemSizeParam, NumElemsParam, I); |
||
2184 | } |
||
2185 | |||
2186 | AllocSizeAttr *AllocSizeAttr::Create(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2187 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2188 | return Create(Ctx, ElemSizeParam, NumElemsParam, I); |
||
2189 | } |
||
2190 | |||
2191 | AllocSizeAttr::AllocSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2192 | , ParamIdx ElemSizeParam |
||
2193 | , ParamIdx NumElemsParam |
||
2194 | ) |
||
2195 | : InheritableAttr(Ctx, CommonInfo, attr::AllocSize, false, false) |
||
2196 | , elemSizeParam(ElemSizeParam) |
||
2197 | , numElemsParam(NumElemsParam) |
||
2198 | { |
||
2199 | } |
||
2200 | |||
2201 | AllocSizeAttr::AllocSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2202 | , ParamIdx ElemSizeParam |
||
2203 | ) |
||
2204 | : InheritableAttr(Ctx, CommonInfo, attr::AllocSize, false, false) |
||
2205 | , elemSizeParam(ElemSizeParam) |
||
2206 | , numElemsParam() |
||
2207 | { |
||
2208 | } |
||
2209 | |||
2210 | |||
2211 | |||
2212 | |||
2213 | |||
2214 | AllocSizeAttr *AllocSizeAttr::clone(ASTContext &C) const { |
||
2215 | auto *A = new (C) AllocSizeAttr(C, *this, elemSizeParam, numElemsParam); |
||
2216 | A->Inherited = Inherited; |
||
2217 | A->IsPackExpansion = IsPackExpansion; |
||
2218 | A->setImplicit(Implicit); |
||
2219 | return A; |
||
2220 | } |
||
2221 | |||
2222 | void AllocSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
2223 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
2224 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
2225 | switch (getAttributeSpellingListIndex()) { |
||
2226 | default: |
||
2227 | llvm_unreachable("Unknown attribute spelling!"); |
||
2228 | break; |
||
2229 | case 0 : { |
||
2230 | OS << " __attribute__((alloc_size"; |
||
2231 | if (!getNumElemsParam().isValid()) |
||
2232 | ++TrailingOmittedArgs; |
||
2233 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2234 | OS << "" << getElemSizeParam().getSourceIndex() << ""; |
||
2235 | if (!(!getNumElemsParam().isValid())) { |
||
2236 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2237 | OS << "" << getNumElemsParam().getSourceIndex() << ""; |
||
2238 | } |
||
2239 | if (!IsFirstArgument) |
||
2240 | OS << ")"; |
||
2241 | OS << "))"; |
||
2242 | break; |
||
2243 | } |
||
2244 | case 1 : { |
||
2245 | OS << " [[gnu::alloc_size"; |
||
2246 | if (!getNumElemsParam().isValid()) |
||
2247 | ++TrailingOmittedArgs; |
||
2248 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2249 | OS << "" << getElemSizeParam().getSourceIndex() << ""; |
||
2250 | if (!(!getNumElemsParam().isValid())) { |
||
2251 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2252 | OS << "" << getNumElemsParam().getSourceIndex() << ""; |
||
2253 | } |
||
2254 | if (!IsFirstArgument) |
||
2255 | OS << ")"; |
||
2256 | OS << "]]"; |
||
2257 | break; |
||
2258 | } |
||
2259 | case 2 : { |
||
2260 | OS << " [[gnu::alloc_size"; |
||
2261 | if (!getNumElemsParam().isValid()) |
||
2262 | ++TrailingOmittedArgs; |
||
2263 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2264 | OS << "" << getElemSizeParam().getSourceIndex() << ""; |
||
2265 | if (!(!getNumElemsParam().isValid())) { |
||
2266 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2267 | OS << "" << getNumElemsParam().getSourceIndex() << ""; |
||
2268 | } |
||
2269 | if (!IsFirstArgument) |
||
2270 | OS << ")"; |
||
2271 | OS << "]]"; |
||
2272 | break; |
||
2273 | } |
||
2274 | } |
||
2275 | } |
||
2276 | |||
2277 | const char *AllocSizeAttr::getSpelling() const { |
||
2278 | switch (getAttributeSpellingListIndex()) { |
||
2279 | default: |
||
2280 | llvm_unreachable("Unknown attribute spelling!"); |
||
2281 | return "(No spelling)"; |
||
2282 | case 0: |
||
2283 | return "alloc_size"; |
||
2284 | case 1: |
||
2285 | return "alloc_size"; |
||
2286 | case 2: |
||
2287 | return "alloc_size"; |
||
2288 | } |
||
2289 | } |
||
2290 | |||
2291 | |||
2292 | // AlwaysDestroyAttr implementation |
||
2293 | |||
2294 | AlwaysDestroyAttr *AlwaysDestroyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2295 | auto *A = new (Ctx) AlwaysDestroyAttr(Ctx, CommonInfo); |
||
2296 | A->setImplicit(true); |
||
2297 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2298 | A->setAttributeSpellingListIndex(0); |
||
2299 | return A; |
||
2300 | } |
||
2301 | |||
2302 | AlwaysDestroyAttr *AlwaysDestroyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2303 | auto *A = new (Ctx) AlwaysDestroyAttr(Ctx, CommonInfo); |
||
2304 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2305 | A->setAttributeSpellingListIndex(0); |
||
2306 | return A; |
||
2307 | } |
||
2308 | |||
2309 | AlwaysDestroyAttr *AlwaysDestroyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2310 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2311 | return CreateImplicit(Ctx, I); |
||
2312 | } |
||
2313 | |||
2314 | AlwaysDestroyAttr *AlwaysDestroyAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2315 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2316 | return Create(Ctx, I); |
||
2317 | } |
||
2318 | |||
2319 | AlwaysDestroyAttr::AlwaysDestroyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2320 | ) |
||
2321 | : InheritableAttr(Ctx, CommonInfo, attr::AlwaysDestroy, false, false) |
||
2322 | { |
||
2323 | } |
||
2324 | |||
2325 | AlwaysDestroyAttr *AlwaysDestroyAttr::clone(ASTContext &C) const { |
||
2326 | auto *A = new (C) AlwaysDestroyAttr(C, *this); |
||
2327 | A->Inherited = Inherited; |
||
2328 | A->IsPackExpansion = IsPackExpansion; |
||
2329 | A->setImplicit(Implicit); |
||
2330 | return A; |
||
2331 | } |
||
2332 | |||
2333 | void AlwaysDestroyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
2334 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
2335 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
2336 | switch (getAttributeSpellingListIndex()) { |
||
2337 | default: |
||
2338 | llvm_unreachable("Unknown attribute spelling!"); |
||
2339 | break; |
||
2340 | case 0 : { |
||
2341 | OS << " __attribute__((always_destroy"; |
||
2342 | OS << "))"; |
||
2343 | break; |
||
2344 | } |
||
2345 | case 1 : { |
||
2346 | OS << " [[clang::always_destroy"; |
||
2347 | OS << "]]"; |
||
2348 | break; |
||
2349 | } |
||
2350 | } |
||
2351 | } |
||
2352 | |||
2353 | const char *AlwaysDestroyAttr::getSpelling() const { |
||
2354 | switch (getAttributeSpellingListIndex()) { |
||
2355 | default: |
||
2356 | llvm_unreachable("Unknown attribute spelling!"); |
||
2357 | return "(No spelling)"; |
||
2358 | case 0: |
||
2359 | return "always_destroy"; |
||
2360 | case 1: |
||
2361 | return "always_destroy"; |
||
2362 | } |
||
2363 | } |
||
2364 | |||
2365 | |||
2366 | // AlwaysInlineAttr implementation |
||
2367 | |||
2368 | AlwaysInlineAttr *AlwaysInlineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2369 | auto *A = new (Ctx) AlwaysInlineAttr(Ctx, CommonInfo); |
||
2370 | A->setImplicit(true); |
||
2371 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2372 | A->setAttributeSpellingListIndex(0); |
||
2373 | return A; |
||
2374 | } |
||
2375 | |||
2376 | AlwaysInlineAttr *AlwaysInlineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2377 | auto *A = new (Ctx) AlwaysInlineAttr(Ctx, CommonInfo); |
||
2378 | return A; |
||
2379 | } |
||
2380 | |||
2381 | AlwaysInlineAttr *AlwaysInlineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, AlwaysInlineAttr::Spelling S) { |
||
2382 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
2383 | return CreateImplicit(Ctx, I); |
||
2384 | } |
||
2385 | |||
2386 | AlwaysInlineAttr *AlwaysInlineAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, AlwaysInlineAttr::Spelling S) { |
||
2387 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
2388 | return Create(Ctx, I); |
||
2389 | } |
||
2390 | |||
2391 | AlwaysInlineAttr::AlwaysInlineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2392 | ) |
||
2393 | : DeclOrStmtAttr(Ctx, CommonInfo, attr::AlwaysInline, false, false) |
||
2394 | { |
||
2395 | } |
||
2396 | |||
2397 | AlwaysInlineAttr::Spelling AlwaysInlineAttr::getSemanticSpelling() const { |
||
2398 | switch (getAttributeSpellingListIndex()) { |
||
2399 | default: llvm_unreachable("Unknown spelling list index"); |
||
2400 | case 0: return GNU_always_inline; |
||
2401 | case 1: return CXX11_gnu_always_inline; |
||
2402 | case 2: return C2x_gnu_always_inline; |
||
2403 | case 3: return CXX11_clang_always_inline; |
||
2404 | case 4: return C2x_clang_always_inline; |
||
2405 | case 5: return Keyword_forceinline; |
||
2406 | } |
||
2407 | } |
||
2408 | AlwaysInlineAttr *AlwaysInlineAttr::clone(ASTContext &C) const { |
||
2409 | auto *A = new (C) AlwaysInlineAttr(C, *this); |
||
2410 | A->Inherited = Inherited; |
||
2411 | A->IsPackExpansion = IsPackExpansion; |
||
2412 | A->setImplicit(Implicit); |
||
2413 | return A; |
||
2414 | } |
||
2415 | |||
2416 | void AlwaysInlineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
2417 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
2418 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
2419 | switch (getAttributeSpellingListIndex()) { |
||
2420 | default: |
||
2421 | llvm_unreachable("Unknown attribute spelling!"); |
||
2422 | break; |
||
2423 | case 0 : { |
||
2424 | OS << " __attribute__((always_inline"; |
||
2425 | OS << "))"; |
||
2426 | break; |
||
2427 | } |
||
2428 | case 1 : { |
||
2429 | OS << " [[gnu::always_inline"; |
||
2430 | OS << "]]"; |
||
2431 | break; |
||
2432 | } |
||
2433 | case 2 : { |
||
2434 | OS << " [[gnu::always_inline"; |
||
2435 | OS << "]]"; |
||
2436 | break; |
||
2437 | } |
||
2438 | case 3 : { |
||
2439 | OS << " [[clang::always_inline"; |
||
2440 | OS << "]]"; |
||
2441 | break; |
||
2442 | } |
||
2443 | case 4 : { |
||
2444 | OS << " [[clang::always_inline"; |
||
2445 | OS << "]]"; |
||
2446 | break; |
||
2447 | } |
||
2448 | case 5 : { |
||
2449 | OS << " __forceinline"; |
||
2450 | OS << ""; |
||
2451 | break; |
||
2452 | } |
||
2453 | } |
||
2454 | } |
||
2455 | |||
2456 | const char *AlwaysInlineAttr::getSpelling() const { |
||
2457 | switch (getAttributeSpellingListIndex()) { |
||
2458 | default: |
||
2459 | llvm_unreachable("Unknown attribute spelling!"); |
||
2460 | return "(No spelling)"; |
||
2461 | case 0: |
||
2462 | return "always_inline"; |
||
2463 | case 1: |
||
2464 | return "always_inline"; |
||
2465 | case 2: |
||
2466 | return "always_inline"; |
||
2467 | case 3: |
||
2468 | return "always_inline"; |
||
2469 | case 4: |
||
2470 | return "always_inline"; |
||
2471 | case 5: |
||
2472 | return "__forceinline"; |
||
2473 | } |
||
2474 | } |
||
2475 | |||
2476 | |||
2477 | // AnalyzerNoReturnAttr implementation |
||
2478 | |||
2479 | AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2480 | auto *A = new (Ctx) AnalyzerNoReturnAttr(Ctx, CommonInfo); |
||
2481 | A->setImplicit(true); |
||
2482 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2483 | A->setAttributeSpellingListIndex(0); |
||
2484 | return A; |
||
2485 | } |
||
2486 | |||
2487 | AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2488 | auto *A = new (Ctx) AnalyzerNoReturnAttr(Ctx, CommonInfo); |
||
2489 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2490 | A->setAttributeSpellingListIndex(0); |
||
2491 | return A; |
||
2492 | } |
||
2493 | |||
2494 | AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2495 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2496 | return CreateImplicit(Ctx, I); |
||
2497 | } |
||
2498 | |||
2499 | AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2500 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2501 | return Create(Ctx, I); |
||
2502 | } |
||
2503 | |||
2504 | AnalyzerNoReturnAttr::AnalyzerNoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2505 | ) |
||
2506 | : InheritableAttr(Ctx, CommonInfo, attr::AnalyzerNoReturn, false, false) |
||
2507 | { |
||
2508 | } |
||
2509 | |||
2510 | AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::clone(ASTContext &C) const { |
||
2511 | auto *A = new (C) AnalyzerNoReturnAttr(C, *this); |
||
2512 | A->Inherited = Inherited; |
||
2513 | A->IsPackExpansion = IsPackExpansion; |
||
2514 | A->setImplicit(Implicit); |
||
2515 | return A; |
||
2516 | } |
||
2517 | |||
2518 | void AnalyzerNoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
2519 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
2520 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
2521 | switch (getAttributeSpellingListIndex()) { |
||
2522 | default: |
||
2523 | llvm_unreachable("Unknown attribute spelling!"); |
||
2524 | break; |
||
2525 | case 0 : { |
||
2526 | OS << " __attribute__((analyzer_noreturn"; |
||
2527 | OS << "))"; |
||
2528 | break; |
||
2529 | } |
||
2530 | } |
||
2531 | } |
||
2532 | |||
2533 | const char *AnalyzerNoReturnAttr::getSpelling() const { |
||
2534 | switch (getAttributeSpellingListIndex()) { |
||
2535 | default: |
||
2536 | llvm_unreachable("Unknown attribute spelling!"); |
||
2537 | return "(No spelling)"; |
||
2538 | case 0: |
||
2539 | return "analyzer_noreturn"; |
||
2540 | } |
||
2541 | } |
||
2542 | |||
2543 | |||
2544 | // AnnotateAttr implementation |
||
2545 | |||
2546 | AnnotateAttr *AnnotateAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
2547 | auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize); |
||
2548 | A->setImplicit(true); |
||
2549 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2550 | A->setAttributeSpellingListIndex(0); |
||
2551 | return A; |
||
2552 | } |
||
2553 | |||
2554 | AnnotateAttr *AnnotateAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
2555 | auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize); |
||
2556 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2557 | A->setAttributeSpellingListIndex(0); |
||
2558 | return A; |
||
2559 | } |
||
2560 | |||
2561 | AnnotateAttr *AnnotateAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2562 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2563 | return CreateImplicit(Ctx, Annotation, Args, ArgsSize, I); |
||
2564 | } |
||
2565 | |||
2566 | AnnotateAttr *AnnotateAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2567 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2568 | return Create(Ctx, Annotation, Args, ArgsSize, I); |
||
2569 | } |
||
2570 | |||
2571 | AnnotateAttr *AnnotateAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
2572 | auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo); |
||
2573 | A->setImplicit(true); |
||
2574 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2575 | A->setAttributeSpellingListIndex(0); |
||
2576 | A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize); |
||
2577 | return A; |
||
2578 | } |
||
2579 | |||
2580 | AnnotateAttr *AnnotateAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
2581 | auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo); |
||
2582 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2583 | A->setAttributeSpellingListIndex(0); |
||
2584 | A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize); |
||
2585 | return A; |
||
2586 | } |
||
2587 | |||
2588 | AnnotateAttr *AnnotateAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2589 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2590 | return CreateImplicitWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I); |
||
2591 | } |
||
2592 | |||
2593 | AnnotateAttr *AnnotateAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2594 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2595 | return CreateWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I); |
||
2596 | } |
||
2597 | |||
2598 | AnnotateAttr::AnnotateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2599 | , llvm::StringRef Annotation |
||
2600 | , Expr * *Args, unsigned ArgsSize |
||
2601 | ) |
||
2602 | : InheritableParamAttr(Ctx, CommonInfo, attr::Annotate, false, false) |
||
2603 | , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength]) |
||
2604 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
2605 | , delayedArgs_Size(0), delayedArgs_(nullptr) |
||
2606 | { |
||
2607 | if (!Annotation.empty()) |
||
2608 | std::memcpy(annotation, Annotation.data(), annotationLength); |
||
2609 | std::copy(Args, Args + args_Size, args_); |
||
2610 | } |
||
2611 | |||
2612 | AnnotateAttr::AnnotateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2613 | , llvm::StringRef Annotation |
||
2614 | ) |
||
2615 | : InheritableParamAttr(Ctx, CommonInfo, attr::Annotate, false, false) |
||
2616 | , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength]) |
||
2617 | , args_Size(0), args_(nullptr) |
||
2618 | , delayedArgs_Size(0), delayedArgs_(nullptr) |
||
2619 | { |
||
2620 | if (!Annotation.empty()) |
||
2621 | std::memcpy(annotation, Annotation.data(), annotationLength); |
||
2622 | } |
||
2623 | |||
2624 | AnnotateAttr::AnnotateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2625 | ) |
||
2626 | : InheritableParamAttr(Ctx, CommonInfo, attr::Annotate, false, false) |
||
2627 | , annotationLength(0),annotation(nullptr) |
||
2628 | , args_Size(0), args_(nullptr) |
||
2629 | , delayedArgs_Size(0), delayedArgs_(nullptr) |
||
2630 | { |
||
2631 | } |
||
2632 | |||
2633 | |||
2634 | |||
2635 | |||
2636 | |||
2637 | AnnotateAttr *AnnotateAttr::clone(ASTContext &C) const { |
||
2638 | auto *A = new (C) AnnotateAttr(C, *this, getAnnotation(), args_, args_Size); |
||
2639 | A->Inherited = Inherited; |
||
2640 | A->IsPackExpansion = IsPackExpansion; |
||
2641 | A->setImplicit(Implicit); |
||
2642 | A->setDelayedArgs(C, delayedArgs_, delayedArgs_Size); |
||
2643 | return A; |
||
2644 | } |
||
2645 | |||
2646 | void AnnotateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
2647 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
2648 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
2649 | switch (getAttributeSpellingListIndex()) { |
||
2650 | default: |
||
2651 | llvm_unreachable("Unknown attribute spelling!"); |
||
2652 | break; |
||
2653 | case 0 : { |
||
2654 | OS << " __attribute__((annotate"; |
||
2655 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2656 | OS << "\"" << getAnnotation() << "\""; |
||
2657 | OS << ""; |
||
2658 | for (const auto &Val : args()) { |
||
2659 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2660 | OS << Val; |
||
2661 | } |
||
2662 | OS << ""; |
||
2663 | if (!IsFirstArgument) |
||
2664 | OS << ")"; |
||
2665 | OS << "))"; |
||
2666 | break; |
||
2667 | } |
||
2668 | case 1 : { |
||
2669 | OS << " [[clang::annotate"; |
||
2670 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2671 | OS << "\"" << getAnnotation() << "\""; |
||
2672 | OS << ""; |
||
2673 | for (const auto &Val : args()) { |
||
2674 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2675 | OS << Val; |
||
2676 | } |
||
2677 | OS << ""; |
||
2678 | if (!IsFirstArgument) |
||
2679 | OS << ")"; |
||
2680 | OS << "]]"; |
||
2681 | break; |
||
2682 | } |
||
2683 | case 2 : { |
||
2684 | OS << " [[clang::annotate"; |
||
2685 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2686 | OS << "\"" << getAnnotation() << "\""; |
||
2687 | OS << ""; |
||
2688 | for (const auto &Val : args()) { |
||
2689 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2690 | OS << Val; |
||
2691 | } |
||
2692 | OS << ""; |
||
2693 | if (!IsFirstArgument) |
||
2694 | OS << ")"; |
||
2695 | OS << "]]"; |
||
2696 | break; |
||
2697 | } |
||
2698 | } |
||
2699 | } |
||
2700 | |||
2701 | const char *AnnotateAttr::getSpelling() const { |
||
2702 | switch (getAttributeSpellingListIndex()) { |
||
2703 | default: |
||
2704 | llvm_unreachable("Unknown attribute spelling!"); |
||
2705 | return "(No spelling)"; |
||
2706 | case 0: |
||
2707 | return "annotate"; |
||
2708 | case 1: |
||
2709 | return "annotate"; |
||
2710 | case 2: |
||
2711 | return "annotate"; |
||
2712 | } |
||
2713 | } |
||
2714 | |||
2715 | |||
2716 | // AnnotateTypeAttr implementation |
||
2717 | |||
2718 | AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
2719 | auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize); |
||
2720 | A->setImplicit(true); |
||
2721 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2722 | A->setAttributeSpellingListIndex(0); |
||
2723 | return A; |
||
2724 | } |
||
2725 | |||
2726 | AnnotateTypeAttr *AnnotateTypeAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
2727 | auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize); |
||
2728 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2729 | A->setAttributeSpellingListIndex(0); |
||
2730 | return A; |
||
2731 | } |
||
2732 | |||
2733 | AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2734 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2735 | return CreateImplicit(Ctx, Annotation, Args, ArgsSize, I); |
||
2736 | } |
||
2737 | |||
2738 | AnnotateTypeAttr *AnnotateTypeAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2739 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2740 | return Create(Ctx, Annotation, Args, ArgsSize, I); |
||
2741 | } |
||
2742 | |||
2743 | AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
2744 | auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo); |
||
2745 | A->setImplicit(true); |
||
2746 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2747 | A->setAttributeSpellingListIndex(0); |
||
2748 | A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize); |
||
2749 | return A; |
||
2750 | } |
||
2751 | |||
2752 | AnnotateTypeAttr *AnnotateTypeAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
2753 | auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo); |
||
2754 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2755 | A->setAttributeSpellingListIndex(0); |
||
2756 | A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize); |
||
2757 | return A; |
||
2758 | } |
||
2759 | |||
2760 | AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2761 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2762 | return CreateImplicitWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I); |
||
2763 | } |
||
2764 | |||
2765 | AnnotateTypeAttr *AnnotateTypeAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2766 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2767 | return CreateWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I); |
||
2768 | } |
||
2769 | |||
2770 | AnnotateTypeAttr::AnnotateTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2771 | , llvm::StringRef Annotation |
||
2772 | , Expr * *Args, unsigned ArgsSize |
||
2773 | ) |
||
2774 | : TypeAttr(Ctx, CommonInfo, attr::AnnotateType, false) |
||
2775 | , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength]) |
||
2776 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
2777 | , delayedArgs_Size(0), delayedArgs_(nullptr) |
||
2778 | { |
||
2779 | if (!Annotation.empty()) |
||
2780 | std::memcpy(annotation, Annotation.data(), annotationLength); |
||
2781 | std::copy(Args, Args + args_Size, args_); |
||
2782 | } |
||
2783 | |||
2784 | AnnotateTypeAttr::AnnotateTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2785 | , llvm::StringRef Annotation |
||
2786 | ) |
||
2787 | : TypeAttr(Ctx, CommonInfo, attr::AnnotateType, false) |
||
2788 | , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength]) |
||
2789 | , args_Size(0), args_(nullptr) |
||
2790 | , delayedArgs_Size(0), delayedArgs_(nullptr) |
||
2791 | { |
||
2792 | if (!Annotation.empty()) |
||
2793 | std::memcpy(annotation, Annotation.data(), annotationLength); |
||
2794 | } |
||
2795 | |||
2796 | AnnotateTypeAttr::AnnotateTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2797 | ) |
||
2798 | : TypeAttr(Ctx, CommonInfo, attr::AnnotateType, false) |
||
2799 | , annotationLength(0),annotation(nullptr) |
||
2800 | , args_Size(0), args_(nullptr) |
||
2801 | , delayedArgs_Size(0), delayedArgs_(nullptr) |
||
2802 | { |
||
2803 | } |
||
2804 | |||
2805 | |||
2806 | |||
2807 | |||
2808 | |||
2809 | AnnotateTypeAttr *AnnotateTypeAttr::clone(ASTContext &C) const { |
||
2810 | auto *A = new (C) AnnotateTypeAttr(C, *this, getAnnotation(), args_, args_Size); |
||
2811 | A->Inherited = Inherited; |
||
2812 | A->IsPackExpansion = IsPackExpansion; |
||
2813 | A->setImplicit(Implicit); |
||
2814 | A->setDelayedArgs(C, delayedArgs_, delayedArgs_Size); |
||
2815 | return A; |
||
2816 | } |
||
2817 | |||
2818 | void AnnotateTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
2819 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
2820 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
2821 | switch (getAttributeSpellingListIndex()) { |
||
2822 | default: |
||
2823 | llvm_unreachable("Unknown attribute spelling!"); |
||
2824 | break; |
||
2825 | case 0 : { |
||
2826 | OS << " [[clang::annotate_type"; |
||
2827 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2828 | OS << "\"" << getAnnotation() << "\""; |
||
2829 | OS << ""; |
||
2830 | for (const auto &Val : args()) { |
||
2831 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2832 | OS << Val; |
||
2833 | } |
||
2834 | OS << ""; |
||
2835 | if (!IsFirstArgument) |
||
2836 | OS << ")"; |
||
2837 | OS << "]]"; |
||
2838 | break; |
||
2839 | } |
||
2840 | case 1 : { |
||
2841 | OS << " [[clang::annotate_type"; |
||
2842 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2843 | OS << "\"" << getAnnotation() << "\""; |
||
2844 | OS << ""; |
||
2845 | for (const auto &Val : args()) { |
||
2846 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
2847 | OS << Val; |
||
2848 | } |
||
2849 | OS << ""; |
||
2850 | if (!IsFirstArgument) |
||
2851 | OS << ")"; |
||
2852 | OS << "]]"; |
||
2853 | break; |
||
2854 | } |
||
2855 | } |
||
2856 | } |
||
2857 | |||
2858 | const char *AnnotateTypeAttr::getSpelling() const { |
||
2859 | switch (getAttributeSpellingListIndex()) { |
||
2860 | default: |
||
2861 | llvm_unreachable("Unknown attribute spelling!"); |
||
2862 | return "(No spelling)"; |
||
2863 | case 0: |
||
2864 | return "annotate_type"; |
||
2865 | case 1: |
||
2866 | return "annotate_type"; |
||
2867 | } |
||
2868 | } |
||
2869 | |||
2870 | |||
2871 | // AnyX86InterruptAttr implementation |
||
2872 | |||
2873 | AnyX86InterruptAttr *AnyX86InterruptAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2874 | auto *A = new (Ctx) AnyX86InterruptAttr(Ctx, CommonInfo); |
||
2875 | A->setImplicit(true); |
||
2876 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2877 | A->setAttributeSpellingListIndex(0); |
||
2878 | return A; |
||
2879 | } |
||
2880 | |||
2881 | AnyX86InterruptAttr *AnyX86InterruptAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2882 | auto *A = new (Ctx) AnyX86InterruptAttr(Ctx, CommonInfo); |
||
2883 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2884 | A->setAttributeSpellingListIndex(0); |
||
2885 | return A; |
||
2886 | } |
||
2887 | |||
2888 | AnyX86InterruptAttr *AnyX86InterruptAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2889 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2890 | return CreateImplicit(Ctx, I); |
||
2891 | } |
||
2892 | |||
2893 | AnyX86InterruptAttr *AnyX86InterruptAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2894 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2895 | return Create(Ctx, I); |
||
2896 | } |
||
2897 | |||
2898 | AnyX86InterruptAttr::AnyX86InterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2899 | ) |
||
2900 | : InheritableAttr(Ctx, CommonInfo, attr::AnyX86Interrupt, false, false) |
||
2901 | { |
||
2902 | } |
||
2903 | |||
2904 | AnyX86InterruptAttr *AnyX86InterruptAttr::clone(ASTContext &C) const { |
||
2905 | auto *A = new (C) AnyX86InterruptAttr(C, *this); |
||
2906 | A->Inherited = Inherited; |
||
2907 | A->IsPackExpansion = IsPackExpansion; |
||
2908 | A->setImplicit(Implicit); |
||
2909 | return A; |
||
2910 | } |
||
2911 | |||
2912 | void AnyX86InterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
2913 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
2914 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
2915 | switch (getAttributeSpellingListIndex()) { |
||
2916 | default: |
||
2917 | llvm_unreachable("Unknown attribute spelling!"); |
||
2918 | break; |
||
2919 | case 0 : { |
||
2920 | OS << " __attribute__((interrupt"; |
||
2921 | OS << "))"; |
||
2922 | break; |
||
2923 | } |
||
2924 | case 1 : { |
||
2925 | OS << " [[gnu::interrupt"; |
||
2926 | OS << "]]"; |
||
2927 | break; |
||
2928 | } |
||
2929 | case 2 : { |
||
2930 | OS << " [[gnu::interrupt"; |
||
2931 | OS << "]]"; |
||
2932 | break; |
||
2933 | } |
||
2934 | } |
||
2935 | } |
||
2936 | |||
2937 | const char *AnyX86InterruptAttr::getSpelling() const { |
||
2938 | switch (getAttributeSpellingListIndex()) { |
||
2939 | default: |
||
2940 | llvm_unreachable("Unknown attribute spelling!"); |
||
2941 | return "(No spelling)"; |
||
2942 | case 0: |
||
2943 | return "interrupt"; |
||
2944 | case 1: |
||
2945 | return "interrupt"; |
||
2946 | case 2: |
||
2947 | return "interrupt"; |
||
2948 | } |
||
2949 | } |
||
2950 | |||
2951 | |||
2952 | // AnyX86NoCallerSavedRegistersAttr implementation |
||
2953 | |||
2954 | AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2955 | auto *A = new (Ctx) AnyX86NoCallerSavedRegistersAttr(Ctx, CommonInfo); |
||
2956 | A->setImplicit(true); |
||
2957 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2958 | A->setAttributeSpellingListIndex(0); |
||
2959 | return A; |
||
2960 | } |
||
2961 | |||
2962 | AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
2963 | auto *A = new (Ctx) AnyX86NoCallerSavedRegistersAttr(Ctx, CommonInfo); |
||
2964 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
2965 | A->setAttributeSpellingListIndex(0); |
||
2966 | return A; |
||
2967 | } |
||
2968 | |||
2969 | AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2970 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2971 | return CreateImplicit(Ctx, I); |
||
2972 | } |
||
2973 | |||
2974 | AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
2975 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
2976 | return Create(Ctx, I); |
||
2977 | } |
||
2978 | |||
2979 | AnyX86NoCallerSavedRegistersAttr::AnyX86NoCallerSavedRegistersAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
2980 | ) |
||
2981 | : InheritableAttr(Ctx, CommonInfo, attr::AnyX86NoCallerSavedRegisters, false, false) |
||
2982 | { |
||
2983 | } |
||
2984 | |||
2985 | AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::clone(ASTContext &C) const { |
||
2986 | auto *A = new (C) AnyX86NoCallerSavedRegistersAttr(C, *this); |
||
2987 | A->Inherited = Inherited; |
||
2988 | A->IsPackExpansion = IsPackExpansion; |
||
2989 | A->setImplicit(Implicit); |
||
2990 | return A; |
||
2991 | } |
||
2992 | |||
2993 | void AnyX86NoCallerSavedRegistersAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
2994 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
2995 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
2996 | switch (getAttributeSpellingListIndex()) { |
||
2997 | default: |
||
2998 | llvm_unreachable("Unknown attribute spelling!"); |
||
2999 | break; |
||
3000 | case 0 : { |
||
3001 | OS << " __attribute__((no_caller_saved_registers"; |
||
3002 | OS << "))"; |
||
3003 | break; |
||
3004 | } |
||
3005 | case 1 : { |
||
3006 | OS << " [[gnu::no_caller_saved_registers"; |
||
3007 | OS << "]]"; |
||
3008 | break; |
||
3009 | } |
||
3010 | case 2 : { |
||
3011 | OS << " [[gnu::no_caller_saved_registers"; |
||
3012 | OS << "]]"; |
||
3013 | break; |
||
3014 | } |
||
3015 | } |
||
3016 | } |
||
3017 | |||
3018 | const char *AnyX86NoCallerSavedRegistersAttr::getSpelling() const { |
||
3019 | switch (getAttributeSpellingListIndex()) { |
||
3020 | default: |
||
3021 | llvm_unreachable("Unknown attribute spelling!"); |
||
3022 | return "(No spelling)"; |
||
3023 | case 0: |
||
3024 | return "no_caller_saved_registers"; |
||
3025 | case 1: |
||
3026 | return "no_caller_saved_registers"; |
||
3027 | case 2: |
||
3028 | return "no_caller_saved_registers"; |
||
3029 | } |
||
3030 | } |
||
3031 | |||
3032 | |||
3033 | // AnyX86NoCfCheckAttr implementation |
||
3034 | |||
3035 | AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
3036 | auto *A = new (Ctx) AnyX86NoCfCheckAttr(Ctx, CommonInfo); |
||
3037 | A->setImplicit(true); |
||
3038 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3039 | A->setAttributeSpellingListIndex(0); |
||
3040 | return A; |
||
3041 | } |
||
3042 | |||
3043 | AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
3044 | auto *A = new (Ctx) AnyX86NoCfCheckAttr(Ctx, CommonInfo); |
||
3045 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3046 | A->setAttributeSpellingListIndex(0); |
||
3047 | return A; |
||
3048 | } |
||
3049 | |||
3050 | AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3051 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3052 | return CreateImplicit(Ctx, I); |
||
3053 | } |
||
3054 | |||
3055 | AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3056 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3057 | return Create(Ctx, I); |
||
3058 | } |
||
3059 | |||
3060 | AnyX86NoCfCheckAttr::AnyX86NoCfCheckAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3061 | ) |
||
3062 | : InheritableAttr(Ctx, CommonInfo, attr::AnyX86NoCfCheck, false, false) |
||
3063 | { |
||
3064 | } |
||
3065 | |||
3066 | AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::clone(ASTContext &C) const { |
||
3067 | auto *A = new (C) AnyX86NoCfCheckAttr(C, *this); |
||
3068 | A->Inherited = Inherited; |
||
3069 | A->IsPackExpansion = IsPackExpansion; |
||
3070 | A->setImplicit(Implicit); |
||
3071 | return A; |
||
3072 | } |
||
3073 | |||
3074 | void AnyX86NoCfCheckAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
3075 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
3076 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
3077 | switch (getAttributeSpellingListIndex()) { |
||
3078 | default: |
||
3079 | llvm_unreachable("Unknown attribute spelling!"); |
||
3080 | break; |
||
3081 | case 0 : { |
||
3082 | OS << " __attribute__((nocf_check"; |
||
3083 | OS << "))"; |
||
3084 | break; |
||
3085 | } |
||
3086 | case 1 : { |
||
3087 | OS << " [[gnu::nocf_check"; |
||
3088 | OS << "]]"; |
||
3089 | break; |
||
3090 | } |
||
3091 | case 2 : { |
||
3092 | OS << " [[gnu::nocf_check"; |
||
3093 | OS << "]]"; |
||
3094 | break; |
||
3095 | } |
||
3096 | } |
||
3097 | } |
||
3098 | |||
3099 | const char *AnyX86NoCfCheckAttr::getSpelling() const { |
||
3100 | switch (getAttributeSpellingListIndex()) { |
||
3101 | default: |
||
3102 | llvm_unreachable("Unknown attribute spelling!"); |
||
3103 | return "(No spelling)"; |
||
3104 | case 0: |
||
3105 | return "nocf_check"; |
||
3106 | case 1: |
||
3107 | return "nocf_check"; |
||
3108 | case 2: |
||
3109 | return "nocf_check"; |
||
3110 | } |
||
3111 | } |
||
3112 | |||
3113 | |||
3114 | // ArcWeakrefUnavailableAttr implementation |
||
3115 | |||
3116 | ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
3117 | auto *A = new (Ctx) ArcWeakrefUnavailableAttr(Ctx, CommonInfo); |
||
3118 | A->setImplicit(true); |
||
3119 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3120 | A->setAttributeSpellingListIndex(0); |
||
3121 | return A; |
||
3122 | } |
||
3123 | |||
3124 | ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
3125 | auto *A = new (Ctx) ArcWeakrefUnavailableAttr(Ctx, CommonInfo); |
||
3126 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3127 | A->setAttributeSpellingListIndex(0); |
||
3128 | return A; |
||
3129 | } |
||
3130 | |||
3131 | ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3132 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3133 | return CreateImplicit(Ctx, I); |
||
3134 | } |
||
3135 | |||
3136 | ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3137 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3138 | return Create(Ctx, I); |
||
3139 | } |
||
3140 | |||
3141 | ArcWeakrefUnavailableAttr::ArcWeakrefUnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3142 | ) |
||
3143 | : InheritableAttr(Ctx, CommonInfo, attr::ArcWeakrefUnavailable, false, false) |
||
3144 | { |
||
3145 | } |
||
3146 | |||
3147 | ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::clone(ASTContext &C) const { |
||
3148 | auto *A = new (C) ArcWeakrefUnavailableAttr(C, *this); |
||
3149 | A->Inherited = Inherited; |
||
3150 | A->IsPackExpansion = IsPackExpansion; |
||
3151 | A->setImplicit(Implicit); |
||
3152 | return A; |
||
3153 | } |
||
3154 | |||
3155 | void ArcWeakrefUnavailableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
3156 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
3157 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
3158 | switch (getAttributeSpellingListIndex()) { |
||
3159 | default: |
||
3160 | llvm_unreachable("Unknown attribute spelling!"); |
||
3161 | break; |
||
3162 | case 0 : { |
||
3163 | OS << " __attribute__((objc_arc_weak_reference_unavailable"; |
||
3164 | OS << "))"; |
||
3165 | break; |
||
3166 | } |
||
3167 | case 1 : { |
||
3168 | OS << " [[clang::objc_arc_weak_reference_unavailable"; |
||
3169 | OS << "]]"; |
||
3170 | break; |
||
3171 | } |
||
3172 | case 2 : { |
||
3173 | OS << " [[clang::objc_arc_weak_reference_unavailable"; |
||
3174 | OS << "]]"; |
||
3175 | break; |
||
3176 | } |
||
3177 | } |
||
3178 | } |
||
3179 | |||
3180 | const char *ArcWeakrefUnavailableAttr::getSpelling() const { |
||
3181 | switch (getAttributeSpellingListIndex()) { |
||
3182 | default: |
||
3183 | llvm_unreachable("Unknown attribute spelling!"); |
||
3184 | return "(No spelling)"; |
||
3185 | case 0: |
||
3186 | return "objc_arc_weak_reference_unavailable"; |
||
3187 | case 1: |
||
3188 | return "objc_arc_weak_reference_unavailable"; |
||
3189 | case 2: |
||
3190 | return "objc_arc_weak_reference_unavailable"; |
||
3191 | } |
||
3192 | } |
||
3193 | |||
3194 | |||
3195 | // ArgumentWithTypeTagAttr implementation |
||
3196 | |||
3197 | ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, const AttributeCommonInfo &CommonInfo) { |
||
3198 | auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer); |
||
3199 | A->setImplicit(true); |
||
3200 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3201 | A->setAttributeSpellingListIndex(0); |
||
3202 | return A; |
||
3203 | } |
||
3204 | |||
3205 | ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, const AttributeCommonInfo &CommonInfo) { |
||
3206 | auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer); |
||
3207 | return A; |
||
3208 | } |
||
3209 | |||
3210 | ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ArgumentWithTypeTagAttr::Spelling S) { |
||
3211 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
3212 | return CreateImplicit(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer, I); |
||
3213 | } |
||
3214 | |||
3215 | ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ArgumentWithTypeTagAttr::Spelling S) { |
||
3216 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
3217 | return Create(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer, I); |
||
3218 | } |
||
3219 | |||
3220 | ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, const AttributeCommonInfo &CommonInfo) { |
||
3221 | auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx); |
||
3222 | A->setImplicit(true); |
||
3223 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3224 | A->setAttributeSpellingListIndex(0); |
||
3225 | return A; |
||
3226 | } |
||
3227 | |||
3228 | ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, const AttributeCommonInfo &CommonInfo) { |
||
3229 | auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx); |
||
3230 | return A; |
||
3231 | } |
||
3232 | |||
3233 | ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ArgumentWithTypeTagAttr::Spelling S) { |
||
3234 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
3235 | return CreateImplicit(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, I); |
||
3236 | } |
||
3237 | |||
3238 | ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ArgumentWithTypeTagAttr::Spelling S) { |
||
3239 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
3240 | return Create(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, I); |
||
3241 | } |
||
3242 | |||
3243 | ArgumentWithTypeTagAttr::ArgumentWithTypeTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3244 | , IdentifierInfo * ArgumentKind |
||
3245 | , ParamIdx ArgumentIdx |
||
3246 | , ParamIdx TypeTagIdx |
||
3247 | , bool IsPointer |
||
3248 | ) |
||
3249 | : InheritableAttr(Ctx, CommonInfo, attr::ArgumentWithTypeTag, false, false) |
||
3250 | , argumentKind(ArgumentKind) |
||
3251 | , argumentIdx(ArgumentIdx) |
||
3252 | , typeTagIdx(TypeTagIdx) |
||
3253 | , isPointer(IsPointer) |
||
3254 | { |
||
3255 | } |
||
3256 | |||
3257 | ArgumentWithTypeTagAttr::ArgumentWithTypeTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3258 | , IdentifierInfo * ArgumentKind |
||
3259 | , ParamIdx ArgumentIdx |
||
3260 | , ParamIdx TypeTagIdx |
||
3261 | ) |
||
3262 | : InheritableAttr(Ctx, CommonInfo, attr::ArgumentWithTypeTag, false, false) |
||
3263 | , argumentKind(ArgumentKind) |
||
3264 | , argumentIdx(ArgumentIdx) |
||
3265 | , typeTagIdx(TypeTagIdx) |
||
3266 | , isPointer() |
||
3267 | { |
||
3268 | } |
||
3269 | |||
3270 | ArgumentWithTypeTagAttr::Spelling ArgumentWithTypeTagAttr::getSemanticSpelling() const { |
||
3271 | switch (getAttributeSpellingListIndex()) { |
||
3272 | default: llvm_unreachable("Unknown spelling list index"); |
||
3273 | case 0: return GNU_argument_with_type_tag; |
||
3274 | case 1: return CXX11_clang_argument_with_type_tag; |
||
3275 | case 2: return C2x_clang_argument_with_type_tag; |
||
3276 | case 3: return GNU_pointer_with_type_tag; |
||
3277 | case 4: return CXX11_clang_pointer_with_type_tag; |
||
3278 | case 5: return C2x_clang_pointer_with_type_tag; |
||
3279 | } |
||
3280 | } |
||
3281 | |||
3282 | |||
3283 | |||
3284 | |||
3285 | |||
3286 | |||
3287 | |||
3288 | |||
3289 | ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::clone(ASTContext &C) const { |
||
3290 | auto *A = new (C) ArgumentWithTypeTagAttr(C, *this, argumentKind, argumentIdx, typeTagIdx, isPointer); |
||
3291 | A->Inherited = Inherited; |
||
3292 | A->IsPackExpansion = IsPackExpansion; |
||
3293 | A->setImplicit(Implicit); |
||
3294 | return A; |
||
3295 | } |
||
3296 | |||
3297 | void ArgumentWithTypeTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
3298 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
3299 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
3300 | switch (getAttributeSpellingListIndex()) { |
||
3301 | default: |
||
3302 | llvm_unreachable("Unknown attribute spelling!"); |
||
3303 | break; |
||
3304 | case 0 : { |
||
3305 | OS << " __attribute__((argument_with_type_tag"; |
||
3306 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3307 | OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; |
||
3308 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3309 | OS << "" << getArgumentIdx().getSourceIndex() << ""; |
||
3310 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3311 | OS << "" << getTypeTagIdx().getSourceIndex() << ""; |
||
3312 | if (!IsFirstArgument) |
||
3313 | OS << ")"; |
||
3314 | OS << "))"; |
||
3315 | break; |
||
3316 | } |
||
3317 | case 1 : { |
||
3318 | OS << " [[clang::argument_with_type_tag"; |
||
3319 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3320 | OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; |
||
3321 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3322 | OS << "" << getArgumentIdx().getSourceIndex() << ""; |
||
3323 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3324 | OS << "" << getTypeTagIdx().getSourceIndex() << ""; |
||
3325 | if (!IsFirstArgument) |
||
3326 | OS << ")"; |
||
3327 | OS << "]]"; |
||
3328 | break; |
||
3329 | } |
||
3330 | case 2 : { |
||
3331 | OS << " [[clang::argument_with_type_tag"; |
||
3332 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3333 | OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; |
||
3334 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3335 | OS << "" << getArgumentIdx().getSourceIndex() << ""; |
||
3336 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3337 | OS << "" << getTypeTagIdx().getSourceIndex() << ""; |
||
3338 | if (!IsFirstArgument) |
||
3339 | OS << ")"; |
||
3340 | OS << "]]"; |
||
3341 | break; |
||
3342 | } |
||
3343 | case 3 : { |
||
3344 | OS << " __attribute__((pointer_with_type_tag"; |
||
3345 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3346 | OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; |
||
3347 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3348 | OS << "" << getArgumentIdx().getSourceIndex() << ""; |
||
3349 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3350 | OS << "" << getTypeTagIdx().getSourceIndex() << ""; |
||
3351 | if (!IsFirstArgument) |
||
3352 | OS << ")"; |
||
3353 | OS << "))"; |
||
3354 | break; |
||
3355 | } |
||
3356 | case 4 : { |
||
3357 | OS << " [[clang::pointer_with_type_tag"; |
||
3358 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3359 | OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; |
||
3360 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3361 | OS << "" << getArgumentIdx().getSourceIndex() << ""; |
||
3362 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3363 | OS << "" << getTypeTagIdx().getSourceIndex() << ""; |
||
3364 | if (!IsFirstArgument) |
||
3365 | OS << ")"; |
||
3366 | OS << "]]"; |
||
3367 | break; |
||
3368 | } |
||
3369 | case 5 : { |
||
3370 | OS << " [[clang::pointer_with_type_tag"; |
||
3371 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3372 | OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; |
||
3373 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3374 | OS << "" << getArgumentIdx().getSourceIndex() << ""; |
||
3375 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3376 | OS << "" << getTypeTagIdx().getSourceIndex() << ""; |
||
3377 | if (!IsFirstArgument) |
||
3378 | OS << ")"; |
||
3379 | OS << "]]"; |
||
3380 | break; |
||
3381 | } |
||
3382 | } |
||
3383 | } |
||
3384 | |||
3385 | const char *ArgumentWithTypeTagAttr::getSpelling() const { |
||
3386 | switch (getAttributeSpellingListIndex()) { |
||
3387 | default: |
||
3388 | llvm_unreachable("Unknown attribute spelling!"); |
||
3389 | return "(No spelling)"; |
||
3390 | case 0: |
||
3391 | return "argument_with_type_tag"; |
||
3392 | case 1: |
||
3393 | return "argument_with_type_tag"; |
||
3394 | case 2: |
||
3395 | return "argument_with_type_tag"; |
||
3396 | case 3: |
||
3397 | return "pointer_with_type_tag"; |
||
3398 | case 4: |
||
3399 | return "pointer_with_type_tag"; |
||
3400 | case 5: |
||
3401 | return "pointer_with_type_tag"; |
||
3402 | } |
||
3403 | } |
||
3404 | |||
3405 | |||
3406 | // ArmBuiltinAliasAttr implementation |
||
3407 | |||
3408 | ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) { |
||
3409 | auto *A = new (Ctx) ArmBuiltinAliasAttr(Ctx, CommonInfo, BuiltinName); |
||
3410 | A->setImplicit(true); |
||
3411 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3412 | A->setAttributeSpellingListIndex(0); |
||
3413 | return A; |
||
3414 | } |
||
3415 | |||
3416 | ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) { |
||
3417 | auto *A = new (Ctx) ArmBuiltinAliasAttr(Ctx, CommonInfo, BuiltinName); |
||
3418 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3419 | A->setAttributeSpellingListIndex(0); |
||
3420 | return A; |
||
3421 | } |
||
3422 | |||
3423 | ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3424 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3425 | return CreateImplicit(Ctx, BuiltinName, I); |
||
3426 | } |
||
3427 | |||
3428 | ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3429 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3430 | return Create(Ctx, BuiltinName, I); |
||
3431 | } |
||
3432 | |||
3433 | ArmBuiltinAliasAttr::ArmBuiltinAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3434 | , IdentifierInfo * BuiltinName |
||
3435 | ) |
||
3436 | : InheritableAttr(Ctx, CommonInfo, attr::ArmBuiltinAlias, false, false) |
||
3437 | , builtinName(BuiltinName) |
||
3438 | { |
||
3439 | } |
||
3440 | |||
3441 | |||
3442 | |||
3443 | ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::clone(ASTContext &C) const { |
||
3444 | auto *A = new (C) ArmBuiltinAliasAttr(C, *this, builtinName); |
||
3445 | A->Inherited = Inherited; |
||
3446 | A->IsPackExpansion = IsPackExpansion; |
||
3447 | A->setImplicit(Implicit); |
||
3448 | return A; |
||
3449 | } |
||
3450 | |||
3451 | void ArmBuiltinAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
3452 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
3453 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
3454 | switch (getAttributeSpellingListIndex()) { |
||
3455 | default: |
||
3456 | llvm_unreachable("Unknown attribute spelling!"); |
||
3457 | break; |
||
3458 | case 0 : { |
||
3459 | OS << " __attribute__((__clang_arm_builtin_alias"; |
||
3460 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3461 | OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; |
||
3462 | if (!IsFirstArgument) |
||
3463 | OS << ")"; |
||
3464 | OS << "))"; |
||
3465 | break; |
||
3466 | } |
||
3467 | case 1 : { |
||
3468 | OS << " [[clang::__clang_arm_builtin_alias"; |
||
3469 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3470 | OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; |
||
3471 | if (!IsFirstArgument) |
||
3472 | OS << ")"; |
||
3473 | OS << "]]"; |
||
3474 | break; |
||
3475 | } |
||
3476 | case 2 : { |
||
3477 | OS << " [[clang::__clang_arm_builtin_alias"; |
||
3478 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3479 | OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; |
||
3480 | if (!IsFirstArgument) |
||
3481 | OS << ")"; |
||
3482 | OS << "]]"; |
||
3483 | break; |
||
3484 | } |
||
3485 | } |
||
3486 | } |
||
3487 | |||
3488 | const char *ArmBuiltinAliasAttr::getSpelling() const { |
||
3489 | switch (getAttributeSpellingListIndex()) { |
||
3490 | default: |
||
3491 | llvm_unreachable("Unknown attribute spelling!"); |
||
3492 | return "(No spelling)"; |
||
3493 | case 0: |
||
3494 | return "__clang_arm_builtin_alias"; |
||
3495 | case 1: |
||
3496 | return "__clang_arm_builtin_alias"; |
||
3497 | case 2: |
||
3498 | return "__clang_arm_builtin_alias"; |
||
3499 | } |
||
3500 | } |
||
3501 | |||
3502 | |||
3503 | // ArmMveStrictPolymorphismAttr implementation |
||
3504 | |||
3505 | ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
3506 | auto *A = new (Ctx) ArmMveStrictPolymorphismAttr(Ctx, CommonInfo); |
||
3507 | A->setImplicit(true); |
||
3508 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3509 | A->setAttributeSpellingListIndex(0); |
||
3510 | return A; |
||
3511 | } |
||
3512 | |||
3513 | ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
3514 | auto *A = new (Ctx) ArmMveStrictPolymorphismAttr(Ctx, CommonInfo); |
||
3515 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3516 | A->setAttributeSpellingListIndex(0); |
||
3517 | return A; |
||
3518 | } |
||
3519 | |||
3520 | ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3521 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3522 | return CreateImplicit(Ctx, I); |
||
3523 | } |
||
3524 | |||
3525 | ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3526 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3527 | return Create(Ctx, I); |
||
3528 | } |
||
3529 | |||
3530 | ArmMveStrictPolymorphismAttr::ArmMveStrictPolymorphismAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3531 | ) |
||
3532 | : TypeAttr(Ctx, CommonInfo, attr::ArmMveStrictPolymorphism, false) |
||
3533 | { |
||
3534 | } |
||
3535 | |||
3536 | ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::clone(ASTContext &C) const { |
||
3537 | auto *A = new (C) ArmMveStrictPolymorphismAttr(C, *this); |
||
3538 | A->Inherited = Inherited; |
||
3539 | A->IsPackExpansion = IsPackExpansion; |
||
3540 | A->setImplicit(Implicit); |
||
3541 | return A; |
||
3542 | } |
||
3543 | |||
3544 | void ArmMveStrictPolymorphismAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
3545 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
3546 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
3547 | switch (getAttributeSpellingListIndex()) { |
||
3548 | default: |
||
3549 | llvm_unreachable("Unknown attribute spelling!"); |
||
3550 | break; |
||
3551 | case 0 : { |
||
3552 | OS << " __attribute__((__clang_arm_mve_strict_polymorphism"; |
||
3553 | OS << "))"; |
||
3554 | break; |
||
3555 | } |
||
3556 | case 1 : { |
||
3557 | OS << " [[clang::__clang_arm_mve_strict_polymorphism"; |
||
3558 | OS << "]]"; |
||
3559 | break; |
||
3560 | } |
||
3561 | case 2 : { |
||
3562 | OS << " [[clang::__clang_arm_mve_strict_polymorphism"; |
||
3563 | OS << "]]"; |
||
3564 | break; |
||
3565 | } |
||
3566 | } |
||
3567 | } |
||
3568 | |||
3569 | const char *ArmMveStrictPolymorphismAttr::getSpelling() const { |
||
3570 | switch (getAttributeSpellingListIndex()) { |
||
3571 | default: |
||
3572 | llvm_unreachable("Unknown attribute spelling!"); |
||
3573 | return "(No spelling)"; |
||
3574 | case 0: |
||
3575 | return "__clang_arm_mve_strict_polymorphism"; |
||
3576 | case 1: |
||
3577 | return "__clang_arm_mve_strict_polymorphism"; |
||
3578 | case 2: |
||
3579 | return "__clang_arm_mve_strict_polymorphism"; |
||
3580 | } |
||
3581 | } |
||
3582 | |||
3583 | |||
3584 | // ArtificialAttr implementation |
||
3585 | |||
3586 | ArtificialAttr *ArtificialAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
3587 | auto *A = new (Ctx) ArtificialAttr(Ctx, CommonInfo); |
||
3588 | A->setImplicit(true); |
||
3589 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3590 | A->setAttributeSpellingListIndex(0); |
||
3591 | return A; |
||
3592 | } |
||
3593 | |||
3594 | ArtificialAttr *ArtificialAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
3595 | auto *A = new (Ctx) ArtificialAttr(Ctx, CommonInfo); |
||
3596 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3597 | A->setAttributeSpellingListIndex(0); |
||
3598 | return A; |
||
3599 | } |
||
3600 | |||
3601 | ArtificialAttr *ArtificialAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3602 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3603 | return CreateImplicit(Ctx, I); |
||
3604 | } |
||
3605 | |||
3606 | ArtificialAttr *ArtificialAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3607 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3608 | return Create(Ctx, I); |
||
3609 | } |
||
3610 | |||
3611 | ArtificialAttr::ArtificialAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3612 | ) |
||
3613 | : InheritableAttr(Ctx, CommonInfo, attr::Artificial, false, false) |
||
3614 | { |
||
3615 | } |
||
3616 | |||
3617 | ArtificialAttr *ArtificialAttr::clone(ASTContext &C) const { |
||
3618 | auto *A = new (C) ArtificialAttr(C, *this); |
||
3619 | A->Inherited = Inherited; |
||
3620 | A->IsPackExpansion = IsPackExpansion; |
||
3621 | A->setImplicit(Implicit); |
||
3622 | return A; |
||
3623 | } |
||
3624 | |||
3625 | void ArtificialAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
3626 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
3627 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
3628 | switch (getAttributeSpellingListIndex()) { |
||
3629 | default: |
||
3630 | llvm_unreachable("Unknown attribute spelling!"); |
||
3631 | break; |
||
3632 | case 0 : { |
||
3633 | OS << " __attribute__((artificial"; |
||
3634 | OS << "))"; |
||
3635 | break; |
||
3636 | } |
||
3637 | case 1 : { |
||
3638 | OS << " [[gnu::artificial"; |
||
3639 | OS << "]]"; |
||
3640 | break; |
||
3641 | } |
||
3642 | case 2 : { |
||
3643 | OS << " [[gnu::artificial"; |
||
3644 | OS << "]]"; |
||
3645 | break; |
||
3646 | } |
||
3647 | } |
||
3648 | } |
||
3649 | |||
3650 | const char *ArtificialAttr::getSpelling() const { |
||
3651 | switch (getAttributeSpellingListIndex()) { |
||
3652 | default: |
||
3653 | llvm_unreachable("Unknown attribute spelling!"); |
||
3654 | return "(No spelling)"; |
||
3655 | case 0: |
||
3656 | return "artificial"; |
||
3657 | case 1: |
||
3658 | return "artificial"; |
||
3659 | case 2: |
||
3660 | return "artificial"; |
||
3661 | } |
||
3662 | } |
||
3663 | |||
3664 | |||
3665 | // AsmLabelAttr implementation |
||
3666 | |||
3667 | AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, const AttributeCommonInfo &CommonInfo) { |
||
3668 | auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label, IsLiteralLabel); |
||
3669 | A->setImplicit(true); |
||
3670 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3671 | A->setAttributeSpellingListIndex(0); |
||
3672 | return A; |
||
3673 | } |
||
3674 | |||
3675 | AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, const AttributeCommonInfo &CommonInfo) { |
||
3676 | auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label, IsLiteralLabel); |
||
3677 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3678 | A->setAttributeSpellingListIndex(0); |
||
3679 | return A; |
||
3680 | } |
||
3681 | |||
3682 | AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3683 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3684 | return CreateImplicit(Ctx, Label, IsLiteralLabel, I); |
||
3685 | } |
||
3686 | |||
3687 | AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3688 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3689 | return Create(Ctx, Label, IsLiteralLabel, I); |
||
3690 | } |
||
3691 | |||
3692 | AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, const AttributeCommonInfo &CommonInfo) { |
||
3693 | auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label); |
||
3694 | A->setImplicit(true); |
||
3695 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3696 | A->setAttributeSpellingListIndex(0); |
||
3697 | return A; |
||
3698 | } |
||
3699 | |||
3700 | AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, const AttributeCommonInfo &CommonInfo) { |
||
3701 | auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label); |
||
3702 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3703 | A->setAttributeSpellingListIndex(0); |
||
3704 | return A; |
||
3705 | } |
||
3706 | |||
3707 | AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3708 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3709 | return CreateImplicit(Ctx, Label, I); |
||
3710 | } |
||
3711 | |||
3712 | AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3713 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3714 | return Create(Ctx, Label, I); |
||
3715 | } |
||
3716 | |||
3717 | AsmLabelAttr::AsmLabelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3718 | , llvm::StringRef Label |
||
3719 | , bool IsLiteralLabel |
||
3720 | ) |
||
3721 | : InheritableAttr(Ctx, CommonInfo, attr::AsmLabel, false, false) |
||
3722 | , labelLength(Label.size()),label(new (Ctx, 1) char[labelLength]) |
||
3723 | , isLiteralLabel(IsLiteralLabel) |
||
3724 | { |
||
3725 | if (!Label.empty()) |
||
3726 | std::memcpy(label, Label.data(), labelLength); |
||
3727 | } |
||
3728 | |||
3729 | AsmLabelAttr::AsmLabelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3730 | , llvm::StringRef Label |
||
3731 | ) |
||
3732 | : InheritableAttr(Ctx, CommonInfo, attr::AsmLabel, false, false) |
||
3733 | , labelLength(Label.size()),label(new (Ctx, 1) char[labelLength]) |
||
3734 | , isLiteralLabel() |
||
3735 | { |
||
3736 | if (!Label.empty()) |
||
3737 | std::memcpy(label, Label.data(), labelLength); |
||
3738 | } |
||
3739 | |||
3740 | |||
3741 | |||
3742 | |||
3743 | |||
3744 | AsmLabelAttr *AsmLabelAttr::clone(ASTContext &C) const { |
||
3745 | auto *A = new (C) AsmLabelAttr(C, *this, getLabel(), isLiteralLabel); |
||
3746 | A->Inherited = Inherited; |
||
3747 | A->IsPackExpansion = IsPackExpansion; |
||
3748 | A->setImplicit(Implicit); |
||
3749 | return A; |
||
3750 | } |
||
3751 | |||
3752 | void AsmLabelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
3753 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
3754 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
3755 | switch (getAttributeSpellingListIndex()) { |
||
3756 | default: |
||
3757 | llvm_unreachable("Unknown attribute spelling!"); |
||
3758 | break; |
||
3759 | case 0 : { |
||
3760 | OS << " asm"; |
||
3761 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3762 | OS << "\"" << getLabel() << "\""; |
||
3763 | if (!IsFirstArgument) |
||
3764 | OS << ")"; |
||
3765 | OS << ""; |
||
3766 | break; |
||
3767 | } |
||
3768 | case 1 : { |
||
3769 | OS << " __asm__"; |
||
3770 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3771 | OS << "\"" << getLabel() << "\""; |
||
3772 | if (!IsFirstArgument) |
||
3773 | OS << ")"; |
||
3774 | OS << ""; |
||
3775 | break; |
||
3776 | } |
||
3777 | } |
||
3778 | } |
||
3779 | |||
3780 | const char *AsmLabelAttr::getSpelling() const { |
||
3781 | switch (getAttributeSpellingListIndex()) { |
||
3782 | default: |
||
3783 | llvm_unreachable("Unknown attribute spelling!"); |
||
3784 | return "(No spelling)"; |
||
3785 | case 0: |
||
3786 | return "asm"; |
||
3787 | case 1: |
||
3788 | return "__asm__"; |
||
3789 | } |
||
3790 | } |
||
3791 | |||
3792 | |||
3793 | // AssertCapabilityAttr implementation |
||
3794 | |||
3795 | AssertCapabilityAttr *AssertCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
3796 | auto *A = new (Ctx) AssertCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
3797 | A->setImplicit(true); |
||
3798 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3799 | A->setAttributeSpellingListIndex(0); |
||
3800 | return A; |
||
3801 | } |
||
3802 | |||
3803 | AssertCapabilityAttr *AssertCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
3804 | auto *A = new (Ctx) AssertCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
3805 | return A; |
||
3806 | } |
||
3807 | |||
3808 | AssertCapabilityAttr *AssertCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, AssertCapabilityAttr::Spelling S) { |
||
3809 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
3810 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
3811 | } |
||
3812 | |||
3813 | AssertCapabilityAttr *AssertCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, AssertCapabilityAttr::Spelling S) { |
||
3814 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
3815 | return Create(Ctx, Args, ArgsSize, I); |
||
3816 | } |
||
3817 | |||
3818 | AssertCapabilityAttr::AssertCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3819 | , Expr * *Args, unsigned ArgsSize |
||
3820 | ) |
||
3821 | : InheritableAttr(Ctx, CommonInfo, attr::AssertCapability, true, true) |
||
3822 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
3823 | { |
||
3824 | std::copy(Args, Args + args_Size, args_); |
||
3825 | } |
||
3826 | |||
3827 | AssertCapabilityAttr::AssertCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3828 | ) |
||
3829 | : InheritableAttr(Ctx, CommonInfo, attr::AssertCapability, true, true) |
||
3830 | , args_Size(0), args_(nullptr) |
||
3831 | { |
||
3832 | } |
||
3833 | |||
3834 | AssertCapabilityAttr::Spelling AssertCapabilityAttr::getSemanticSpelling() const { |
||
3835 | switch (getAttributeSpellingListIndex()) { |
||
3836 | default: llvm_unreachable("Unknown spelling list index"); |
||
3837 | case 0: return GNU_assert_capability; |
||
3838 | case 1: return CXX11_clang_assert_capability; |
||
3839 | case 2: return GNU_assert_shared_capability; |
||
3840 | case 3: return CXX11_clang_assert_shared_capability; |
||
3841 | } |
||
3842 | } |
||
3843 | |||
3844 | |||
3845 | AssertCapabilityAttr *AssertCapabilityAttr::clone(ASTContext &C) const { |
||
3846 | auto *A = new (C) AssertCapabilityAttr(C, *this, args_, args_Size); |
||
3847 | A->Inherited = Inherited; |
||
3848 | A->IsPackExpansion = IsPackExpansion; |
||
3849 | A->setImplicit(Implicit); |
||
3850 | return A; |
||
3851 | } |
||
3852 | |||
3853 | void AssertCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
3854 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
3855 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
3856 | switch (getAttributeSpellingListIndex()) { |
||
3857 | default: |
||
3858 | llvm_unreachable("Unknown attribute spelling!"); |
||
3859 | break; |
||
3860 | case 0 : { |
||
3861 | OS << " __attribute__((assert_capability"; |
||
3862 | OS << ""; |
||
3863 | for (const auto &Val : args()) { |
||
3864 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3865 | OS << Val; |
||
3866 | } |
||
3867 | OS << ""; |
||
3868 | if (!IsFirstArgument) |
||
3869 | OS << ")"; |
||
3870 | OS << "))"; |
||
3871 | break; |
||
3872 | } |
||
3873 | case 1 : { |
||
3874 | OS << " [[clang::assert_capability"; |
||
3875 | OS << ""; |
||
3876 | for (const auto &Val : args()) { |
||
3877 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3878 | OS << Val; |
||
3879 | } |
||
3880 | OS << ""; |
||
3881 | if (!IsFirstArgument) |
||
3882 | OS << ")"; |
||
3883 | OS << "]]"; |
||
3884 | break; |
||
3885 | } |
||
3886 | case 2 : { |
||
3887 | OS << " __attribute__((assert_shared_capability"; |
||
3888 | OS << ""; |
||
3889 | for (const auto &Val : args()) { |
||
3890 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3891 | OS << Val; |
||
3892 | } |
||
3893 | OS << ""; |
||
3894 | if (!IsFirstArgument) |
||
3895 | OS << ")"; |
||
3896 | OS << "))"; |
||
3897 | break; |
||
3898 | } |
||
3899 | case 3 : { |
||
3900 | OS << " [[clang::assert_shared_capability"; |
||
3901 | OS << ""; |
||
3902 | for (const auto &Val : args()) { |
||
3903 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3904 | OS << Val; |
||
3905 | } |
||
3906 | OS << ""; |
||
3907 | if (!IsFirstArgument) |
||
3908 | OS << ")"; |
||
3909 | OS << "]]"; |
||
3910 | break; |
||
3911 | } |
||
3912 | } |
||
3913 | } |
||
3914 | |||
3915 | const char *AssertCapabilityAttr::getSpelling() const { |
||
3916 | switch (getAttributeSpellingListIndex()) { |
||
3917 | default: |
||
3918 | llvm_unreachable("Unknown attribute spelling!"); |
||
3919 | return "(No spelling)"; |
||
3920 | case 0: |
||
3921 | return "assert_capability"; |
||
3922 | case 1: |
||
3923 | return "assert_capability"; |
||
3924 | case 2: |
||
3925 | return "assert_shared_capability"; |
||
3926 | case 3: |
||
3927 | return "assert_shared_capability"; |
||
3928 | } |
||
3929 | } |
||
3930 | |||
3931 | |||
3932 | // AssertExclusiveLockAttr implementation |
||
3933 | |||
3934 | AssertExclusiveLockAttr *AssertExclusiveLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
3935 | auto *A = new (Ctx) AssertExclusiveLockAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
3936 | A->setImplicit(true); |
||
3937 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3938 | A->setAttributeSpellingListIndex(0); |
||
3939 | return A; |
||
3940 | } |
||
3941 | |||
3942 | AssertExclusiveLockAttr *AssertExclusiveLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
3943 | auto *A = new (Ctx) AssertExclusiveLockAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
3944 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
3945 | A->setAttributeSpellingListIndex(0); |
||
3946 | return A; |
||
3947 | } |
||
3948 | |||
3949 | AssertExclusiveLockAttr *AssertExclusiveLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3950 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3951 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
3952 | } |
||
3953 | |||
3954 | AssertExclusiveLockAttr *AssertExclusiveLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
3955 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
3956 | return Create(Ctx, Args, ArgsSize, I); |
||
3957 | } |
||
3958 | |||
3959 | AssertExclusiveLockAttr::AssertExclusiveLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3960 | , Expr * *Args, unsigned ArgsSize |
||
3961 | ) |
||
3962 | : InheritableAttr(Ctx, CommonInfo, attr::AssertExclusiveLock, true, true) |
||
3963 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
3964 | { |
||
3965 | std::copy(Args, Args + args_Size, args_); |
||
3966 | } |
||
3967 | |||
3968 | AssertExclusiveLockAttr::AssertExclusiveLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
3969 | ) |
||
3970 | : InheritableAttr(Ctx, CommonInfo, attr::AssertExclusiveLock, true, true) |
||
3971 | , args_Size(0), args_(nullptr) |
||
3972 | { |
||
3973 | } |
||
3974 | |||
3975 | |||
3976 | |||
3977 | AssertExclusiveLockAttr *AssertExclusiveLockAttr::clone(ASTContext &C) const { |
||
3978 | auto *A = new (C) AssertExclusiveLockAttr(C, *this, args_, args_Size); |
||
3979 | A->Inherited = Inherited; |
||
3980 | A->IsPackExpansion = IsPackExpansion; |
||
3981 | A->setImplicit(Implicit); |
||
3982 | return A; |
||
3983 | } |
||
3984 | |||
3985 | void AssertExclusiveLockAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
3986 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
3987 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
3988 | switch (getAttributeSpellingListIndex()) { |
||
3989 | default: |
||
3990 | llvm_unreachable("Unknown attribute spelling!"); |
||
3991 | break; |
||
3992 | case 0 : { |
||
3993 | OS << " __attribute__((assert_exclusive_lock"; |
||
3994 | OS << ""; |
||
3995 | for (const auto &Val : args()) { |
||
3996 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
3997 | OS << Val; |
||
3998 | } |
||
3999 | OS << ""; |
||
4000 | if (!IsFirstArgument) |
||
4001 | OS << ")"; |
||
4002 | OS << "))"; |
||
4003 | break; |
||
4004 | } |
||
4005 | } |
||
4006 | } |
||
4007 | |||
4008 | const char *AssertExclusiveLockAttr::getSpelling() const { |
||
4009 | switch (getAttributeSpellingListIndex()) { |
||
4010 | default: |
||
4011 | llvm_unreachable("Unknown attribute spelling!"); |
||
4012 | return "(No spelling)"; |
||
4013 | case 0: |
||
4014 | return "assert_exclusive_lock"; |
||
4015 | } |
||
4016 | } |
||
4017 | |||
4018 | |||
4019 | // AssertSharedLockAttr implementation |
||
4020 | |||
4021 | AssertSharedLockAttr *AssertSharedLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
4022 | auto *A = new (Ctx) AssertSharedLockAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
4023 | A->setImplicit(true); |
||
4024 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4025 | A->setAttributeSpellingListIndex(0); |
||
4026 | return A; |
||
4027 | } |
||
4028 | |||
4029 | AssertSharedLockAttr *AssertSharedLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
4030 | auto *A = new (Ctx) AssertSharedLockAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
4031 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4032 | A->setAttributeSpellingListIndex(0); |
||
4033 | return A; |
||
4034 | } |
||
4035 | |||
4036 | AssertSharedLockAttr *AssertSharedLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4037 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4038 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
4039 | } |
||
4040 | |||
4041 | AssertSharedLockAttr *AssertSharedLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4042 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4043 | return Create(Ctx, Args, ArgsSize, I); |
||
4044 | } |
||
4045 | |||
4046 | AssertSharedLockAttr::AssertSharedLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4047 | , Expr * *Args, unsigned ArgsSize |
||
4048 | ) |
||
4049 | : InheritableAttr(Ctx, CommonInfo, attr::AssertSharedLock, true, true) |
||
4050 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
4051 | { |
||
4052 | std::copy(Args, Args + args_Size, args_); |
||
4053 | } |
||
4054 | |||
4055 | AssertSharedLockAttr::AssertSharedLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4056 | ) |
||
4057 | : InheritableAttr(Ctx, CommonInfo, attr::AssertSharedLock, true, true) |
||
4058 | , args_Size(0), args_(nullptr) |
||
4059 | { |
||
4060 | } |
||
4061 | |||
4062 | |||
4063 | |||
4064 | AssertSharedLockAttr *AssertSharedLockAttr::clone(ASTContext &C) const { |
||
4065 | auto *A = new (C) AssertSharedLockAttr(C, *this, args_, args_Size); |
||
4066 | A->Inherited = Inherited; |
||
4067 | A->IsPackExpansion = IsPackExpansion; |
||
4068 | A->setImplicit(Implicit); |
||
4069 | return A; |
||
4070 | } |
||
4071 | |||
4072 | void AssertSharedLockAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4073 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
4074 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
4075 | switch (getAttributeSpellingListIndex()) { |
||
4076 | default: |
||
4077 | llvm_unreachable("Unknown attribute spelling!"); |
||
4078 | break; |
||
4079 | case 0 : { |
||
4080 | OS << " __attribute__((assert_shared_lock"; |
||
4081 | OS << ""; |
||
4082 | for (const auto &Val : args()) { |
||
4083 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4084 | OS << Val; |
||
4085 | } |
||
4086 | OS << ""; |
||
4087 | if (!IsFirstArgument) |
||
4088 | OS << ")"; |
||
4089 | OS << "))"; |
||
4090 | break; |
||
4091 | } |
||
4092 | } |
||
4093 | } |
||
4094 | |||
4095 | const char *AssertSharedLockAttr::getSpelling() const { |
||
4096 | switch (getAttributeSpellingListIndex()) { |
||
4097 | default: |
||
4098 | llvm_unreachable("Unknown attribute spelling!"); |
||
4099 | return "(No spelling)"; |
||
4100 | case 0: |
||
4101 | return "assert_shared_lock"; |
||
4102 | } |
||
4103 | } |
||
4104 | |||
4105 | |||
4106 | // AssumeAlignedAttr implementation |
||
4107 | |||
4108 | AssumeAlignedAttr *AssumeAlignedAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, Expr * Offset, const AttributeCommonInfo &CommonInfo) { |
||
4109 | auto *A = new (Ctx) AssumeAlignedAttr(Ctx, CommonInfo, Alignment, Offset); |
||
4110 | A->setImplicit(true); |
||
4111 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4112 | A->setAttributeSpellingListIndex(0); |
||
4113 | return A; |
||
4114 | } |
||
4115 | |||
4116 | AssumeAlignedAttr *AssumeAlignedAttr::Create(ASTContext &Ctx, Expr * Alignment, Expr * Offset, const AttributeCommonInfo &CommonInfo) { |
||
4117 | auto *A = new (Ctx) AssumeAlignedAttr(Ctx, CommonInfo, Alignment, Offset); |
||
4118 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4119 | A->setAttributeSpellingListIndex(0); |
||
4120 | return A; |
||
4121 | } |
||
4122 | |||
4123 | AssumeAlignedAttr *AssumeAlignedAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, Expr * Offset, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4124 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4125 | return CreateImplicit(Ctx, Alignment, Offset, I); |
||
4126 | } |
||
4127 | |||
4128 | AssumeAlignedAttr *AssumeAlignedAttr::Create(ASTContext &Ctx, Expr * Alignment, Expr * Offset, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4129 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4130 | return Create(Ctx, Alignment, Offset, I); |
||
4131 | } |
||
4132 | |||
4133 | AssumeAlignedAttr::AssumeAlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4134 | , Expr * Alignment |
||
4135 | , Expr * Offset |
||
4136 | ) |
||
4137 | : InheritableAttr(Ctx, CommonInfo, attr::AssumeAligned, false, false) |
||
4138 | , alignment(Alignment) |
||
4139 | , offset(Offset) |
||
4140 | { |
||
4141 | } |
||
4142 | |||
4143 | AssumeAlignedAttr::AssumeAlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4144 | , Expr * Alignment |
||
4145 | ) |
||
4146 | : InheritableAttr(Ctx, CommonInfo, attr::AssumeAligned, false, false) |
||
4147 | , alignment(Alignment) |
||
4148 | , offset() |
||
4149 | { |
||
4150 | } |
||
4151 | |||
4152 | |||
4153 | |||
4154 | |||
4155 | |||
4156 | AssumeAlignedAttr *AssumeAlignedAttr::clone(ASTContext &C) const { |
||
4157 | auto *A = new (C) AssumeAlignedAttr(C, *this, alignment, offset); |
||
4158 | A->Inherited = Inherited; |
||
4159 | A->IsPackExpansion = IsPackExpansion; |
||
4160 | A->setImplicit(Implicit); |
||
4161 | return A; |
||
4162 | } |
||
4163 | |||
4164 | void AssumeAlignedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4165 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
4166 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
4167 | switch (getAttributeSpellingListIndex()) { |
||
4168 | default: |
||
4169 | llvm_unreachable("Unknown attribute spelling!"); |
||
4170 | break; |
||
4171 | case 0 : { |
||
4172 | OS << " __attribute__((assume_aligned"; |
||
4173 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4174 | OS << ""; |
||
4175 | getAlignment()->printPretty(OS, nullptr, Policy); |
||
4176 | OS << ""; |
||
4177 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4178 | OS << ""; |
||
4179 | getOffset()->printPretty(OS, nullptr, Policy); |
||
4180 | OS << ""; |
||
4181 | if (!IsFirstArgument) |
||
4182 | OS << ")"; |
||
4183 | OS << "))"; |
||
4184 | break; |
||
4185 | } |
||
4186 | case 1 : { |
||
4187 | OS << " [[gnu::assume_aligned"; |
||
4188 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4189 | OS << ""; |
||
4190 | getAlignment()->printPretty(OS, nullptr, Policy); |
||
4191 | OS << ""; |
||
4192 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4193 | OS << ""; |
||
4194 | getOffset()->printPretty(OS, nullptr, Policy); |
||
4195 | OS << ""; |
||
4196 | if (!IsFirstArgument) |
||
4197 | OS << ")"; |
||
4198 | OS << "]]"; |
||
4199 | break; |
||
4200 | } |
||
4201 | case 2 : { |
||
4202 | OS << " [[gnu::assume_aligned"; |
||
4203 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4204 | OS << ""; |
||
4205 | getAlignment()->printPretty(OS, nullptr, Policy); |
||
4206 | OS << ""; |
||
4207 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4208 | OS << ""; |
||
4209 | getOffset()->printPretty(OS, nullptr, Policy); |
||
4210 | OS << ""; |
||
4211 | if (!IsFirstArgument) |
||
4212 | OS << ")"; |
||
4213 | OS << "]]"; |
||
4214 | break; |
||
4215 | } |
||
4216 | } |
||
4217 | } |
||
4218 | |||
4219 | const char *AssumeAlignedAttr::getSpelling() const { |
||
4220 | switch (getAttributeSpellingListIndex()) { |
||
4221 | default: |
||
4222 | llvm_unreachable("Unknown attribute spelling!"); |
||
4223 | return "(No spelling)"; |
||
4224 | case 0: |
||
4225 | return "assume_aligned"; |
||
4226 | case 1: |
||
4227 | return "assume_aligned"; |
||
4228 | case 2: |
||
4229 | return "assume_aligned"; |
||
4230 | } |
||
4231 | } |
||
4232 | |||
4233 | |||
4234 | // AssumptionAttr implementation |
||
4235 | |||
4236 | AssumptionAttr *AssumptionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Assumption, const AttributeCommonInfo &CommonInfo) { |
||
4237 | auto *A = new (Ctx) AssumptionAttr(Ctx, CommonInfo, Assumption); |
||
4238 | A->setImplicit(true); |
||
4239 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4240 | A->setAttributeSpellingListIndex(0); |
||
4241 | return A; |
||
4242 | } |
||
4243 | |||
4244 | AssumptionAttr *AssumptionAttr::Create(ASTContext &Ctx, llvm::StringRef Assumption, const AttributeCommonInfo &CommonInfo) { |
||
4245 | auto *A = new (Ctx) AssumptionAttr(Ctx, CommonInfo, Assumption); |
||
4246 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4247 | A->setAttributeSpellingListIndex(0); |
||
4248 | return A; |
||
4249 | } |
||
4250 | |||
4251 | AssumptionAttr *AssumptionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Assumption, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4252 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4253 | return CreateImplicit(Ctx, Assumption, I); |
||
4254 | } |
||
4255 | |||
4256 | AssumptionAttr *AssumptionAttr::Create(ASTContext &Ctx, llvm::StringRef Assumption, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4257 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4258 | return Create(Ctx, Assumption, I); |
||
4259 | } |
||
4260 | |||
4261 | AssumptionAttr::AssumptionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4262 | , llvm::StringRef Assumption |
||
4263 | ) |
||
4264 | : InheritableAttr(Ctx, CommonInfo, attr::Assumption, false, true) |
||
4265 | , assumptionLength(Assumption.size()),assumption(new (Ctx, 1) char[assumptionLength]) |
||
4266 | { |
||
4267 | if (!Assumption.empty()) |
||
4268 | std::memcpy(assumption, Assumption.data(), assumptionLength); |
||
4269 | } |
||
4270 | |||
4271 | |||
4272 | |||
4273 | AssumptionAttr *AssumptionAttr::clone(ASTContext &C) const { |
||
4274 | auto *A = new (C) AssumptionAttr(C, *this, getAssumption()); |
||
4275 | A->Inherited = Inherited; |
||
4276 | A->IsPackExpansion = IsPackExpansion; |
||
4277 | A->setImplicit(Implicit); |
||
4278 | return A; |
||
4279 | } |
||
4280 | |||
4281 | void AssumptionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4282 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
4283 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
4284 | switch (getAttributeSpellingListIndex()) { |
||
4285 | default: |
||
4286 | llvm_unreachable("Unknown attribute spelling!"); |
||
4287 | break; |
||
4288 | case 0 : { |
||
4289 | OS << " __attribute__((assume"; |
||
4290 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4291 | OS << "\"" << getAssumption() << "\""; |
||
4292 | if (!IsFirstArgument) |
||
4293 | OS << ")"; |
||
4294 | OS << "))"; |
||
4295 | break; |
||
4296 | } |
||
4297 | case 1 : { |
||
4298 | OS << " [[clang::assume"; |
||
4299 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4300 | OS << "\"" << getAssumption() << "\""; |
||
4301 | if (!IsFirstArgument) |
||
4302 | OS << ")"; |
||
4303 | OS << "]]"; |
||
4304 | break; |
||
4305 | } |
||
4306 | case 2 : { |
||
4307 | OS << " [[clang::assume"; |
||
4308 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4309 | OS << "\"" << getAssumption() << "\""; |
||
4310 | if (!IsFirstArgument) |
||
4311 | OS << ")"; |
||
4312 | OS << "]]"; |
||
4313 | break; |
||
4314 | } |
||
4315 | } |
||
4316 | } |
||
4317 | |||
4318 | const char *AssumptionAttr::getSpelling() const { |
||
4319 | switch (getAttributeSpellingListIndex()) { |
||
4320 | default: |
||
4321 | llvm_unreachable("Unknown attribute spelling!"); |
||
4322 | return "(No spelling)"; |
||
4323 | case 0: |
||
4324 | return "assume"; |
||
4325 | case 1: |
||
4326 | return "assume"; |
||
4327 | case 2: |
||
4328 | return "assume"; |
||
4329 | } |
||
4330 | } |
||
4331 | |||
4332 | |||
4333 | // AvailabilityAttr implementation |
||
4334 | |||
4335 | AvailabilityAttr *AvailabilityAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Platform, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool Unavailable, llvm::StringRef Message, bool Strict, llvm::StringRef Replacement, int Priority, const AttributeCommonInfo &CommonInfo) { |
||
4336 | auto *A = new (Ctx) AvailabilityAttr(Ctx, CommonInfo, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority); |
||
4337 | A->setImplicit(true); |
||
4338 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4339 | A->setAttributeSpellingListIndex(0); |
||
4340 | return A; |
||
4341 | } |
||
4342 | |||
4343 | AvailabilityAttr *AvailabilityAttr::Create(ASTContext &Ctx, IdentifierInfo * Platform, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool Unavailable, llvm::StringRef Message, bool Strict, llvm::StringRef Replacement, int Priority, const AttributeCommonInfo &CommonInfo) { |
||
4344 | auto *A = new (Ctx) AvailabilityAttr(Ctx, CommonInfo, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority); |
||
4345 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4346 | A->setAttributeSpellingListIndex(0); |
||
4347 | return A; |
||
4348 | } |
||
4349 | |||
4350 | AvailabilityAttr *AvailabilityAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Platform, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool Unavailable, llvm::StringRef Message, bool Strict, llvm::StringRef Replacement, int Priority, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4351 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4352 | return CreateImplicit(Ctx, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, I); |
||
4353 | } |
||
4354 | |||
4355 | AvailabilityAttr *AvailabilityAttr::Create(ASTContext &Ctx, IdentifierInfo * Platform, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool Unavailable, llvm::StringRef Message, bool Strict, llvm::StringRef Replacement, int Priority, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4356 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4357 | return Create(Ctx, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, I); |
||
4358 | } |
||
4359 | |||
4360 | AvailabilityAttr::AvailabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4361 | , IdentifierInfo * Platform |
||
4362 | , VersionTuple Introduced |
||
4363 | , VersionTuple Deprecated |
||
4364 | , VersionTuple Obsoleted |
||
4365 | , bool Unavailable |
||
4366 | , llvm::StringRef Message |
||
4367 | , bool Strict |
||
4368 | , llvm::StringRef Replacement |
||
4369 | , int Priority |
||
4370 | ) |
||
4371 | : InheritableAttr(Ctx, CommonInfo, attr::Availability, false, true) |
||
4372 | , platform(Platform) |
||
4373 | , introduced(Introduced) |
||
4374 | , deprecated(Deprecated) |
||
4375 | , obsoleted(Obsoleted) |
||
4376 | , unavailable(Unavailable) |
||
4377 | , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) |
||
4378 | , strict(Strict) |
||
4379 | , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength]) |
||
4380 | , priority(Priority) |
||
4381 | { |
||
4382 | if (!Message.empty()) |
||
4383 | std::memcpy(message, Message.data(), messageLength); |
||
4384 | if (!Replacement.empty()) |
||
4385 | std::memcpy(replacement, Replacement.data(), replacementLength); |
||
4386 | } |
||
4387 | |||
4388 | |||
4389 | |||
4390 | |||
4391 | |||
4392 | |||
4393 | |||
4394 | |||
4395 | |||
4396 | |||
4397 | |||
4398 | |||
4399 | |||
4400 | |||
4401 | |||
4402 | |||
4403 | |||
4404 | |||
4405 | |||
4406 | AvailabilityAttr *AvailabilityAttr::clone(ASTContext &C) const { |
||
4407 | auto *A = new (C) AvailabilityAttr(C, *this, platform, getIntroduced(), getDeprecated(), getObsoleted(), unavailable, getMessage(), strict, getReplacement(), priority); |
||
4408 | A->Inherited = Inherited; |
||
4409 | A->IsPackExpansion = IsPackExpansion; |
||
4410 | A->setImplicit(Implicit); |
||
4411 | return A; |
||
4412 | } |
||
4413 | |||
4414 | void AvailabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4415 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
4416 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
4417 | switch (getAttributeSpellingListIndex()) { |
||
4418 | default: |
||
4419 | llvm_unreachable("Unknown attribute spelling!"); |
||
4420 | break; |
||
4421 | case 0 : { |
||
4422 | OS << " __attribute__((availability"; |
||
4423 | OS << "(" << getPlatform()->getName(); |
||
4424 | if (getStrict()) OS << ", strict"; |
||
4425 | if (!getIntroduced().empty()) OS << ", introduced=" << getIntroduced(); |
||
4426 | if (!getDeprecated().empty()) OS << ", deprecated=" << getDeprecated(); |
||
4427 | if (!getObsoleted().empty()) OS << ", obsoleted=" << getObsoleted(); |
||
4428 | if (getUnavailable()) OS << ", unavailable"; |
||
4429 | OS << ")"; |
||
4430 | OS << "))"; |
||
4431 | break; |
||
4432 | } |
||
4433 | case 1 : { |
||
4434 | OS << " [[clang::availability"; |
||
4435 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4436 | OS << "" << (getPlatform() ? getPlatform()->getName() : "") << ""; |
||
4437 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4438 | OS << "introduced=" << getIntroduced() << ""; |
||
4439 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4440 | OS << "deprecated=" << getDeprecated() << ""; |
||
4441 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4442 | OS << "obsoleted=" << getObsoleted() << ""; |
||
4443 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4444 | OS << "" << getUnavailable() << ""; |
||
4445 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4446 | OS << "\"" << getMessage() << "\""; |
||
4447 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4448 | OS << "" << getStrict() << ""; |
||
4449 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4450 | OS << "\"" << getReplacement() << "\""; |
||
4451 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4452 | OS << "" << getPriority() << ""; |
||
4453 | if (!IsFirstArgument) |
||
4454 | OS << ")"; |
||
4455 | OS << "]]"; |
||
4456 | break; |
||
4457 | } |
||
4458 | case 2 : { |
||
4459 | OS << " [[clang::availability"; |
||
4460 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4461 | OS << "" << (getPlatform() ? getPlatform()->getName() : "") << ""; |
||
4462 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4463 | OS << "introduced=" << getIntroduced() << ""; |
||
4464 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4465 | OS << "deprecated=" << getDeprecated() << ""; |
||
4466 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4467 | OS << "obsoleted=" << getObsoleted() << ""; |
||
4468 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4469 | OS << "" << getUnavailable() << ""; |
||
4470 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4471 | OS << "\"" << getMessage() << "\""; |
||
4472 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4473 | OS << "" << getStrict() << ""; |
||
4474 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4475 | OS << "\"" << getReplacement() << "\""; |
||
4476 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4477 | OS << "" << getPriority() << ""; |
||
4478 | if (!IsFirstArgument) |
||
4479 | OS << ")"; |
||
4480 | OS << "]]"; |
||
4481 | break; |
||
4482 | } |
||
4483 | } |
||
4484 | } |
||
4485 | |||
4486 | const char *AvailabilityAttr::getSpelling() const { |
||
4487 | switch (getAttributeSpellingListIndex()) { |
||
4488 | default: |
||
4489 | llvm_unreachable("Unknown attribute spelling!"); |
||
4490 | return "(No spelling)"; |
||
4491 | case 0: |
||
4492 | return "availability"; |
||
4493 | case 1: |
||
4494 | return "availability"; |
||
4495 | case 2: |
||
4496 | return "availability"; |
||
4497 | } |
||
4498 | } |
||
4499 | |||
4500 | |||
4501 | // BPFPreserveAccessIndexAttr implementation |
||
4502 | |||
4503 | BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
4504 | auto *A = new (Ctx) BPFPreserveAccessIndexAttr(Ctx, CommonInfo); |
||
4505 | A->setImplicit(true); |
||
4506 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4507 | A->setAttributeSpellingListIndex(0); |
||
4508 | return A; |
||
4509 | } |
||
4510 | |||
4511 | BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
4512 | auto *A = new (Ctx) BPFPreserveAccessIndexAttr(Ctx, CommonInfo); |
||
4513 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4514 | A->setAttributeSpellingListIndex(0); |
||
4515 | return A; |
||
4516 | } |
||
4517 | |||
4518 | BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4519 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4520 | return CreateImplicit(Ctx, I); |
||
4521 | } |
||
4522 | |||
4523 | BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4524 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4525 | return Create(Ctx, I); |
||
4526 | } |
||
4527 | |||
4528 | BPFPreserveAccessIndexAttr::BPFPreserveAccessIndexAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4529 | ) |
||
4530 | : InheritableAttr(Ctx, CommonInfo, attr::BPFPreserveAccessIndex, false, false) |
||
4531 | { |
||
4532 | } |
||
4533 | |||
4534 | BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::clone(ASTContext &C) const { |
||
4535 | auto *A = new (C) BPFPreserveAccessIndexAttr(C, *this); |
||
4536 | A->Inherited = Inherited; |
||
4537 | A->IsPackExpansion = IsPackExpansion; |
||
4538 | A->setImplicit(Implicit); |
||
4539 | return A; |
||
4540 | } |
||
4541 | |||
4542 | void BPFPreserveAccessIndexAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4543 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
4544 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
4545 | switch (getAttributeSpellingListIndex()) { |
||
4546 | default: |
||
4547 | llvm_unreachable("Unknown attribute spelling!"); |
||
4548 | break; |
||
4549 | case 0 : { |
||
4550 | OS << " __attribute__((preserve_access_index"; |
||
4551 | OS << "))"; |
||
4552 | break; |
||
4553 | } |
||
4554 | case 1 : { |
||
4555 | OS << " [[clang::preserve_access_index"; |
||
4556 | OS << "]]"; |
||
4557 | break; |
||
4558 | } |
||
4559 | case 2 : { |
||
4560 | OS << " [[clang::preserve_access_index"; |
||
4561 | OS << "]]"; |
||
4562 | break; |
||
4563 | } |
||
4564 | } |
||
4565 | } |
||
4566 | |||
4567 | const char *BPFPreserveAccessIndexAttr::getSpelling() const { |
||
4568 | switch (getAttributeSpellingListIndex()) { |
||
4569 | default: |
||
4570 | llvm_unreachable("Unknown attribute spelling!"); |
||
4571 | return "(No spelling)"; |
||
4572 | case 0: |
||
4573 | return "preserve_access_index"; |
||
4574 | case 1: |
||
4575 | return "preserve_access_index"; |
||
4576 | case 2: |
||
4577 | return "preserve_access_index"; |
||
4578 | } |
||
4579 | } |
||
4580 | |||
4581 | |||
4582 | // BTFDeclTagAttr implementation |
||
4583 | |||
4584 | BTFDeclTagAttr *BTFDeclTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFDeclTag, const AttributeCommonInfo &CommonInfo) { |
||
4585 | auto *A = new (Ctx) BTFDeclTagAttr(Ctx, CommonInfo, BTFDeclTag); |
||
4586 | A->setImplicit(true); |
||
4587 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4588 | A->setAttributeSpellingListIndex(0); |
||
4589 | return A; |
||
4590 | } |
||
4591 | |||
4592 | BTFDeclTagAttr *BTFDeclTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFDeclTag, const AttributeCommonInfo &CommonInfo) { |
||
4593 | auto *A = new (Ctx) BTFDeclTagAttr(Ctx, CommonInfo, BTFDeclTag); |
||
4594 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4595 | A->setAttributeSpellingListIndex(0); |
||
4596 | return A; |
||
4597 | } |
||
4598 | |||
4599 | BTFDeclTagAttr *BTFDeclTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFDeclTag, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4600 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4601 | return CreateImplicit(Ctx, BTFDeclTag, I); |
||
4602 | } |
||
4603 | |||
4604 | BTFDeclTagAttr *BTFDeclTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFDeclTag, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4605 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4606 | return Create(Ctx, BTFDeclTag, I); |
||
4607 | } |
||
4608 | |||
4609 | BTFDeclTagAttr::BTFDeclTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4610 | , llvm::StringRef BTFDeclTag |
||
4611 | ) |
||
4612 | : InheritableAttr(Ctx, CommonInfo, attr::BTFDeclTag, false, false) |
||
4613 | , bTFDeclTagLength(BTFDeclTag.size()),bTFDeclTag(new (Ctx, 1) char[bTFDeclTagLength]) |
||
4614 | { |
||
4615 | if (!BTFDeclTag.empty()) |
||
4616 | std::memcpy(bTFDeclTag, BTFDeclTag.data(), bTFDeclTagLength); |
||
4617 | } |
||
4618 | |||
4619 | |||
4620 | |||
4621 | BTFDeclTagAttr *BTFDeclTagAttr::clone(ASTContext &C) const { |
||
4622 | auto *A = new (C) BTFDeclTagAttr(C, *this, getBTFDeclTag()); |
||
4623 | A->Inherited = Inherited; |
||
4624 | A->IsPackExpansion = IsPackExpansion; |
||
4625 | A->setImplicit(Implicit); |
||
4626 | return A; |
||
4627 | } |
||
4628 | |||
4629 | void BTFDeclTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4630 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
4631 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
4632 | switch (getAttributeSpellingListIndex()) { |
||
4633 | default: |
||
4634 | llvm_unreachable("Unknown attribute spelling!"); |
||
4635 | break; |
||
4636 | case 0 : { |
||
4637 | OS << " __attribute__((btf_decl_tag"; |
||
4638 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4639 | OS << "\"" << getBTFDeclTag() << "\""; |
||
4640 | if (!IsFirstArgument) |
||
4641 | OS << ")"; |
||
4642 | OS << "))"; |
||
4643 | break; |
||
4644 | } |
||
4645 | case 1 : { |
||
4646 | OS << " [[clang::btf_decl_tag"; |
||
4647 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4648 | OS << "\"" << getBTFDeclTag() << "\""; |
||
4649 | if (!IsFirstArgument) |
||
4650 | OS << ")"; |
||
4651 | OS << "]]"; |
||
4652 | break; |
||
4653 | } |
||
4654 | case 2 : { |
||
4655 | OS << " [[clang::btf_decl_tag"; |
||
4656 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4657 | OS << "\"" << getBTFDeclTag() << "\""; |
||
4658 | if (!IsFirstArgument) |
||
4659 | OS << ")"; |
||
4660 | OS << "]]"; |
||
4661 | break; |
||
4662 | } |
||
4663 | } |
||
4664 | } |
||
4665 | |||
4666 | const char *BTFDeclTagAttr::getSpelling() const { |
||
4667 | switch (getAttributeSpellingListIndex()) { |
||
4668 | default: |
||
4669 | llvm_unreachable("Unknown attribute spelling!"); |
||
4670 | return "(No spelling)"; |
||
4671 | case 0: |
||
4672 | return "btf_decl_tag"; |
||
4673 | case 1: |
||
4674 | return "btf_decl_tag"; |
||
4675 | case 2: |
||
4676 | return "btf_decl_tag"; |
||
4677 | } |
||
4678 | } |
||
4679 | |||
4680 | |||
4681 | // BTFTypeTagAttr implementation |
||
4682 | |||
4683 | BTFTypeTagAttr *BTFTypeTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFTypeTag, const AttributeCommonInfo &CommonInfo) { |
||
4684 | auto *A = new (Ctx) BTFTypeTagAttr(Ctx, CommonInfo, BTFTypeTag); |
||
4685 | A->setImplicit(true); |
||
4686 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4687 | A->setAttributeSpellingListIndex(0); |
||
4688 | return A; |
||
4689 | } |
||
4690 | |||
4691 | BTFTypeTagAttr *BTFTypeTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFTypeTag, const AttributeCommonInfo &CommonInfo) { |
||
4692 | auto *A = new (Ctx) BTFTypeTagAttr(Ctx, CommonInfo, BTFTypeTag); |
||
4693 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4694 | A->setAttributeSpellingListIndex(0); |
||
4695 | return A; |
||
4696 | } |
||
4697 | |||
4698 | BTFTypeTagAttr *BTFTypeTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFTypeTag, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4699 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4700 | return CreateImplicit(Ctx, BTFTypeTag, I); |
||
4701 | } |
||
4702 | |||
4703 | BTFTypeTagAttr *BTFTypeTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFTypeTag, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4704 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4705 | return Create(Ctx, BTFTypeTag, I); |
||
4706 | } |
||
4707 | |||
4708 | BTFTypeTagAttr::BTFTypeTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4709 | , llvm::StringRef BTFTypeTag |
||
4710 | ) |
||
4711 | : TypeAttr(Ctx, CommonInfo, attr::BTFTypeTag, false) |
||
4712 | , bTFTypeTagLength(BTFTypeTag.size()),bTFTypeTag(new (Ctx, 1) char[bTFTypeTagLength]) |
||
4713 | { |
||
4714 | if (!BTFTypeTag.empty()) |
||
4715 | std::memcpy(bTFTypeTag, BTFTypeTag.data(), bTFTypeTagLength); |
||
4716 | } |
||
4717 | |||
4718 | |||
4719 | |||
4720 | BTFTypeTagAttr *BTFTypeTagAttr::clone(ASTContext &C) const { |
||
4721 | auto *A = new (C) BTFTypeTagAttr(C, *this, getBTFTypeTag()); |
||
4722 | A->Inherited = Inherited; |
||
4723 | A->IsPackExpansion = IsPackExpansion; |
||
4724 | A->setImplicit(Implicit); |
||
4725 | return A; |
||
4726 | } |
||
4727 | |||
4728 | void BTFTypeTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4729 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
4730 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
4731 | switch (getAttributeSpellingListIndex()) { |
||
4732 | default: |
||
4733 | llvm_unreachable("Unknown attribute spelling!"); |
||
4734 | break; |
||
4735 | case 0 : { |
||
4736 | OS << " __attribute__((btf_type_tag"; |
||
4737 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4738 | OS << "\"" << getBTFTypeTag() << "\""; |
||
4739 | if (!IsFirstArgument) |
||
4740 | OS << ")"; |
||
4741 | OS << "))"; |
||
4742 | break; |
||
4743 | } |
||
4744 | case 1 : { |
||
4745 | OS << " [[clang::btf_type_tag"; |
||
4746 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4747 | OS << "\"" << getBTFTypeTag() << "\""; |
||
4748 | if (!IsFirstArgument) |
||
4749 | OS << ")"; |
||
4750 | OS << "]]"; |
||
4751 | break; |
||
4752 | } |
||
4753 | case 2 : { |
||
4754 | OS << " [[clang::btf_type_tag"; |
||
4755 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4756 | OS << "\"" << getBTFTypeTag() << "\""; |
||
4757 | if (!IsFirstArgument) |
||
4758 | OS << ")"; |
||
4759 | OS << "]]"; |
||
4760 | break; |
||
4761 | } |
||
4762 | } |
||
4763 | } |
||
4764 | |||
4765 | const char *BTFTypeTagAttr::getSpelling() const { |
||
4766 | switch (getAttributeSpellingListIndex()) { |
||
4767 | default: |
||
4768 | llvm_unreachable("Unknown attribute spelling!"); |
||
4769 | return "(No spelling)"; |
||
4770 | case 0: |
||
4771 | return "btf_type_tag"; |
||
4772 | case 1: |
||
4773 | return "btf_type_tag"; |
||
4774 | case 2: |
||
4775 | return "btf_type_tag"; |
||
4776 | } |
||
4777 | } |
||
4778 | |||
4779 | |||
4780 | // BlocksAttr implementation |
||
4781 | |||
4782 | BlocksAttr *BlocksAttr::CreateImplicit(ASTContext &Ctx, BlockType Type, const AttributeCommonInfo &CommonInfo) { |
||
4783 | auto *A = new (Ctx) BlocksAttr(Ctx, CommonInfo, Type); |
||
4784 | A->setImplicit(true); |
||
4785 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4786 | A->setAttributeSpellingListIndex(0); |
||
4787 | return A; |
||
4788 | } |
||
4789 | |||
4790 | BlocksAttr *BlocksAttr::Create(ASTContext &Ctx, BlockType Type, const AttributeCommonInfo &CommonInfo) { |
||
4791 | auto *A = new (Ctx) BlocksAttr(Ctx, CommonInfo, Type); |
||
4792 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4793 | A->setAttributeSpellingListIndex(0); |
||
4794 | return A; |
||
4795 | } |
||
4796 | |||
4797 | BlocksAttr *BlocksAttr::CreateImplicit(ASTContext &Ctx, BlockType Type, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4798 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4799 | return CreateImplicit(Ctx, Type, I); |
||
4800 | } |
||
4801 | |||
4802 | BlocksAttr *BlocksAttr::Create(ASTContext &Ctx, BlockType Type, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4803 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4804 | return Create(Ctx, Type, I); |
||
4805 | } |
||
4806 | |||
4807 | BlocksAttr::BlocksAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4808 | , BlockType Type |
||
4809 | ) |
||
4810 | : InheritableAttr(Ctx, CommonInfo, attr::Blocks, false, false) |
||
4811 | , type(Type) |
||
4812 | { |
||
4813 | } |
||
4814 | |||
4815 | |||
4816 | |||
4817 | bool BlocksAttr::ConvertStrToBlockType(StringRef Val, BlockType &Out) { |
||
4818 | std::optional<BlockType> R = llvm::StringSwitch<std::optional<BlockType>>(Val) |
||
4819 | .Case("byref", BlocksAttr::ByRef) |
||
4820 | .Default(std::optional<BlockType>()); |
||
4821 | if (R) { |
||
4822 | Out = *R; |
||
4823 | return true; |
||
4824 | } |
||
4825 | return false; |
||
4826 | } |
||
4827 | |||
4828 | const char *BlocksAttr::ConvertBlockTypeToStr(BlockType Val) { |
||
4829 | switch(Val) { |
||
4830 | case BlocksAttr::ByRef: return "byref"; |
||
4831 | } |
||
4832 | llvm_unreachable("No enumerator with that value"); |
||
4833 | } |
||
4834 | BlocksAttr *BlocksAttr::clone(ASTContext &C) const { |
||
4835 | auto *A = new (C) BlocksAttr(C, *this, type); |
||
4836 | A->Inherited = Inherited; |
||
4837 | A->IsPackExpansion = IsPackExpansion; |
||
4838 | A->setImplicit(Implicit); |
||
4839 | return A; |
||
4840 | } |
||
4841 | |||
4842 | void BlocksAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4843 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
4844 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
4845 | switch (getAttributeSpellingListIndex()) { |
||
4846 | default: |
||
4847 | llvm_unreachable("Unknown attribute spelling!"); |
||
4848 | break; |
||
4849 | case 0 : { |
||
4850 | OS << " __attribute__((blocks"; |
||
4851 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4852 | OS << "\"" << BlocksAttr::ConvertBlockTypeToStr(getType()) << "\""; |
||
4853 | if (!IsFirstArgument) |
||
4854 | OS << ")"; |
||
4855 | OS << "))"; |
||
4856 | break; |
||
4857 | } |
||
4858 | case 1 : { |
||
4859 | OS << " [[clang::blocks"; |
||
4860 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4861 | OS << "\"" << BlocksAttr::ConvertBlockTypeToStr(getType()) << "\""; |
||
4862 | if (!IsFirstArgument) |
||
4863 | OS << ")"; |
||
4864 | OS << "]]"; |
||
4865 | break; |
||
4866 | } |
||
4867 | case 2 : { |
||
4868 | OS << " [[clang::blocks"; |
||
4869 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
4870 | OS << "\"" << BlocksAttr::ConvertBlockTypeToStr(getType()) << "\""; |
||
4871 | if (!IsFirstArgument) |
||
4872 | OS << ")"; |
||
4873 | OS << "]]"; |
||
4874 | break; |
||
4875 | } |
||
4876 | } |
||
4877 | } |
||
4878 | |||
4879 | const char *BlocksAttr::getSpelling() const { |
||
4880 | switch (getAttributeSpellingListIndex()) { |
||
4881 | default: |
||
4882 | llvm_unreachable("Unknown attribute spelling!"); |
||
4883 | return "(No spelling)"; |
||
4884 | case 0: |
||
4885 | return "blocks"; |
||
4886 | case 1: |
||
4887 | return "blocks"; |
||
4888 | case 2: |
||
4889 | return "blocks"; |
||
4890 | } |
||
4891 | } |
||
4892 | |||
4893 | |||
4894 | // BuiltinAttr implementation |
||
4895 | |||
4896 | BuiltinAttr *BuiltinAttr::CreateImplicit(ASTContext &Ctx, unsigned ID, const AttributeCommonInfo &CommonInfo) { |
||
4897 | auto *A = new (Ctx) BuiltinAttr(Ctx, CommonInfo, ID); |
||
4898 | A->setImplicit(true); |
||
4899 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4900 | A->setAttributeSpellingListIndex(0); |
||
4901 | return A; |
||
4902 | } |
||
4903 | |||
4904 | BuiltinAttr *BuiltinAttr::Create(ASTContext &Ctx, unsigned ID, const AttributeCommonInfo &CommonInfo) { |
||
4905 | auto *A = new (Ctx) BuiltinAttr(Ctx, CommonInfo, ID); |
||
4906 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4907 | A->setAttributeSpellingListIndex(0); |
||
4908 | return A; |
||
4909 | } |
||
4910 | |||
4911 | BuiltinAttr *BuiltinAttr::CreateImplicit(ASTContext &Ctx, unsigned ID, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4912 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4913 | return CreateImplicit(Ctx, ID, I); |
||
4914 | } |
||
4915 | |||
4916 | BuiltinAttr *BuiltinAttr::Create(ASTContext &Ctx, unsigned ID, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
4917 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
4918 | return Create(Ctx, ID, I); |
||
4919 | } |
||
4920 | |||
4921 | BuiltinAttr::BuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4922 | , unsigned ID |
||
4923 | ) |
||
4924 | : InheritableAttr(Ctx, CommonInfo, attr::Builtin, false, false) |
||
4925 | , iD(ID) |
||
4926 | { |
||
4927 | } |
||
4928 | |||
4929 | |||
4930 | |||
4931 | BuiltinAttr *BuiltinAttr::clone(ASTContext &C) const { |
||
4932 | auto *A = new (C) BuiltinAttr(C, *this, iD); |
||
4933 | A->Inherited = Inherited; |
||
4934 | A->IsPackExpansion = IsPackExpansion; |
||
4935 | A->setImplicit(Implicit); |
||
4936 | return A; |
||
4937 | } |
||
4938 | |||
4939 | void BuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4940 | } |
||
4941 | |||
4942 | const char *BuiltinAttr::getSpelling() const { |
||
4943 | return "(No spelling)"; |
||
4944 | } |
||
4945 | |||
4946 | |||
4947 | // BuiltinAliasAttr implementation |
||
4948 | |||
4949 | BuiltinAliasAttr *BuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) { |
||
4950 | auto *A = new (Ctx) BuiltinAliasAttr(Ctx, CommonInfo, BuiltinName); |
||
4951 | A->setImplicit(true); |
||
4952 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
4953 | A->setAttributeSpellingListIndex(0); |
||
4954 | return A; |
||
4955 | } |
||
4956 | |||
4957 | BuiltinAliasAttr *BuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) { |
||
4958 | auto *A = new (Ctx) BuiltinAliasAttr(Ctx, CommonInfo, BuiltinName); |
||
4959 | return A; |
||
4960 | } |
||
4961 | |||
4962 | BuiltinAliasAttr *BuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, AttributeCommonInfo::Syntax Syntax, BuiltinAliasAttr::Spelling S) { |
||
4963 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
4964 | return CreateImplicit(Ctx, BuiltinName, I); |
||
4965 | } |
||
4966 | |||
4967 | BuiltinAliasAttr *BuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, AttributeCommonInfo::Syntax Syntax, BuiltinAliasAttr::Spelling S) { |
||
4968 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
4969 | return Create(Ctx, BuiltinName, I); |
||
4970 | } |
||
4971 | |||
4972 | BuiltinAliasAttr::BuiltinAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
4973 | , IdentifierInfo * BuiltinName |
||
4974 | ) |
||
4975 | : Attr(Ctx, CommonInfo, attr::BuiltinAlias, false) |
||
4976 | , builtinName(BuiltinName) |
||
4977 | { |
||
4978 | } |
||
4979 | |||
4980 | BuiltinAliasAttr::Spelling BuiltinAliasAttr::getSemanticSpelling() const { |
||
4981 | switch (getAttributeSpellingListIndex()) { |
||
4982 | default: llvm_unreachable("Unknown spelling list index"); |
||
4983 | case 0: return CXX11_clang_builtin_alias; |
||
4984 | case 1: return C2x_clang_builtin_alias; |
||
4985 | case 2: return GNU_clang_builtin_alias; |
||
4986 | } |
||
4987 | } |
||
4988 | |||
4989 | |||
4990 | BuiltinAliasAttr *BuiltinAliasAttr::clone(ASTContext &C) const { |
||
4991 | auto *A = new (C) BuiltinAliasAttr(C, *this, builtinName); |
||
4992 | A->Inherited = Inherited; |
||
4993 | A->IsPackExpansion = IsPackExpansion; |
||
4994 | A->setImplicit(Implicit); |
||
4995 | return A; |
||
4996 | } |
||
4997 | |||
4998 | void BuiltinAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
4999 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5000 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5001 | switch (getAttributeSpellingListIndex()) { |
||
5002 | default: |
||
5003 | llvm_unreachable("Unknown attribute spelling!"); |
||
5004 | break; |
||
5005 | case 0 : { |
||
5006 | OS << " [[clang::builtin_alias"; |
||
5007 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5008 | OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; |
||
5009 | if (!IsFirstArgument) |
||
5010 | OS << ")"; |
||
5011 | OS << "]]"; |
||
5012 | break; |
||
5013 | } |
||
5014 | case 1 : { |
||
5015 | OS << " [[clang::builtin_alias"; |
||
5016 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5017 | OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; |
||
5018 | if (!IsFirstArgument) |
||
5019 | OS << ")"; |
||
5020 | OS << "]]"; |
||
5021 | break; |
||
5022 | } |
||
5023 | case 2 : { |
||
5024 | OS << " __attribute__((clang_builtin_alias"; |
||
5025 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5026 | OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; |
||
5027 | if (!IsFirstArgument) |
||
5028 | OS << ")"; |
||
5029 | OS << "))"; |
||
5030 | break; |
||
5031 | } |
||
5032 | } |
||
5033 | } |
||
5034 | |||
5035 | const char *BuiltinAliasAttr::getSpelling() const { |
||
5036 | switch (getAttributeSpellingListIndex()) { |
||
5037 | default: |
||
5038 | llvm_unreachable("Unknown attribute spelling!"); |
||
5039 | return "(No spelling)"; |
||
5040 | case 0: |
||
5041 | return "builtin_alias"; |
||
5042 | case 1: |
||
5043 | return "builtin_alias"; |
||
5044 | case 2: |
||
5045 | return "clang_builtin_alias"; |
||
5046 | } |
||
5047 | } |
||
5048 | |||
5049 | |||
5050 | // C11NoReturnAttr implementation |
||
5051 | |||
5052 | C11NoReturnAttr *C11NoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5053 | auto *A = new (Ctx) C11NoReturnAttr(Ctx, CommonInfo); |
||
5054 | A->setImplicit(true); |
||
5055 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5056 | A->setAttributeSpellingListIndex(0); |
||
5057 | return A; |
||
5058 | } |
||
5059 | |||
5060 | C11NoReturnAttr *C11NoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5061 | auto *A = new (Ctx) C11NoReturnAttr(Ctx, CommonInfo); |
||
5062 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5063 | A->setAttributeSpellingListIndex(0); |
||
5064 | return A; |
||
5065 | } |
||
5066 | |||
5067 | C11NoReturnAttr *C11NoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5068 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5069 | return CreateImplicit(Ctx, I); |
||
5070 | } |
||
5071 | |||
5072 | C11NoReturnAttr *C11NoReturnAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5073 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5074 | return Create(Ctx, I); |
||
5075 | } |
||
5076 | |||
5077 | C11NoReturnAttr::C11NoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5078 | ) |
||
5079 | : InheritableAttr(Ctx, CommonInfo, attr::C11NoReturn, false, false) |
||
5080 | { |
||
5081 | } |
||
5082 | |||
5083 | C11NoReturnAttr *C11NoReturnAttr::clone(ASTContext &C) const { |
||
5084 | auto *A = new (C) C11NoReturnAttr(C, *this); |
||
5085 | A->Inherited = Inherited; |
||
5086 | A->IsPackExpansion = IsPackExpansion; |
||
5087 | A->setImplicit(Implicit); |
||
5088 | return A; |
||
5089 | } |
||
5090 | |||
5091 | void C11NoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5092 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5093 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5094 | switch (getAttributeSpellingListIndex()) { |
||
5095 | default: |
||
5096 | llvm_unreachable("Unknown attribute spelling!"); |
||
5097 | break; |
||
5098 | case 0 : { |
||
5099 | OS << " _Noreturn"; |
||
5100 | OS << ""; |
||
5101 | break; |
||
5102 | } |
||
5103 | } |
||
5104 | } |
||
5105 | |||
5106 | const char *C11NoReturnAttr::getSpelling() const { |
||
5107 | switch (getAttributeSpellingListIndex()) { |
||
5108 | default: |
||
5109 | llvm_unreachable("Unknown attribute spelling!"); |
||
5110 | return "(No spelling)"; |
||
5111 | case 0: |
||
5112 | return "_Noreturn"; |
||
5113 | } |
||
5114 | } |
||
5115 | |||
5116 | |||
5117 | // CDeclAttr implementation |
||
5118 | |||
5119 | CDeclAttr *CDeclAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5120 | auto *A = new (Ctx) CDeclAttr(Ctx, CommonInfo); |
||
5121 | A->setImplicit(true); |
||
5122 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5123 | A->setAttributeSpellingListIndex(0); |
||
5124 | return A; |
||
5125 | } |
||
5126 | |||
5127 | CDeclAttr *CDeclAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5128 | auto *A = new (Ctx) CDeclAttr(Ctx, CommonInfo); |
||
5129 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5130 | A->setAttributeSpellingListIndex(0); |
||
5131 | return A; |
||
5132 | } |
||
5133 | |||
5134 | CDeclAttr *CDeclAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5135 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5136 | return CreateImplicit(Ctx, I); |
||
5137 | } |
||
5138 | |||
5139 | CDeclAttr *CDeclAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5140 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5141 | return Create(Ctx, I); |
||
5142 | } |
||
5143 | |||
5144 | CDeclAttr::CDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5145 | ) |
||
5146 | : InheritableAttr(Ctx, CommonInfo, attr::CDecl, false, false) |
||
5147 | { |
||
5148 | } |
||
5149 | |||
5150 | CDeclAttr *CDeclAttr::clone(ASTContext &C) const { |
||
5151 | auto *A = new (C) CDeclAttr(C, *this); |
||
5152 | A->Inherited = Inherited; |
||
5153 | A->IsPackExpansion = IsPackExpansion; |
||
5154 | A->setImplicit(Implicit); |
||
5155 | return A; |
||
5156 | } |
||
5157 | |||
5158 | void CDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5159 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5160 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5161 | switch (getAttributeSpellingListIndex()) { |
||
5162 | default: |
||
5163 | llvm_unreachable("Unknown attribute spelling!"); |
||
5164 | break; |
||
5165 | case 0 : { |
||
5166 | OS << " __attribute__((cdecl"; |
||
5167 | OS << "))"; |
||
5168 | break; |
||
5169 | } |
||
5170 | case 1 : { |
||
5171 | OS << " [[gnu::cdecl"; |
||
5172 | OS << "]]"; |
||
5173 | break; |
||
5174 | } |
||
5175 | case 2 : { |
||
5176 | OS << " [[gnu::cdecl"; |
||
5177 | OS << "]]"; |
||
5178 | break; |
||
5179 | } |
||
5180 | case 3 : { |
||
5181 | OS << " __cdecl"; |
||
5182 | OS << ""; |
||
5183 | break; |
||
5184 | } |
||
5185 | case 4 : { |
||
5186 | OS << " _cdecl"; |
||
5187 | OS << ""; |
||
5188 | break; |
||
5189 | } |
||
5190 | } |
||
5191 | } |
||
5192 | |||
5193 | const char *CDeclAttr::getSpelling() const { |
||
5194 | switch (getAttributeSpellingListIndex()) { |
||
5195 | default: |
||
5196 | llvm_unreachable("Unknown attribute spelling!"); |
||
5197 | return "(No spelling)"; |
||
5198 | case 0: |
||
5199 | return "cdecl"; |
||
5200 | case 1: |
||
5201 | return "cdecl"; |
||
5202 | case 2: |
||
5203 | return "cdecl"; |
||
5204 | case 3: |
||
5205 | return "__cdecl"; |
||
5206 | case 4: |
||
5207 | return "_cdecl"; |
||
5208 | } |
||
5209 | } |
||
5210 | |||
5211 | |||
5212 | // CFAuditedTransferAttr implementation |
||
5213 | |||
5214 | CFAuditedTransferAttr *CFAuditedTransferAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5215 | auto *A = new (Ctx) CFAuditedTransferAttr(Ctx, CommonInfo); |
||
5216 | A->setImplicit(true); |
||
5217 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5218 | A->setAttributeSpellingListIndex(0); |
||
5219 | return A; |
||
5220 | } |
||
5221 | |||
5222 | CFAuditedTransferAttr *CFAuditedTransferAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5223 | auto *A = new (Ctx) CFAuditedTransferAttr(Ctx, CommonInfo); |
||
5224 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5225 | A->setAttributeSpellingListIndex(0); |
||
5226 | return A; |
||
5227 | } |
||
5228 | |||
5229 | CFAuditedTransferAttr *CFAuditedTransferAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5230 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5231 | return CreateImplicit(Ctx, I); |
||
5232 | } |
||
5233 | |||
5234 | CFAuditedTransferAttr *CFAuditedTransferAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5235 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5236 | return Create(Ctx, I); |
||
5237 | } |
||
5238 | |||
5239 | CFAuditedTransferAttr::CFAuditedTransferAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5240 | ) |
||
5241 | : InheritableAttr(Ctx, CommonInfo, attr::CFAuditedTransfer, false, false) |
||
5242 | { |
||
5243 | } |
||
5244 | |||
5245 | CFAuditedTransferAttr *CFAuditedTransferAttr::clone(ASTContext &C) const { |
||
5246 | auto *A = new (C) CFAuditedTransferAttr(C, *this); |
||
5247 | A->Inherited = Inherited; |
||
5248 | A->IsPackExpansion = IsPackExpansion; |
||
5249 | A->setImplicit(Implicit); |
||
5250 | return A; |
||
5251 | } |
||
5252 | |||
5253 | void CFAuditedTransferAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5254 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5255 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5256 | switch (getAttributeSpellingListIndex()) { |
||
5257 | default: |
||
5258 | llvm_unreachable("Unknown attribute spelling!"); |
||
5259 | break; |
||
5260 | case 0 : { |
||
5261 | OS << " __attribute__((cf_audited_transfer"; |
||
5262 | OS << "))"; |
||
5263 | break; |
||
5264 | } |
||
5265 | case 1 : { |
||
5266 | OS << " [[clang::cf_audited_transfer"; |
||
5267 | OS << "]]"; |
||
5268 | break; |
||
5269 | } |
||
5270 | case 2 : { |
||
5271 | OS << " [[clang::cf_audited_transfer"; |
||
5272 | OS << "]]"; |
||
5273 | break; |
||
5274 | } |
||
5275 | } |
||
5276 | } |
||
5277 | |||
5278 | const char *CFAuditedTransferAttr::getSpelling() const { |
||
5279 | switch (getAttributeSpellingListIndex()) { |
||
5280 | default: |
||
5281 | llvm_unreachable("Unknown attribute spelling!"); |
||
5282 | return "(No spelling)"; |
||
5283 | case 0: |
||
5284 | return "cf_audited_transfer"; |
||
5285 | case 1: |
||
5286 | return "cf_audited_transfer"; |
||
5287 | case 2: |
||
5288 | return "cf_audited_transfer"; |
||
5289 | } |
||
5290 | } |
||
5291 | |||
5292 | |||
5293 | // CFConsumedAttr implementation |
||
5294 | |||
5295 | CFConsumedAttr *CFConsumedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5296 | auto *A = new (Ctx) CFConsumedAttr(Ctx, CommonInfo); |
||
5297 | A->setImplicit(true); |
||
5298 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5299 | A->setAttributeSpellingListIndex(0); |
||
5300 | return A; |
||
5301 | } |
||
5302 | |||
5303 | CFConsumedAttr *CFConsumedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5304 | auto *A = new (Ctx) CFConsumedAttr(Ctx, CommonInfo); |
||
5305 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5306 | A->setAttributeSpellingListIndex(0); |
||
5307 | return A; |
||
5308 | } |
||
5309 | |||
5310 | CFConsumedAttr *CFConsumedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5311 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5312 | return CreateImplicit(Ctx, I); |
||
5313 | } |
||
5314 | |||
5315 | CFConsumedAttr *CFConsumedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5316 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5317 | return Create(Ctx, I); |
||
5318 | } |
||
5319 | |||
5320 | CFConsumedAttr::CFConsumedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5321 | ) |
||
5322 | : InheritableParamAttr(Ctx, CommonInfo, attr::CFConsumed, false, false) |
||
5323 | { |
||
5324 | } |
||
5325 | |||
5326 | CFConsumedAttr *CFConsumedAttr::clone(ASTContext &C) const { |
||
5327 | auto *A = new (C) CFConsumedAttr(C, *this); |
||
5328 | A->Inherited = Inherited; |
||
5329 | A->IsPackExpansion = IsPackExpansion; |
||
5330 | A->setImplicit(Implicit); |
||
5331 | return A; |
||
5332 | } |
||
5333 | |||
5334 | void CFConsumedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5335 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5336 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5337 | switch (getAttributeSpellingListIndex()) { |
||
5338 | default: |
||
5339 | llvm_unreachable("Unknown attribute spelling!"); |
||
5340 | break; |
||
5341 | case 0 : { |
||
5342 | OS << " __attribute__((cf_consumed"; |
||
5343 | OS << "))"; |
||
5344 | break; |
||
5345 | } |
||
5346 | case 1 : { |
||
5347 | OS << " [[clang::cf_consumed"; |
||
5348 | OS << "]]"; |
||
5349 | break; |
||
5350 | } |
||
5351 | case 2 : { |
||
5352 | OS << " [[clang::cf_consumed"; |
||
5353 | OS << "]]"; |
||
5354 | break; |
||
5355 | } |
||
5356 | } |
||
5357 | } |
||
5358 | |||
5359 | const char *CFConsumedAttr::getSpelling() const { |
||
5360 | switch (getAttributeSpellingListIndex()) { |
||
5361 | default: |
||
5362 | llvm_unreachable("Unknown attribute spelling!"); |
||
5363 | return "(No spelling)"; |
||
5364 | case 0: |
||
5365 | return "cf_consumed"; |
||
5366 | case 1: |
||
5367 | return "cf_consumed"; |
||
5368 | case 2: |
||
5369 | return "cf_consumed"; |
||
5370 | } |
||
5371 | } |
||
5372 | |||
5373 | |||
5374 | // CFGuardAttr implementation |
||
5375 | |||
5376 | CFGuardAttr *CFGuardAttr::CreateImplicit(ASTContext &Ctx, GuardArg Guard, const AttributeCommonInfo &CommonInfo) { |
||
5377 | auto *A = new (Ctx) CFGuardAttr(Ctx, CommonInfo, Guard); |
||
5378 | A->setImplicit(true); |
||
5379 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5380 | A->setAttributeSpellingListIndex(0); |
||
5381 | return A; |
||
5382 | } |
||
5383 | |||
5384 | CFGuardAttr *CFGuardAttr::Create(ASTContext &Ctx, GuardArg Guard, const AttributeCommonInfo &CommonInfo) { |
||
5385 | auto *A = new (Ctx) CFGuardAttr(Ctx, CommonInfo, Guard); |
||
5386 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5387 | A->setAttributeSpellingListIndex(0); |
||
5388 | return A; |
||
5389 | } |
||
5390 | |||
5391 | CFGuardAttr *CFGuardAttr::CreateImplicit(ASTContext &Ctx, GuardArg Guard, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5392 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5393 | return CreateImplicit(Ctx, Guard, I); |
||
5394 | } |
||
5395 | |||
5396 | CFGuardAttr *CFGuardAttr::Create(ASTContext &Ctx, GuardArg Guard, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5397 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5398 | return Create(Ctx, Guard, I); |
||
5399 | } |
||
5400 | |||
5401 | CFGuardAttr::CFGuardAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5402 | , GuardArg Guard |
||
5403 | ) |
||
5404 | : InheritableAttr(Ctx, CommonInfo, attr::CFGuard, false, false) |
||
5405 | , guard(Guard) |
||
5406 | { |
||
5407 | } |
||
5408 | |||
5409 | |||
5410 | |||
5411 | bool CFGuardAttr::ConvertStrToGuardArg(StringRef Val, GuardArg &Out) { |
||
5412 | std::optional<GuardArg> R = llvm::StringSwitch<std::optional<GuardArg>>(Val) |
||
5413 | .Case("nocf", CFGuardAttr::nocf) |
||
5414 | .Default(std::optional<GuardArg>()); |
||
5415 | if (R) { |
||
5416 | Out = *R; |
||
5417 | return true; |
||
5418 | } |
||
5419 | return false; |
||
5420 | } |
||
5421 | |||
5422 | const char *CFGuardAttr::ConvertGuardArgToStr(GuardArg Val) { |
||
5423 | switch(Val) { |
||
5424 | case CFGuardAttr::nocf: return "nocf"; |
||
5425 | } |
||
5426 | llvm_unreachable("No enumerator with that value"); |
||
5427 | } |
||
5428 | CFGuardAttr *CFGuardAttr::clone(ASTContext &C) const { |
||
5429 | auto *A = new (C) CFGuardAttr(C, *this, guard); |
||
5430 | A->Inherited = Inherited; |
||
5431 | A->IsPackExpansion = IsPackExpansion; |
||
5432 | A->setImplicit(Implicit); |
||
5433 | return A; |
||
5434 | } |
||
5435 | |||
5436 | void CFGuardAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5437 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5438 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5439 | switch (getAttributeSpellingListIndex()) { |
||
5440 | default: |
||
5441 | llvm_unreachable("Unknown attribute spelling!"); |
||
5442 | break; |
||
5443 | case 0 : { |
||
5444 | OS << " __declspec(guard"; |
||
5445 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5446 | OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\""; |
||
5447 | if (!IsFirstArgument) |
||
5448 | OS << ")"; |
||
5449 | OS << ")"; |
||
5450 | break; |
||
5451 | } |
||
5452 | case 1 : { |
||
5453 | OS << " __attribute__((guard"; |
||
5454 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5455 | OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\""; |
||
5456 | if (!IsFirstArgument) |
||
5457 | OS << ")"; |
||
5458 | OS << "))"; |
||
5459 | break; |
||
5460 | } |
||
5461 | case 2 : { |
||
5462 | OS << " [[clang::guard"; |
||
5463 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5464 | OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\""; |
||
5465 | if (!IsFirstArgument) |
||
5466 | OS << ")"; |
||
5467 | OS << "]]"; |
||
5468 | break; |
||
5469 | } |
||
5470 | case 3 : { |
||
5471 | OS << " [[clang::guard"; |
||
5472 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5473 | OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\""; |
||
5474 | if (!IsFirstArgument) |
||
5475 | OS << ")"; |
||
5476 | OS << "]]"; |
||
5477 | break; |
||
5478 | } |
||
5479 | } |
||
5480 | } |
||
5481 | |||
5482 | const char *CFGuardAttr::getSpelling() const { |
||
5483 | switch (getAttributeSpellingListIndex()) { |
||
5484 | default: |
||
5485 | llvm_unreachable("Unknown attribute spelling!"); |
||
5486 | return "(No spelling)"; |
||
5487 | case 0: |
||
5488 | return "guard"; |
||
5489 | case 1: |
||
5490 | return "guard"; |
||
5491 | case 2: |
||
5492 | return "guard"; |
||
5493 | case 3: |
||
5494 | return "guard"; |
||
5495 | } |
||
5496 | } |
||
5497 | |||
5498 | |||
5499 | // CFICanonicalJumpTableAttr implementation |
||
5500 | |||
5501 | CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5502 | auto *A = new (Ctx) CFICanonicalJumpTableAttr(Ctx, CommonInfo); |
||
5503 | A->setImplicit(true); |
||
5504 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5505 | A->setAttributeSpellingListIndex(0); |
||
5506 | return A; |
||
5507 | } |
||
5508 | |||
5509 | CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5510 | auto *A = new (Ctx) CFICanonicalJumpTableAttr(Ctx, CommonInfo); |
||
5511 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5512 | A->setAttributeSpellingListIndex(0); |
||
5513 | return A; |
||
5514 | } |
||
5515 | |||
5516 | CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5517 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5518 | return CreateImplicit(Ctx, I); |
||
5519 | } |
||
5520 | |||
5521 | CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5522 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5523 | return Create(Ctx, I); |
||
5524 | } |
||
5525 | |||
5526 | CFICanonicalJumpTableAttr::CFICanonicalJumpTableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5527 | ) |
||
5528 | : InheritableAttr(Ctx, CommonInfo, attr::CFICanonicalJumpTable, false, false) |
||
5529 | { |
||
5530 | } |
||
5531 | |||
5532 | CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::clone(ASTContext &C) const { |
||
5533 | auto *A = new (C) CFICanonicalJumpTableAttr(C, *this); |
||
5534 | A->Inherited = Inherited; |
||
5535 | A->IsPackExpansion = IsPackExpansion; |
||
5536 | A->setImplicit(Implicit); |
||
5537 | return A; |
||
5538 | } |
||
5539 | |||
5540 | void CFICanonicalJumpTableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5541 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5542 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5543 | switch (getAttributeSpellingListIndex()) { |
||
5544 | default: |
||
5545 | llvm_unreachable("Unknown attribute spelling!"); |
||
5546 | break; |
||
5547 | case 0 : { |
||
5548 | OS << " __attribute__((cfi_canonical_jump_table"; |
||
5549 | OS << "))"; |
||
5550 | break; |
||
5551 | } |
||
5552 | case 1 : { |
||
5553 | OS << " [[clang::cfi_canonical_jump_table"; |
||
5554 | OS << "]]"; |
||
5555 | break; |
||
5556 | } |
||
5557 | case 2 : { |
||
5558 | OS << " [[clang::cfi_canonical_jump_table"; |
||
5559 | OS << "]]"; |
||
5560 | break; |
||
5561 | } |
||
5562 | } |
||
5563 | } |
||
5564 | |||
5565 | const char *CFICanonicalJumpTableAttr::getSpelling() const { |
||
5566 | switch (getAttributeSpellingListIndex()) { |
||
5567 | default: |
||
5568 | llvm_unreachable("Unknown attribute spelling!"); |
||
5569 | return "(No spelling)"; |
||
5570 | case 0: |
||
5571 | return "cfi_canonical_jump_table"; |
||
5572 | case 1: |
||
5573 | return "cfi_canonical_jump_table"; |
||
5574 | case 2: |
||
5575 | return "cfi_canonical_jump_table"; |
||
5576 | } |
||
5577 | } |
||
5578 | |||
5579 | |||
5580 | // CFReturnsNotRetainedAttr implementation |
||
5581 | |||
5582 | CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5583 | auto *A = new (Ctx) CFReturnsNotRetainedAttr(Ctx, CommonInfo); |
||
5584 | A->setImplicit(true); |
||
5585 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5586 | A->setAttributeSpellingListIndex(0); |
||
5587 | return A; |
||
5588 | } |
||
5589 | |||
5590 | CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5591 | auto *A = new (Ctx) CFReturnsNotRetainedAttr(Ctx, CommonInfo); |
||
5592 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5593 | A->setAttributeSpellingListIndex(0); |
||
5594 | return A; |
||
5595 | } |
||
5596 | |||
5597 | CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5598 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5599 | return CreateImplicit(Ctx, I); |
||
5600 | } |
||
5601 | |||
5602 | CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5603 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5604 | return Create(Ctx, I); |
||
5605 | } |
||
5606 | |||
5607 | CFReturnsNotRetainedAttr::CFReturnsNotRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5608 | ) |
||
5609 | : InheritableAttr(Ctx, CommonInfo, attr::CFReturnsNotRetained, false, false) |
||
5610 | { |
||
5611 | } |
||
5612 | |||
5613 | CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::clone(ASTContext &C) const { |
||
5614 | auto *A = new (C) CFReturnsNotRetainedAttr(C, *this); |
||
5615 | A->Inherited = Inherited; |
||
5616 | A->IsPackExpansion = IsPackExpansion; |
||
5617 | A->setImplicit(Implicit); |
||
5618 | return A; |
||
5619 | } |
||
5620 | |||
5621 | void CFReturnsNotRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5622 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5623 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5624 | switch (getAttributeSpellingListIndex()) { |
||
5625 | default: |
||
5626 | llvm_unreachable("Unknown attribute spelling!"); |
||
5627 | break; |
||
5628 | case 0 : { |
||
5629 | OS << " __attribute__((cf_returns_not_retained"; |
||
5630 | OS << "))"; |
||
5631 | break; |
||
5632 | } |
||
5633 | case 1 : { |
||
5634 | OS << " [[clang::cf_returns_not_retained"; |
||
5635 | OS << "]]"; |
||
5636 | break; |
||
5637 | } |
||
5638 | case 2 : { |
||
5639 | OS << " [[clang::cf_returns_not_retained"; |
||
5640 | OS << "]]"; |
||
5641 | break; |
||
5642 | } |
||
5643 | } |
||
5644 | } |
||
5645 | |||
5646 | const char *CFReturnsNotRetainedAttr::getSpelling() const { |
||
5647 | switch (getAttributeSpellingListIndex()) { |
||
5648 | default: |
||
5649 | llvm_unreachable("Unknown attribute spelling!"); |
||
5650 | return "(No spelling)"; |
||
5651 | case 0: |
||
5652 | return "cf_returns_not_retained"; |
||
5653 | case 1: |
||
5654 | return "cf_returns_not_retained"; |
||
5655 | case 2: |
||
5656 | return "cf_returns_not_retained"; |
||
5657 | } |
||
5658 | } |
||
5659 | |||
5660 | |||
5661 | // CFReturnsRetainedAttr implementation |
||
5662 | |||
5663 | CFReturnsRetainedAttr *CFReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5664 | auto *A = new (Ctx) CFReturnsRetainedAttr(Ctx, CommonInfo); |
||
5665 | A->setImplicit(true); |
||
5666 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5667 | A->setAttributeSpellingListIndex(0); |
||
5668 | return A; |
||
5669 | } |
||
5670 | |||
5671 | CFReturnsRetainedAttr *CFReturnsRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5672 | auto *A = new (Ctx) CFReturnsRetainedAttr(Ctx, CommonInfo); |
||
5673 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5674 | A->setAttributeSpellingListIndex(0); |
||
5675 | return A; |
||
5676 | } |
||
5677 | |||
5678 | CFReturnsRetainedAttr *CFReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5679 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5680 | return CreateImplicit(Ctx, I); |
||
5681 | } |
||
5682 | |||
5683 | CFReturnsRetainedAttr *CFReturnsRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5684 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5685 | return Create(Ctx, I); |
||
5686 | } |
||
5687 | |||
5688 | CFReturnsRetainedAttr::CFReturnsRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5689 | ) |
||
5690 | : InheritableAttr(Ctx, CommonInfo, attr::CFReturnsRetained, false, false) |
||
5691 | { |
||
5692 | } |
||
5693 | |||
5694 | CFReturnsRetainedAttr *CFReturnsRetainedAttr::clone(ASTContext &C) const { |
||
5695 | auto *A = new (C) CFReturnsRetainedAttr(C, *this); |
||
5696 | A->Inherited = Inherited; |
||
5697 | A->IsPackExpansion = IsPackExpansion; |
||
5698 | A->setImplicit(Implicit); |
||
5699 | return A; |
||
5700 | } |
||
5701 | |||
5702 | void CFReturnsRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5703 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5704 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5705 | switch (getAttributeSpellingListIndex()) { |
||
5706 | default: |
||
5707 | llvm_unreachable("Unknown attribute spelling!"); |
||
5708 | break; |
||
5709 | case 0 : { |
||
5710 | OS << " __attribute__((cf_returns_retained"; |
||
5711 | OS << "))"; |
||
5712 | break; |
||
5713 | } |
||
5714 | case 1 : { |
||
5715 | OS << " [[clang::cf_returns_retained"; |
||
5716 | OS << "]]"; |
||
5717 | break; |
||
5718 | } |
||
5719 | case 2 : { |
||
5720 | OS << " [[clang::cf_returns_retained"; |
||
5721 | OS << "]]"; |
||
5722 | break; |
||
5723 | } |
||
5724 | } |
||
5725 | } |
||
5726 | |||
5727 | const char *CFReturnsRetainedAttr::getSpelling() const { |
||
5728 | switch (getAttributeSpellingListIndex()) { |
||
5729 | default: |
||
5730 | llvm_unreachable("Unknown attribute spelling!"); |
||
5731 | return "(No spelling)"; |
||
5732 | case 0: |
||
5733 | return "cf_returns_retained"; |
||
5734 | case 1: |
||
5735 | return "cf_returns_retained"; |
||
5736 | case 2: |
||
5737 | return "cf_returns_retained"; |
||
5738 | } |
||
5739 | } |
||
5740 | |||
5741 | |||
5742 | // CFUnknownTransferAttr implementation |
||
5743 | |||
5744 | CFUnknownTransferAttr *CFUnknownTransferAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5745 | auto *A = new (Ctx) CFUnknownTransferAttr(Ctx, CommonInfo); |
||
5746 | A->setImplicit(true); |
||
5747 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5748 | A->setAttributeSpellingListIndex(0); |
||
5749 | return A; |
||
5750 | } |
||
5751 | |||
5752 | CFUnknownTransferAttr *CFUnknownTransferAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
5753 | auto *A = new (Ctx) CFUnknownTransferAttr(Ctx, CommonInfo); |
||
5754 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5755 | A->setAttributeSpellingListIndex(0); |
||
5756 | return A; |
||
5757 | } |
||
5758 | |||
5759 | CFUnknownTransferAttr *CFUnknownTransferAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5760 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5761 | return CreateImplicit(Ctx, I); |
||
5762 | } |
||
5763 | |||
5764 | CFUnknownTransferAttr *CFUnknownTransferAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5765 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5766 | return Create(Ctx, I); |
||
5767 | } |
||
5768 | |||
5769 | CFUnknownTransferAttr::CFUnknownTransferAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5770 | ) |
||
5771 | : InheritableAttr(Ctx, CommonInfo, attr::CFUnknownTransfer, false, false) |
||
5772 | { |
||
5773 | } |
||
5774 | |||
5775 | CFUnknownTransferAttr *CFUnknownTransferAttr::clone(ASTContext &C) const { |
||
5776 | auto *A = new (C) CFUnknownTransferAttr(C, *this); |
||
5777 | A->Inherited = Inherited; |
||
5778 | A->IsPackExpansion = IsPackExpansion; |
||
5779 | A->setImplicit(Implicit); |
||
5780 | return A; |
||
5781 | } |
||
5782 | |||
5783 | void CFUnknownTransferAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5784 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5785 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5786 | switch (getAttributeSpellingListIndex()) { |
||
5787 | default: |
||
5788 | llvm_unreachable("Unknown attribute spelling!"); |
||
5789 | break; |
||
5790 | case 0 : { |
||
5791 | OS << " __attribute__((cf_unknown_transfer"; |
||
5792 | OS << "))"; |
||
5793 | break; |
||
5794 | } |
||
5795 | case 1 : { |
||
5796 | OS << " [[clang::cf_unknown_transfer"; |
||
5797 | OS << "]]"; |
||
5798 | break; |
||
5799 | } |
||
5800 | case 2 : { |
||
5801 | OS << " [[clang::cf_unknown_transfer"; |
||
5802 | OS << "]]"; |
||
5803 | break; |
||
5804 | } |
||
5805 | } |
||
5806 | } |
||
5807 | |||
5808 | const char *CFUnknownTransferAttr::getSpelling() const { |
||
5809 | switch (getAttributeSpellingListIndex()) { |
||
5810 | default: |
||
5811 | llvm_unreachable("Unknown attribute spelling!"); |
||
5812 | return "(No spelling)"; |
||
5813 | case 0: |
||
5814 | return "cf_unknown_transfer"; |
||
5815 | case 1: |
||
5816 | return "cf_unknown_transfer"; |
||
5817 | case 2: |
||
5818 | return "cf_unknown_transfer"; |
||
5819 | } |
||
5820 | } |
||
5821 | |||
5822 | |||
5823 | // CPUDispatchAttr implementation |
||
5824 | |||
5825 | CPUDispatchAttr *CPUDispatchAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) { |
||
5826 | auto *A = new (Ctx) CPUDispatchAttr(Ctx, CommonInfo, Cpus, CpusSize); |
||
5827 | A->setImplicit(true); |
||
5828 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5829 | A->setAttributeSpellingListIndex(0); |
||
5830 | return A; |
||
5831 | } |
||
5832 | |||
5833 | CPUDispatchAttr *CPUDispatchAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) { |
||
5834 | auto *A = new (Ctx) CPUDispatchAttr(Ctx, CommonInfo, Cpus, CpusSize); |
||
5835 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5836 | A->setAttributeSpellingListIndex(0); |
||
5837 | return A; |
||
5838 | } |
||
5839 | |||
5840 | CPUDispatchAttr *CPUDispatchAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5841 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5842 | return CreateImplicit(Ctx, Cpus, CpusSize, I); |
||
5843 | } |
||
5844 | |||
5845 | CPUDispatchAttr *CPUDispatchAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5846 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5847 | return Create(Ctx, Cpus, CpusSize, I); |
||
5848 | } |
||
5849 | |||
5850 | CPUDispatchAttr::CPUDispatchAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5851 | , IdentifierInfo * *Cpus, unsigned CpusSize |
||
5852 | ) |
||
5853 | : InheritableAttr(Ctx, CommonInfo, attr::CPUDispatch, false, false) |
||
5854 | , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size]) |
||
5855 | { |
||
5856 | std::copy(Cpus, Cpus + cpus_Size, cpus_); |
||
5857 | } |
||
5858 | |||
5859 | CPUDispatchAttr::CPUDispatchAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5860 | ) |
||
5861 | : InheritableAttr(Ctx, CommonInfo, attr::CPUDispatch, false, false) |
||
5862 | , cpus_Size(0), cpus_(nullptr) |
||
5863 | { |
||
5864 | } |
||
5865 | |||
5866 | |||
5867 | |||
5868 | CPUDispatchAttr *CPUDispatchAttr::clone(ASTContext &C) const { |
||
5869 | auto *A = new (C) CPUDispatchAttr(C, *this, cpus_, cpus_Size); |
||
5870 | A->Inherited = Inherited; |
||
5871 | A->IsPackExpansion = IsPackExpansion; |
||
5872 | A->setImplicit(Implicit); |
||
5873 | return A; |
||
5874 | } |
||
5875 | |||
5876 | void CPUDispatchAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
5877 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
5878 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
5879 | switch (getAttributeSpellingListIndex()) { |
||
5880 | default: |
||
5881 | llvm_unreachable("Unknown attribute spelling!"); |
||
5882 | break; |
||
5883 | case 0 : { |
||
5884 | OS << " __attribute__((cpu_dispatch"; |
||
5885 | OS << ""; |
||
5886 | for (const auto &Val : cpus()) { |
||
5887 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5888 | OS << Val; |
||
5889 | } |
||
5890 | OS << ""; |
||
5891 | if (!IsFirstArgument) |
||
5892 | OS << ")"; |
||
5893 | OS << "))"; |
||
5894 | break; |
||
5895 | } |
||
5896 | case 1 : { |
||
5897 | OS << " [[clang::cpu_dispatch"; |
||
5898 | OS << ""; |
||
5899 | for (const auto &Val : cpus()) { |
||
5900 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5901 | OS << Val; |
||
5902 | } |
||
5903 | OS << ""; |
||
5904 | if (!IsFirstArgument) |
||
5905 | OS << ")"; |
||
5906 | OS << "]]"; |
||
5907 | break; |
||
5908 | } |
||
5909 | case 2 : { |
||
5910 | OS << " [[clang::cpu_dispatch"; |
||
5911 | OS << ""; |
||
5912 | for (const auto &Val : cpus()) { |
||
5913 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5914 | OS << Val; |
||
5915 | } |
||
5916 | OS << ""; |
||
5917 | if (!IsFirstArgument) |
||
5918 | OS << ")"; |
||
5919 | OS << "]]"; |
||
5920 | break; |
||
5921 | } |
||
5922 | case 3 : { |
||
5923 | OS << " __declspec(cpu_dispatch"; |
||
5924 | OS << ""; |
||
5925 | for (const auto &Val : cpus()) { |
||
5926 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
5927 | OS << Val; |
||
5928 | } |
||
5929 | OS << ""; |
||
5930 | if (!IsFirstArgument) |
||
5931 | OS << ")"; |
||
5932 | OS << ")"; |
||
5933 | break; |
||
5934 | } |
||
5935 | } |
||
5936 | } |
||
5937 | |||
5938 | const char *CPUDispatchAttr::getSpelling() const { |
||
5939 | switch (getAttributeSpellingListIndex()) { |
||
5940 | default: |
||
5941 | llvm_unreachable("Unknown attribute spelling!"); |
||
5942 | return "(No spelling)"; |
||
5943 | case 0: |
||
5944 | return "cpu_dispatch"; |
||
5945 | case 1: |
||
5946 | return "cpu_dispatch"; |
||
5947 | case 2: |
||
5948 | return "cpu_dispatch"; |
||
5949 | case 3: |
||
5950 | return "cpu_dispatch"; |
||
5951 | } |
||
5952 | } |
||
5953 | |||
5954 | |||
5955 | // CPUSpecificAttr implementation |
||
5956 | |||
5957 | CPUSpecificAttr *CPUSpecificAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) { |
||
5958 | auto *A = new (Ctx) CPUSpecificAttr(Ctx, CommonInfo, Cpus, CpusSize); |
||
5959 | A->setImplicit(true); |
||
5960 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5961 | A->setAttributeSpellingListIndex(0); |
||
5962 | return A; |
||
5963 | } |
||
5964 | |||
5965 | CPUSpecificAttr *CPUSpecificAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) { |
||
5966 | auto *A = new (Ctx) CPUSpecificAttr(Ctx, CommonInfo, Cpus, CpusSize); |
||
5967 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
5968 | A->setAttributeSpellingListIndex(0); |
||
5969 | return A; |
||
5970 | } |
||
5971 | |||
5972 | CPUSpecificAttr *CPUSpecificAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5973 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5974 | return CreateImplicit(Ctx, Cpus, CpusSize, I); |
||
5975 | } |
||
5976 | |||
5977 | CPUSpecificAttr *CPUSpecificAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
5978 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
5979 | return Create(Ctx, Cpus, CpusSize, I); |
||
5980 | } |
||
5981 | |||
5982 | CPUSpecificAttr::CPUSpecificAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5983 | , IdentifierInfo * *Cpus, unsigned CpusSize |
||
5984 | ) |
||
5985 | : InheritableAttr(Ctx, CommonInfo, attr::CPUSpecific, false, false) |
||
5986 | , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size]) |
||
5987 | { |
||
5988 | std::copy(Cpus, Cpus + cpus_Size, cpus_); |
||
5989 | } |
||
5990 | |||
5991 | CPUSpecificAttr::CPUSpecificAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
5992 | ) |
||
5993 | : InheritableAttr(Ctx, CommonInfo, attr::CPUSpecific, false, false) |
||
5994 | , cpus_Size(0), cpus_(nullptr) |
||
5995 | { |
||
5996 | } |
||
5997 | |||
5998 | |||
5999 | |||
6000 | CPUSpecificAttr *CPUSpecificAttr::clone(ASTContext &C) const { |
||
6001 | auto *A = new (C) CPUSpecificAttr(C, *this, cpus_, cpus_Size); |
||
6002 | A->Inherited = Inherited; |
||
6003 | A->IsPackExpansion = IsPackExpansion; |
||
6004 | A->setImplicit(Implicit); |
||
6005 | return A; |
||
6006 | } |
||
6007 | |||
6008 | void CPUSpecificAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6009 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6010 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6011 | switch (getAttributeSpellingListIndex()) { |
||
6012 | default: |
||
6013 | llvm_unreachable("Unknown attribute spelling!"); |
||
6014 | break; |
||
6015 | case 0 : { |
||
6016 | OS << " __attribute__((cpu_specific"; |
||
6017 | OS << ""; |
||
6018 | for (const auto &Val : cpus()) { |
||
6019 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6020 | OS << Val; |
||
6021 | } |
||
6022 | OS << ""; |
||
6023 | if (!IsFirstArgument) |
||
6024 | OS << ")"; |
||
6025 | OS << "))"; |
||
6026 | break; |
||
6027 | } |
||
6028 | case 1 : { |
||
6029 | OS << " [[clang::cpu_specific"; |
||
6030 | OS << ""; |
||
6031 | for (const auto &Val : cpus()) { |
||
6032 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6033 | OS << Val; |
||
6034 | } |
||
6035 | OS << ""; |
||
6036 | if (!IsFirstArgument) |
||
6037 | OS << ")"; |
||
6038 | OS << "]]"; |
||
6039 | break; |
||
6040 | } |
||
6041 | case 2 : { |
||
6042 | OS << " [[clang::cpu_specific"; |
||
6043 | OS << ""; |
||
6044 | for (const auto &Val : cpus()) { |
||
6045 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6046 | OS << Val; |
||
6047 | } |
||
6048 | OS << ""; |
||
6049 | if (!IsFirstArgument) |
||
6050 | OS << ")"; |
||
6051 | OS << "]]"; |
||
6052 | break; |
||
6053 | } |
||
6054 | case 3 : { |
||
6055 | OS << " __declspec(cpu_specific"; |
||
6056 | OS << ""; |
||
6057 | for (const auto &Val : cpus()) { |
||
6058 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6059 | OS << Val; |
||
6060 | } |
||
6061 | OS << ""; |
||
6062 | if (!IsFirstArgument) |
||
6063 | OS << ")"; |
||
6064 | OS << ")"; |
||
6065 | break; |
||
6066 | } |
||
6067 | } |
||
6068 | } |
||
6069 | |||
6070 | const char *CPUSpecificAttr::getSpelling() const { |
||
6071 | switch (getAttributeSpellingListIndex()) { |
||
6072 | default: |
||
6073 | llvm_unreachable("Unknown attribute spelling!"); |
||
6074 | return "(No spelling)"; |
||
6075 | case 0: |
||
6076 | return "cpu_specific"; |
||
6077 | case 1: |
||
6078 | return "cpu_specific"; |
||
6079 | case 2: |
||
6080 | return "cpu_specific"; |
||
6081 | case 3: |
||
6082 | return "cpu_specific"; |
||
6083 | } |
||
6084 | } |
||
6085 | |||
6086 | |||
6087 | // CUDAConstantAttr implementation |
||
6088 | |||
6089 | CUDAConstantAttr *CUDAConstantAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6090 | auto *A = new (Ctx) CUDAConstantAttr(Ctx, CommonInfo); |
||
6091 | A->setImplicit(true); |
||
6092 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6093 | A->setAttributeSpellingListIndex(0); |
||
6094 | return A; |
||
6095 | } |
||
6096 | |||
6097 | CUDAConstantAttr *CUDAConstantAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6098 | auto *A = new (Ctx) CUDAConstantAttr(Ctx, CommonInfo); |
||
6099 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6100 | A->setAttributeSpellingListIndex(0); |
||
6101 | return A; |
||
6102 | } |
||
6103 | |||
6104 | CUDAConstantAttr *CUDAConstantAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6105 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6106 | return CreateImplicit(Ctx, I); |
||
6107 | } |
||
6108 | |||
6109 | CUDAConstantAttr *CUDAConstantAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6110 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6111 | return Create(Ctx, I); |
||
6112 | } |
||
6113 | |||
6114 | CUDAConstantAttr::CUDAConstantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6115 | ) |
||
6116 | : InheritableAttr(Ctx, CommonInfo, attr::CUDAConstant, false, false) |
||
6117 | { |
||
6118 | } |
||
6119 | |||
6120 | CUDAConstantAttr *CUDAConstantAttr::clone(ASTContext &C) const { |
||
6121 | auto *A = new (C) CUDAConstantAttr(C, *this); |
||
6122 | A->Inherited = Inherited; |
||
6123 | A->IsPackExpansion = IsPackExpansion; |
||
6124 | A->setImplicit(Implicit); |
||
6125 | return A; |
||
6126 | } |
||
6127 | |||
6128 | void CUDAConstantAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6129 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6130 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6131 | switch (getAttributeSpellingListIndex()) { |
||
6132 | default: |
||
6133 | llvm_unreachable("Unknown attribute spelling!"); |
||
6134 | break; |
||
6135 | case 0 : { |
||
6136 | OS << " __attribute__((constant"; |
||
6137 | OS << "))"; |
||
6138 | break; |
||
6139 | } |
||
6140 | case 1 : { |
||
6141 | OS << " __declspec(__constant__"; |
||
6142 | OS << ")"; |
||
6143 | break; |
||
6144 | } |
||
6145 | } |
||
6146 | } |
||
6147 | |||
6148 | const char *CUDAConstantAttr::getSpelling() const { |
||
6149 | switch (getAttributeSpellingListIndex()) { |
||
6150 | default: |
||
6151 | llvm_unreachable("Unknown attribute spelling!"); |
||
6152 | return "(No spelling)"; |
||
6153 | case 0: |
||
6154 | return "constant"; |
||
6155 | case 1: |
||
6156 | return "__constant__"; |
||
6157 | } |
||
6158 | } |
||
6159 | |||
6160 | |||
6161 | // CUDADeviceAttr implementation |
||
6162 | |||
6163 | CUDADeviceAttr *CUDADeviceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6164 | auto *A = new (Ctx) CUDADeviceAttr(Ctx, CommonInfo); |
||
6165 | A->setImplicit(true); |
||
6166 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6167 | A->setAttributeSpellingListIndex(0); |
||
6168 | return A; |
||
6169 | } |
||
6170 | |||
6171 | CUDADeviceAttr *CUDADeviceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6172 | auto *A = new (Ctx) CUDADeviceAttr(Ctx, CommonInfo); |
||
6173 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6174 | A->setAttributeSpellingListIndex(0); |
||
6175 | return A; |
||
6176 | } |
||
6177 | |||
6178 | CUDADeviceAttr *CUDADeviceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6179 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6180 | return CreateImplicit(Ctx, I); |
||
6181 | } |
||
6182 | |||
6183 | CUDADeviceAttr *CUDADeviceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6184 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6185 | return Create(Ctx, I); |
||
6186 | } |
||
6187 | |||
6188 | CUDADeviceAttr::CUDADeviceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6189 | ) |
||
6190 | : InheritableAttr(Ctx, CommonInfo, attr::CUDADevice, false, false) |
||
6191 | { |
||
6192 | } |
||
6193 | |||
6194 | CUDADeviceAttr *CUDADeviceAttr::clone(ASTContext &C) const { |
||
6195 | auto *A = new (C) CUDADeviceAttr(C, *this); |
||
6196 | A->Inherited = Inherited; |
||
6197 | A->IsPackExpansion = IsPackExpansion; |
||
6198 | A->setImplicit(Implicit); |
||
6199 | return A; |
||
6200 | } |
||
6201 | |||
6202 | void CUDADeviceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6203 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6204 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6205 | switch (getAttributeSpellingListIndex()) { |
||
6206 | default: |
||
6207 | llvm_unreachable("Unknown attribute spelling!"); |
||
6208 | break; |
||
6209 | case 0 : { |
||
6210 | OS << " __attribute__((device"; |
||
6211 | OS << "))"; |
||
6212 | break; |
||
6213 | } |
||
6214 | case 1 : { |
||
6215 | OS << " __declspec(__device__"; |
||
6216 | OS << ")"; |
||
6217 | break; |
||
6218 | } |
||
6219 | } |
||
6220 | } |
||
6221 | |||
6222 | const char *CUDADeviceAttr::getSpelling() const { |
||
6223 | switch (getAttributeSpellingListIndex()) { |
||
6224 | default: |
||
6225 | llvm_unreachable("Unknown attribute spelling!"); |
||
6226 | return "(No spelling)"; |
||
6227 | case 0: |
||
6228 | return "device"; |
||
6229 | case 1: |
||
6230 | return "__device__"; |
||
6231 | } |
||
6232 | } |
||
6233 | |||
6234 | |||
6235 | // CUDADeviceBuiltinSurfaceTypeAttr implementation |
||
6236 | |||
6237 | CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6238 | auto *A = new (Ctx) CUDADeviceBuiltinSurfaceTypeAttr(Ctx, CommonInfo); |
||
6239 | A->setImplicit(true); |
||
6240 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6241 | A->setAttributeSpellingListIndex(0); |
||
6242 | return A; |
||
6243 | } |
||
6244 | |||
6245 | CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6246 | auto *A = new (Ctx) CUDADeviceBuiltinSurfaceTypeAttr(Ctx, CommonInfo); |
||
6247 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6248 | A->setAttributeSpellingListIndex(0); |
||
6249 | return A; |
||
6250 | } |
||
6251 | |||
6252 | CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6253 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6254 | return CreateImplicit(Ctx, I); |
||
6255 | } |
||
6256 | |||
6257 | CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6258 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6259 | return Create(Ctx, I); |
||
6260 | } |
||
6261 | |||
6262 | CUDADeviceBuiltinSurfaceTypeAttr::CUDADeviceBuiltinSurfaceTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6263 | ) |
||
6264 | : InheritableAttr(Ctx, CommonInfo, attr::CUDADeviceBuiltinSurfaceType, false, false) |
||
6265 | { |
||
6266 | } |
||
6267 | |||
6268 | CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::clone(ASTContext &C) const { |
||
6269 | auto *A = new (C) CUDADeviceBuiltinSurfaceTypeAttr(C, *this); |
||
6270 | A->Inherited = Inherited; |
||
6271 | A->IsPackExpansion = IsPackExpansion; |
||
6272 | A->setImplicit(Implicit); |
||
6273 | return A; |
||
6274 | } |
||
6275 | |||
6276 | void CUDADeviceBuiltinSurfaceTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6277 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6278 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6279 | switch (getAttributeSpellingListIndex()) { |
||
6280 | default: |
||
6281 | llvm_unreachable("Unknown attribute spelling!"); |
||
6282 | break; |
||
6283 | case 0 : { |
||
6284 | OS << " __attribute__((device_builtin_surface_type"; |
||
6285 | OS << "))"; |
||
6286 | break; |
||
6287 | } |
||
6288 | case 1 : { |
||
6289 | OS << " __declspec(__device_builtin_surface_type__"; |
||
6290 | OS << ")"; |
||
6291 | break; |
||
6292 | } |
||
6293 | } |
||
6294 | } |
||
6295 | |||
6296 | const char *CUDADeviceBuiltinSurfaceTypeAttr::getSpelling() const { |
||
6297 | switch (getAttributeSpellingListIndex()) { |
||
6298 | default: |
||
6299 | llvm_unreachable("Unknown attribute spelling!"); |
||
6300 | return "(No spelling)"; |
||
6301 | case 0: |
||
6302 | return "device_builtin_surface_type"; |
||
6303 | case 1: |
||
6304 | return "__device_builtin_surface_type__"; |
||
6305 | } |
||
6306 | } |
||
6307 | |||
6308 | |||
6309 | // CUDADeviceBuiltinTextureTypeAttr implementation |
||
6310 | |||
6311 | CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6312 | auto *A = new (Ctx) CUDADeviceBuiltinTextureTypeAttr(Ctx, CommonInfo); |
||
6313 | A->setImplicit(true); |
||
6314 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6315 | A->setAttributeSpellingListIndex(0); |
||
6316 | return A; |
||
6317 | } |
||
6318 | |||
6319 | CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6320 | auto *A = new (Ctx) CUDADeviceBuiltinTextureTypeAttr(Ctx, CommonInfo); |
||
6321 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6322 | A->setAttributeSpellingListIndex(0); |
||
6323 | return A; |
||
6324 | } |
||
6325 | |||
6326 | CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6327 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6328 | return CreateImplicit(Ctx, I); |
||
6329 | } |
||
6330 | |||
6331 | CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6332 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6333 | return Create(Ctx, I); |
||
6334 | } |
||
6335 | |||
6336 | CUDADeviceBuiltinTextureTypeAttr::CUDADeviceBuiltinTextureTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6337 | ) |
||
6338 | : InheritableAttr(Ctx, CommonInfo, attr::CUDADeviceBuiltinTextureType, false, false) |
||
6339 | { |
||
6340 | } |
||
6341 | |||
6342 | CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::clone(ASTContext &C) const { |
||
6343 | auto *A = new (C) CUDADeviceBuiltinTextureTypeAttr(C, *this); |
||
6344 | A->Inherited = Inherited; |
||
6345 | A->IsPackExpansion = IsPackExpansion; |
||
6346 | A->setImplicit(Implicit); |
||
6347 | return A; |
||
6348 | } |
||
6349 | |||
6350 | void CUDADeviceBuiltinTextureTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6351 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6352 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6353 | switch (getAttributeSpellingListIndex()) { |
||
6354 | default: |
||
6355 | llvm_unreachable("Unknown attribute spelling!"); |
||
6356 | break; |
||
6357 | case 0 : { |
||
6358 | OS << " __attribute__((device_builtin_texture_type"; |
||
6359 | OS << "))"; |
||
6360 | break; |
||
6361 | } |
||
6362 | case 1 : { |
||
6363 | OS << " __declspec(__device_builtin_texture_type__"; |
||
6364 | OS << ")"; |
||
6365 | break; |
||
6366 | } |
||
6367 | } |
||
6368 | } |
||
6369 | |||
6370 | const char *CUDADeviceBuiltinTextureTypeAttr::getSpelling() const { |
||
6371 | switch (getAttributeSpellingListIndex()) { |
||
6372 | default: |
||
6373 | llvm_unreachable("Unknown attribute spelling!"); |
||
6374 | return "(No spelling)"; |
||
6375 | case 0: |
||
6376 | return "device_builtin_texture_type"; |
||
6377 | case 1: |
||
6378 | return "__device_builtin_texture_type__"; |
||
6379 | } |
||
6380 | } |
||
6381 | |||
6382 | |||
6383 | // CUDAGlobalAttr implementation |
||
6384 | |||
6385 | CUDAGlobalAttr *CUDAGlobalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6386 | auto *A = new (Ctx) CUDAGlobalAttr(Ctx, CommonInfo); |
||
6387 | A->setImplicit(true); |
||
6388 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6389 | A->setAttributeSpellingListIndex(0); |
||
6390 | return A; |
||
6391 | } |
||
6392 | |||
6393 | CUDAGlobalAttr *CUDAGlobalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6394 | auto *A = new (Ctx) CUDAGlobalAttr(Ctx, CommonInfo); |
||
6395 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6396 | A->setAttributeSpellingListIndex(0); |
||
6397 | return A; |
||
6398 | } |
||
6399 | |||
6400 | CUDAGlobalAttr *CUDAGlobalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6401 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6402 | return CreateImplicit(Ctx, I); |
||
6403 | } |
||
6404 | |||
6405 | CUDAGlobalAttr *CUDAGlobalAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6406 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6407 | return Create(Ctx, I); |
||
6408 | } |
||
6409 | |||
6410 | CUDAGlobalAttr::CUDAGlobalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6411 | ) |
||
6412 | : InheritableAttr(Ctx, CommonInfo, attr::CUDAGlobal, false, false) |
||
6413 | { |
||
6414 | } |
||
6415 | |||
6416 | CUDAGlobalAttr *CUDAGlobalAttr::clone(ASTContext &C) const { |
||
6417 | auto *A = new (C) CUDAGlobalAttr(C, *this); |
||
6418 | A->Inherited = Inherited; |
||
6419 | A->IsPackExpansion = IsPackExpansion; |
||
6420 | A->setImplicit(Implicit); |
||
6421 | return A; |
||
6422 | } |
||
6423 | |||
6424 | void CUDAGlobalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6425 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6426 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6427 | switch (getAttributeSpellingListIndex()) { |
||
6428 | default: |
||
6429 | llvm_unreachable("Unknown attribute spelling!"); |
||
6430 | break; |
||
6431 | case 0 : { |
||
6432 | OS << " __attribute__((global"; |
||
6433 | OS << "))"; |
||
6434 | break; |
||
6435 | } |
||
6436 | case 1 : { |
||
6437 | OS << " __declspec(__global__"; |
||
6438 | OS << ")"; |
||
6439 | break; |
||
6440 | } |
||
6441 | } |
||
6442 | } |
||
6443 | |||
6444 | const char *CUDAGlobalAttr::getSpelling() const { |
||
6445 | switch (getAttributeSpellingListIndex()) { |
||
6446 | default: |
||
6447 | llvm_unreachable("Unknown attribute spelling!"); |
||
6448 | return "(No spelling)"; |
||
6449 | case 0: |
||
6450 | return "global"; |
||
6451 | case 1: |
||
6452 | return "__global__"; |
||
6453 | } |
||
6454 | } |
||
6455 | |||
6456 | |||
6457 | // CUDAHostAttr implementation |
||
6458 | |||
6459 | CUDAHostAttr *CUDAHostAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6460 | auto *A = new (Ctx) CUDAHostAttr(Ctx, CommonInfo); |
||
6461 | A->setImplicit(true); |
||
6462 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6463 | A->setAttributeSpellingListIndex(0); |
||
6464 | return A; |
||
6465 | } |
||
6466 | |||
6467 | CUDAHostAttr *CUDAHostAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6468 | auto *A = new (Ctx) CUDAHostAttr(Ctx, CommonInfo); |
||
6469 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6470 | A->setAttributeSpellingListIndex(0); |
||
6471 | return A; |
||
6472 | } |
||
6473 | |||
6474 | CUDAHostAttr *CUDAHostAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6475 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6476 | return CreateImplicit(Ctx, I); |
||
6477 | } |
||
6478 | |||
6479 | CUDAHostAttr *CUDAHostAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6480 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6481 | return Create(Ctx, I); |
||
6482 | } |
||
6483 | |||
6484 | CUDAHostAttr::CUDAHostAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6485 | ) |
||
6486 | : InheritableAttr(Ctx, CommonInfo, attr::CUDAHost, false, false) |
||
6487 | { |
||
6488 | } |
||
6489 | |||
6490 | CUDAHostAttr *CUDAHostAttr::clone(ASTContext &C) const { |
||
6491 | auto *A = new (C) CUDAHostAttr(C, *this); |
||
6492 | A->Inherited = Inherited; |
||
6493 | A->IsPackExpansion = IsPackExpansion; |
||
6494 | A->setImplicit(Implicit); |
||
6495 | return A; |
||
6496 | } |
||
6497 | |||
6498 | void CUDAHostAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6499 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6500 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6501 | switch (getAttributeSpellingListIndex()) { |
||
6502 | default: |
||
6503 | llvm_unreachable("Unknown attribute spelling!"); |
||
6504 | break; |
||
6505 | case 0 : { |
||
6506 | OS << " __attribute__((host"; |
||
6507 | OS << "))"; |
||
6508 | break; |
||
6509 | } |
||
6510 | case 1 : { |
||
6511 | OS << " __declspec(__host__"; |
||
6512 | OS << ")"; |
||
6513 | break; |
||
6514 | } |
||
6515 | } |
||
6516 | } |
||
6517 | |||
6518 | const char *CUDAHostAttr::getSpelling() const { |
||
6519 | switch (getAttributeSpellingListIndex()) { |
||
6520 | default: |
||
6521 | llvm_unreachable("Unknown attribute spelling!"); |
||
6522 | return "(No spelling)"; |
||
6523 | case 0: |
||
6524 | return "host"; |
||
6525 | case 1: |
||
6526 | return "__host__"; |
||
6527 | } |
||
6528 | } |
||
6529 | |||
6530 | |||
6531 | // CUDAInvalidTargetAttr implementation |
||
6532 | |||
6533 | CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6534 | auto *A = new (Ctx) CUDAInvalidTargetAttr(Ctx, CommonInfo); |
||
6535 | A->setImplicit(true); |
||
6536 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6537 | A->setAttributeSpellingListIndex(0); |
||
6538 | return A; |
||
6539 | } |
||
6540 | |||
6541 | CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6542 | auto *A = new (Ctx) CUDAInvalidTargetAttr(Ctx, CommonInfo); |
||
6543 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6544 | A->setAttributeSpellingListIndex(0); |
||
6545 | return A; |
||
6546 | } |
||
6547 | |||
6548 | CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6549 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6550 | return CreateImplicit(Ctx, I); |
||
6551 | } |
||
6552 | |||
6553 | CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6554 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6555 | return Create(Ctx, I); |
||
6556 | } |
||
6557 | |||
6558 | CUDAInvalidTargetAttr::CUDAInvalidTargetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6559 | ) |
||
6560 | : InheritableAttr(Ctx, CommonInfo, attr::CUDAInvalidTarget, false, false) |
||
6561 | { |
||
6562 | } |
||
6563 | |||
6564 | CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::clone(ASTContext &C) const { |
||
6565 | auto *A = new (C) CUDAInvalidTargetAttr(C, *this); |
||
6566 | A->Inherited = Inherited; |
||
6567 | A->IsPackExpansion = IsPackExpansion; |
||
6568 | A->setImplicit(Implicit); |
||
6569 | return A; |
||
6570 | } |
||
6571 | |||
6572 | void CUDAInvalidTargetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6573 | } |
||
6574 | |||
6575 | const char *CUDAInvalidTargetAttr::getSpelling() const { |
||
6576 | return "(No spelling)"; |
||
6577 | } |
||
6578 | |||
6579 | |||
6580 | // CUDALaunchBoundsAttr implementation |
||
6581 | |||
6582 | CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, const AttributeCommonInfo &CommonInfo) { |
||
6583 | auto *A = new (Ctx) CUDALaunchBoundsAttr(Ctx, CommonInfo, MaxThreads, MinBlocks); |
||
6584 | A->setImplicit(true); |
||
6585 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6586 | A->setAttributeSpellingListIndex(0); |
||
6587 | return A; |
||
6588 | } |
||
6589 | |||
6590 | CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::Create(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, const AttributeCommonInfo &CommonInfo) { |
||
6591 | auto *A = new (Ctx) CUDALaunchBoundsAttr(Ctx, CommonInfo, MaxThreads, MinBlocks); |
||
6592 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6593 | A->setAttributeSpellingListIndex(0); |
||
6594 | return A; |
||
6595 | } |
||
6596 | |||
6597 | CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6598 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6599 | return CreateImplicit(Ctx, MaxThreads, MinBlocks, I); |
||
6600 | } |
||
6601 | |||
6602 | CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::Create(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6603 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6604 | return Create(Ctx, MaxThreads, MinBlocks, I); |
||
6605 | } |
||
6606 | |||
6607 | CUDALaunchBoundsAttr::CUDALaunchBoundsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6608 | , Expr * MaxThreads |
||
6609 | , Expr * MinBlocks |
||
6610 | ) |
||
6611 | : InheritableAttr(Ctx, CommonInfo, attr::CUDALaunchBounds, false, false) |
||
6612 | , maxThreads(MaxThreads) |
||
6613 | , minBlocks(MinBlocks) |
||
6614 | { |
||
6615 | } |
||
6616 | |||
6617 | CUDALaunchBoundsAttr::CUDALaunchBoundsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6618 | , Expr * MaxThreads |
||
6619 | ) |
||
6620 | : InheritableAttr(Ctx, CommonInfo, attr::CUDALaunchBounds, false, false) |
||
6621 | , maxThreads(MaxThreads) |
||
6622 | , minBlocks() |
||
6623 | { |
||
6624 | } |
||
6625 | |||
6626 | |||
6627 | |||
6628 | |||
6629 | |||
6630 | CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::clone(ASTContext &C) const { |
||
6631 | auto *A = new (C) CUDALaunchBoundsAttr(C, *this, maxThreads, minBlocks); |
||
6632 | A->Inherited = Inherited; |
||
6633 | A->IsPackExpansion = IsPackExpansion; |
||
6634 | A->setImplicit(Implicit); |
||
6635 | return A; |
||
6636 | } |
||
6637 | |||
6638 | void CUDALaunchBoundsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6639 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6640 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6641 | switch (getAttributeSpellingListIndex()) { |
||
6642 | default: |
||
6643 | llvm_unreachable("Unknown attribute spelling!"); |
||
6644 | break; |
||
6645 | case 0 : { |
||
6646 | OS << " __attribute__((launch_bounds"; |
||
6647 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6648 | OS << ""; |
||
6649 | getMaxThreads()->printPretty(OS, nullptr, Policy); |
||
6650 | OS << ""; |
||
6651 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6652 | OS << ""; |
||
6653 | getMinBlocks()->printPretty(OS, nullptr, Policy); |
||
6654 | OS << ""; |
||
6655 | if (!IsFirstArgument) |
||
6656 | OS << ")"; |
||
6657 | OS << "))"; |
||
6658 | break; |
||
6659 | } |
||
6660 | case 1 : { |
||
6661 | OS << " __declspec(__launch_bounds__"; |
||
6662 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6663 | OS << ""; |
||
6664 | getMaxThreads()->printPretty(OS, nullptr, Policy); |
||
6665 | OS << ""; |
||
6666 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6667 | OS << ""; |
||
6668 | getMinBlocks()->printPretty(OS, nullptr, Policy); |
||
6669 | OS << ""; |
||
6670 | if (!IsFirstArgument) |
||
6671 | OS << ")"; |
||
6672 | OS << ")"; |
||
6673 | break; |
||
6674 | } |
||
6675 | } |
||
6676 | } |
||
6677 | |||
6678 | const char *CUDALaunchBoundsAttr::getSpelling() const { |
||
6679 | switch (getAttributeSpellingListIndex()) { |
||
6680 | default: |
||
6681 | llvm_unreachable("Unknown attribute spelling!"); |
||
6682 | return "(No spelling)"; |
||
6683 | case 0: |
||
6684 | return "launch_bounds"; |
||
6685 | case 1: |
||
6686 | return "__launch_bounds__"; |
||
6687 | } |
||
6688 | } |
||
6689 | |||
6690 | |||
6691 | // CUDASharedAttr implementation |
||
6692 | |||
6693 | CUDASharedAttr *CUDASharedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6694 | auto *A = new (Ctx) CUDASharedAttr(Ctx, CommonInfo); |
||
6695 | A->setImplicit(true); |
||
6696 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6697 | A->setAttributeSpellingListIndex(0); |
||
6698 | return A; |
||
6699 | } |
||
6700 | |||
6701 | CUDASharedAttr *CUDASharedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6702 | auto *A = new (Ctx) CUDASharedAttr(Ctx, CommonInfo); |
||
6703 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6704 | A->setAttributeSpellingListIndex(0); |
||
6705 | return A; |
||
6706 | } |
||
6707 | |||
6708 | CUDASharedAttr *CUDASharedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6709 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6710 | return CreateImplicit(Ctx, I); |
||
6711 | } |
||
6712 | |||
6713 | CUDASharedAttr *CUDASharedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6714 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6715 | return Create(Ctx, I); |
||
6716 | } |
||
6717 | |||
6718 | CUDASharedAttr::CUDASharedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6719 | ) |
||
6720 | : InheritableAttr(Ctx, CommonInfo, attr::CUDAShared, false, false) |
||
6721 | { |
||
6722 | } |
||
6723 | |||
6724 | CUDASharedAttr *CUDASharedAttr::clone(ASTContext &C) const { |
||
6725 | auto *A = new (C) CUDASharedAttr(C, *this); |
||
6726 | A->Inherited = Inherited; |
||
6727 | A->IsPackExpansion = IsPackExpansion; |
||
6728 | A->setImplicit(Implicit); |
||
6729 | return A; |
||
6730 | } |
||
6731 | |||
6732 | void CUDASharedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6733 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6734 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6735 | switch (getAttributeSpellingListIndex()) { |
||
6736 | default: |
||
6737 | llvm_unreachable("Unknown attribute spelling!"); |
||
6738 | break; |
||
6739 | case 0 : { |
||
6740 | OS << " __attribute__((shared"; |
||
6741 | OS << "))"; |
||
6742 | break; |
||
6743 | } |
||
6744 | case 1 : { |
||
6745 | OS << " __declspec(__shared__"; |
||
6746 | OS << ")"; |
||
6747 | break; |
||
6748 | } |
||
6749 | } |
||
6750 | } |
||
6751 | |||
6752 | const char *CUDASharedAttr::getSpelling() const { |
||
6753 | switch (getAttributeSpellingListIndex()) { |
||
6754 | default: |
||
6755 | llvm_unreachable("Unknown attribute spelling!"); |
||
6756 | return "(No spelling)"; |
||
6757 | case 0: |
||
6758 | return "shared"; |
||
6759 | case 1: |
||
6760 | return "__shared__"; |
||
6761 | } |
||
6762 | } |
||
6763 | |||
6764 | |||
6765 | // CXX11NoReturnAttr implementation |
||
6766 | |||
6767 | CXX11NoReturnAttr *CXX11NoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6768 | auto *A = new (Ctx) CXX11NoReturnAttr(Ctx, CommonInfo); |
||
6769 | A->setImplicit(true); |
||
6770 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6771 | A->setAttributeSpellingListIndex(0); |
||
6772 | return A; |
||
6773 | } |
||
6774 | |||
6775 | CXX11NoReturnAttr *CXX11NoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
6776 | auto *A = new (Ctx) CXX11NoReturnAttr(Ctx, CommonInfo); |
||
6777 | return A; |
||
6778 | } |
||
6779 | |||
6780 | CXX11NoReturnAttr *CXX11NoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, CXX11NoReturnAttr::Spelling S) { |
||
6781 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
6782 | return CreateImplicit(Ctx, I); |
||
6783 | } |
||
6784 | |||
6785 | CXX11NoReturnAttr *CXX11NoReturnAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, CXX11NoReturnAttr::Spelling S) { |
||
6786 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
6787 | return Create(Ctx, I); |
||
6788 | } |
||
6789 | |||
6790 | CXX11NoReturnAttr::CXX11NoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6791 | ) |
||
6792 | : InheritableAttr(Ctx, CommonInfo, attr::CXX11NoReturn, false, false) |
||
6793 | { |
||
6794 | } |
||
6795 | |||
6796 | CXX11NoReturnAttr::Spelling CXX11NoReturnAttr::getSemanticSpelling() const { |
||
6797 | switch (getAttributeSpellingListIndex()) { |
||
6798 | default: llvm_unreachable("Unknown spelling list index"); |
||
6799 | case 0: return CXX11_noreturn; |
||
6800 | case 1: return C2x_noreturn; |
||
6801 | case 2: return C2x_Noreturn; |
||
6802 | } |
||
6803 | } |
||
6804 | CXX11NoReturnAttr *CXX11NoReturnAttr::clone(ASTContext &C) const { |
||
6805 | auto *A = new (C) CXX11NoReturnAttr(C, *this); |
||
6806 | A->Inherited = Inherited; |
||
6807 | A->IsPackExpansion = IsPackExpansion; |
||
6808 | A->setImplicit(Implicit); |
||
6809 | return A; |
||
6810 | } |
||
6811 | |||
6812 | void CXX11NoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6813 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6814 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6815 | switch (getAttributeSpellingListIndex()) { |
||
6816 | default: |
||
6817 | llvm_unreachable("Unknown attribute spelling!"); |
||
6818 | break; |
||
6819 | case 0 : { |
||
6820 | OS << " [[noreturn"; |
||
6821 | OS << "]]"; |
||
6822 | break; |
||
6823 | } |
||
6824 | case 1 : { |
||
6825 | OS << " [[noreturn"; |
||
6826 | OS << "]]"; |
||
6827 | break; |
||
6828 | } |
||
6829 | case 2 : { |
||
6830 | OS << " [[_Noreturn"; |
||
6831 | OS << "]]"; |
||
6832 | break; |
||
6833 | } |
||
6834 | } |
||
6835 | } |
||
6836 | |||
6837 | const char *CXX11NoReturnAttr::getSpelling() const { |
||
6838 | switch (getAttributeSpellingListIndex()) { |
||
6839 | default: |
||
6840 | llvm_unreachable("Unknown attribute spelling!"); |
||
6841 | return "(No spelling)"; |
||
6842 | case 0: |
||
6843 | return "noreturn"; |
||
6844 | case 1: |
||
6845 | return "noreturn"; |
||
6846 | case 2: |
||
6847 | return "_Noreturn"; |
||
6848 | } |
||
6849 | } |
||
6850 | |||
6851 | |||
6852 | // CallableWhenAttr implementation |
||
6853 | |||
6854 | CallableWhenAttr *CallableWhenAttr::CreateImplicit(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, const AttributeCommonInfo &CommonInfo) { |
||
6855 | auto *A = new (Ctx) CallableWhenAttr(Ctx, CommonInfo, CallableStates, CallableStatesSize); |
||
6856 | A->setImplicit(true); |
||
6857 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6858 | A->setAttributeSpellingListIndex(0); |
||
6859 | return A; |
||
6860 | } |
||
6861 | |||
6862 | CallableWhenAttr *CallableWhenAttr::Create(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, const AttributeCommonInfo &CommonInfo) { |
||
6863 | auto *A = new (Ctx) CallableWhenAttr(Ctx, CommonInfo, CallableStates, CallableStatesSize); |
||
6864 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6865 | A->setAttributeSpellingListIndex(0); |
||
6866 | return A; |
||
6867 | } |
||
6868 | |||
6869 | CallableWhenAttr *CallableWhenAttr::CreateImplicit(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6870 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6871 | return CreateImplicit(Ctx, CallableStates, CallableStatesSize, I); |
||
6872 | } |
||
6873 | |||
6874 | CallableWhenAttr *CallableWhenAttr::Create(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6875 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6876 | return Create(Ctx, CallableStates, CallableStatesSize, I); |
||
6877 | } |
||
6878 | |||
6879 | CallableWhenAttr::CallableWhenAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6880 | , ConsumedState *CallableStates, unsigned CallableStatesSize |
||
6881 | ) |
||
6882 | : InheritableAttr(Ctx, CommonInfo, attr::CallableWhen, false, false) |
||
6883 | , callableStates_Size(CallableStatesSize), callableStates_(new (Ctx, 16) ConsumedState[callableStates_Size]) |
||
6884 | { |
||
6885 | std::copy(CallableStates, CallableStates + callableStates_Size, callableStates_); |
||
6886 | } |
||
6887 | |||
6888 | CallableWhenAttr::CallableWhenAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
6889 | ) |
||
6890 | : InheritableAttr(Ctx, CommonInfo, attr::CallableWhen, false, false) |
||
6891 | , callableStates_Size(0), callableStates_(nullptr) |
||
6892 | { |
||
6893 | } |
||
6894 | |||
6895 | |||
6896 | |||
6897 | bool CallableWhenAttr::ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) { |
||
6898 | std::optional<ConsumedState> R = llvm::StringSwitch<std::optional<ConsumedState>>(Val) |
||
6899 | .Case("unknown", CallableWhenAttr::Unknown) |
||
6900 | .Case("consumed", CallableWhenAttr::Consumed) |
||
6901 | .Case("unconsumed", CallableWhenAttr::Unconsumed) |
||
6902 | .Default(std::optional<ConsumedState>()); |
||
6903 | if (R) { |
||
6904 | Out = *R; |
||
6905 | return true; |
||
6906 | } |
||
6907 | return false; |
||
6908 | } |
||
6909 | |||
6910 | const char *CallableWhenAttr::ConvertConsumedStateToStr(ConsumedState Val) { |
||
6911 | switch(Val) { |
||
6912 | case CallableWhenAttr::Unknown: return "unknown"; |
||
6913 | case CallableWhenAttr::Consumed: return "consumed"; |
||
6914 | case CallableWhenAttr::Unconsumed: return "unconsumed"; |
||
6915 | } |
||
6916 | llvm_unreachable("No enumerator with that value"); |
||
6917 | } |
||
6918 | CallableWhenAttr *CallableWhenAttr::clone(ASTContext &C) const { |
||
6919 | auto *A = new (C) CallableWhenAttr(C, *this, callableStates_, callableStates_Size); |
||
6920 | A->Inherited = Inherited; |
||
6921 | A->IsPackExpansion = IsPackExpansion; |
||
6922 | A->setImplicit(Implicit); |
||
6923 | return A; |
||
6924 | } |
||
6925 | |||
6926 | void CallableWhenAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
6927 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
6928 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
6929 | switch (getAttributeSpellingListIndex()) { |
||
6930 | default: |
||
6931 | llvm_unreachable("Unknown attribute spelling!"); |
||
6932 | break; |
||
6933 | case 0 : { |
||
6934 | OS << " __attribute__((callable_when"; |
||
6935 | OS << ""; |
||
6936 | for (const auto &Val : callableStates()) { |
||
6937 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6938 | OS << "\"" << CallableWhenAttr::ConvertConsumedStateToStr(Val)<< "\""; |
||
6939 | } |
||
6940 | OS << ""; |
||
6941 | if (!IsFirstArgument) |
||
6942 | OS << ")"; |
||
6943 | OS << "))"; |
||
6944 | break; |
||
6945 | } |
||
6946 | case 1 : { |
||
6947 | OS << " [[clang::callable_when"; |
||
6948 | OS << ""; |
||
6949 | for (const auto &Val : callableStates()) { |
||
6950 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
6951 | OS << "\"" << CallableWhenAttr::ConvertConsumedStateToStr(Val)<< "\""; |
||
6952 | } |
||
6953 | OS << ""; |
||
6954 | if (!IsFirstArgument) |
||
6955 | OS << ")"; |
||
6956 | OS << "]]"; |
||
6957 | break; |
||
6958 | } |
||
6959 | } |
||
6960 | } |
||
6961 | |||
6962 | const char *CallableWhenAttr::getSpelling() const { |
||
6963 | switch (getAttributeSpellingListIndex()) { |
||
6964 | default: |
||
6965 | llvm_unreachable("Unknown attribute spelling!"); |
||
6966 | return "(No spelling)"; |
||
6967 | case 0: |
||
6968 | return "callable_when"; |
||
6969 | case 1: |
||
6970 | return "callable_when"; |
||
6971 | } |
||
6972 | } |
||
6973 | |||
6974 | |||
6975 | // CallbackAttr implementation |
||
6976 | |||
6977 | CallbackAttr *CallbackAttr::CreateImplicit(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, const AttributeCommonInfo &CommonInfo) { |
||
6978 | auto *A = new (Ctx) CallbackAttr(Ctx, CommonInfo, Encoding, EncodingSize); |
||
6979 | A->setImplicit(true); |
||
6980 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6981 | A->setAttributeSpellingListIndex(0); |
||
6982 | return A; |
||
6983 | } |
||
6984 | |||
6985 | CallbackAttr *CallbackAttr::Create(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, const AttributeCommonInfo &CommonInfo) { |
||
6986 | auto *A = new (Ctx) CallbackAttr(Ctx, CommonInfo, Encoding, EncodingSize); |
||
6987 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
6988 | A->setAttributeSpellingListIndex(0); |
||
6989 | return A; |
||
6990 | } |
||
6991 | |||
6992 | CallbackAttr *CallbackAttr::CreateImplicit(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6993 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6994 | return CreateImplicit(Ctx, Encoding, EncodingSize, I); |
||
6995 | } |
||
6996 | |||
6997 | CallbackAttr *CallbackAttr::Create(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
6998 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
6999 | return Create(Ctx, Encoding, EncodingSize, I); |
||
7000 | } |
||
7001 | |||
7002 | CallbackAttr::CallbackAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7003 | , int *Encoding, unsigned EncodingSize |
||
7004 | ) |
||
7005 | : InheritableAttr(Ctx, CommonInfo, attr::Callback, false, false) |
||
7006 | , encoding_Size(EncodingSize), encoding_(new (Ctx, 16) int[encoding_Size]) |
||
7007 | { |
||
7008 | std::copy(Encoding, Encoding + encoding_Size, encoding_); |
||
7009 | } |
||
7010 | |||
7011 | CallbackAttr::CallbackAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7012 | ) |
||
7013 | : InheritableAttr(Ctx, CommonInfo, attr::Callback, false, false) |
||
7014 | , encoding_Size(0), encoding_(nullptr) |
||
7015 | { |
||
7016 | } |
||
7017 | |||
7018 | |||
7019 | |||
7020 | CallbackAttr *CallbackAttr::clone(ASTContext &C) const { |
||
7021 | auto *A = new (C) CallbackAttr(C, *this, encoding_, encoding_Size); |
||
7022 | A->Inherited = Inherited; |
||
7023 | A->IsPackExpansion = IsPackExpansion; |
||
7024 | A->setImplicit(Implicit); |
||
7025 | return A; |
||
7026 | } |
||
7027 | |||
7028 | void CallbackAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7029 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7030 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7031 | switch (getAttributeSpellingListIndex()) { |
||
7032 | default: |
||
7033 | llvm_unreachable("Unknown attribute spelling!"); |
||
7034 | break; |
||
7035 | case 0 : { |
||
7036 | OS << " __attribute__((callback"; |
||
7037 | OS << ""; |
||
7038 | for (const auto &Val : encoding()) { |
||
7039 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7040 | OS << Val; |
||
7041 | } |
||
7042 | OS << ""; |
||
7043 | if (!IsFirstArgument) |
||
7044 | OS << ")"; |
||
7045 | OS << "))"; |
||
7046 | break; |
||
7047 | } |
||
7048 | case 1 : { |
||
7049 | OS << " [[clang::callback"; |
||
7050 | OS << ""; |
||
7051 | for (const auto &Val : encoding()) { |
||
7052 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7053 | OS << Val; |
||
7054 | } |
||
7055 | OS << ""; |
||
7056 | if (!IsFirstArgument) |
||
7057 | OS << ")"; |
||
7058 | OS << "]]"; |
||
7059 | break; |
||
7060 | } |
||
7061 | case 2 : { |
||
7062 | OS << " [[clang::callback"; |
||
7063 | OS << ""; |
||
7064 | for (const auto &Val : encoding()) { |
||
7065 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7066 | OS << Val; |
||
7067 | } |
||
7068 | OS << ""; |
||
7069 | if (!IsFirstArgument) |
||
7070 | OS << ")"; |
||
7071 | OS << "]]"; |
||
7072 | break; |
||
7073 | } |
||
7074 | } |
||
7075 | } |
||
7076 | |||
7077 | const char *CallbackAttr::getSpelling() const { |
||
7078 | switch (getAttributeSpellingListIndex()) { |
||
7079 | default: |
||
7080 | llvm_unreachable("Unknown attribute spelling!"); |
||
7081 | return "(No spelling)"; |
||
7082 | case 0: |
||
7083 | return "callback"; |
||
7084 | case 1: |
||
7085 | return "callback"; |
||
7086 | case 2: |
||
7087 | return "callback"; |
||
7088 | } |
||
7089 | } |
||
7090 | |||
7091 | |||
7092 | // CalledOnceAttr implementation |
||
7093 | |||
7094 | CalledOnceAttr *CalledOnceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7095 | auto *A = new (Ctx) CalledOnceAttr(Ctx, CommonInfo); |
||
7096 | A->setImplicit(true); |
||
7097 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7098 | A->setAttributeSpellingListIndex(0); |
||
7099 | return A; |
||
7100 | } |
||
7101 | |||
7102 | CalledOnceAttr *CalledOnceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7103 | auto *A = new (Ctx) CalledOnceAttr(Ctx, CommonInfo); |
||
7104 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7105 | A->setAttributeSpellingListIndex(0); |
||
7106 | return A; |
||
7107 | } |
||
7108 | |||
7109 | CalledOnceAttr *CalledOnceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7110 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7111 | return CreateImplicit(Ctx, I); |
||
7112 | } |
||
7113 | |||
7114 | CalledOnceAttr *CalledOnceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7115 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7116 | return Create(Ctx, I); |
||
7117 | } |
||
7118 | |||
7119 | CalledOnceAttr::CalledOnceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7120 | ) |
||
7121 | : Attr(Ctx, CommonInfo, attr::CalledOnce, false) |
||
7122 | { |
||
7123 | } |
||
7124 | |||
7125 | CalledOnceAttr *CalledOnceAttr::clone(ASTContext &C) const { |
||
7126 | auto *A = new (C) CalledOnceAttr(C, *this); |
||
7127 | A->Inherited = Inherited; |
||
7128 | A->IsPackExpansion = IsPackExpansion; |
||
7129 | A->setImplicit(Implicit); |
||
7130 | return A; |
||
7131 | } |
||
7132 | |||
7133 | void CalledOnceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7134 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7135 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7136 | switch (getAttributeSpellingListIndex()) { |
||
7137 | default: |
||
7138 | llvm_unreachable("Unknown attribute spelling!"); |
||
7139 | break; |
||
7140 | case 0 : { |
||
7141 | OS << " __attribute__((called_once"; |
||
7142 | OS << "))"; |
||
7143 | break; |
||
7144 | } |
||
7145 | case 1 : { |
||
7146 | OS << " [[clang::called_once"; |
||
7147 | OS << "]]"; |
||
7148 | break; |
||
7149 | } |
||
7150 | case 2 : { |
||
7151 | OS << " [[clang::called_once"; |
||
7152 | OS << "]]"; |
||
7153 | break; |
||
7154 | } |
||
7155 | } |
||
7156 | } |
||
7157 | |||
7158 | const char *CalledOnceAttr::getSpelling() const { |
||
7159 | switch (getAttributeSpellingListIndex()) { |
||
7160 | default: |
||
7161 | llvm_unreachable("Unknown attribute spelling!"); |
||
7162 | return "(No spelling)"; |
||
7163 | case 0: |
||
7164 | return "called_once"; |
||
7165 | case 1: |
||
7166 | return "called_once"; |
||
7167 | case 2: |
||
7168 | return "called_once"; |
||
7169 | } |
||
7170 | } |
||
7171 | |||
7172 | |||
7173 | // CapabilityAttr implementation |
||
7174 | |||
7175 | CapabilityAttr *CapabilityAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
7176 | auto *A = new (Ctx) CapabilityAttr(Ctx, CommonInfo, Name); |
||
7177 | A->setImplicit(true); |
||
7178 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7179 | A->setAttributeSpellingListIndex(0); |
||
7180 | return A; |
||
7181 | } |
||
7182 | |||
7183 | CapabilityAttr *CapabilityAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
7184 | auto *A = new (Ctx) CapabilityAttr(Ctx, CommonInfo, Name); |
||
7185 | return A; |
||
7186 | } |
||
7187 | |||
7188 | CapabilityAttr *CapabilityAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax, CapabilityAttr::Spelling S) { |
||
7189 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
7190 | return CreateImplicit(Ctx, Name, I); |
||
7191 | } |
||
7192 | |||
7193 | CapabilityAttr *CapabilityAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax, CapabilityAttr::Spelling S) { |
||
7194 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
7195 | return Create(Ctx, Name, I); |
||
7196 | } |
||
7197 | |||
7198 | CapabilityAttr::CapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7199 | , llvm::StringRef Name |
||
7200 | ) |
||
7201 | : InheritableAttr(Ctx, CommonInfo, attr::Capability, false, false) |
||
7202 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
7203 | { |
||
7204 | if (!Name.empty()) |
||
7205 | std::memcpy(name, Name.data(), nameLength); |
||
7206 | } |
||
7207 | |||
7208 | CapabilityAttr::Spelling CapabilityAttr::getSemanticSpelling() const { |
||
7209 | switch (getAttributeSpellingListIndex()) { |
||
7210 | default: llvm_unreachable("Unknown spelling list index"); |
||
7211 | case 0: return GNU_capability; |
||
7212 | case 1: return CXX11_clang_capability; |
||
7213 | case 2: return GNU_shared_capability; |
||
7214 | case 3: return CXX11_clang_shared_capability; |
||
7215 | } |
||
7216 | } |
||
7217 | |||
7218 | |||
7219 | CapabilityAttr *CapabilityAttr::clone(ASTContext &C) const { |
||
7220 | auto *A = new (C) CapabilityAttr(C, *this, getName()); |
||
7221 | A->Inherited = Inherited; |
||
7222 | A->IsPackExpansion = IsPackExpansion; |
||
7223 | A->setImplicit(Implicit); |
||
7224 | return A; |
||
7225 | } |
||
7226 | |||
7227 | void CapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7228 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7229 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7230 | switch (getAttributeSpellingListIndex()) { |
||
7231 | default: |
||
7232 | llvm_unreachable("Unknown attribute spelling!"); |
||
7233 | break; |
||
7234 | case 0 : { |
||
7235 | OS << " __attribute__((capability"; |
||
7236 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7237 | OS << "\"" << getName() << "\""; |
||
7238 | if (!IsFirstArgument) |
||
7239 | OS << ")"; |
||
7240 | OS << "))"; |
||
7241 | break; |
||
7242 | } |
||
7243 | case 1 : { |
||
7244 | OS << " [[clang::capability"; |
||
7245 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7246 | OS << "\"" << getName() << "\""; |
||
7247 | if (!IsFirstArgument) |
||
7248 | OS << ")"; |
||
7249 | OS << "]]"; |
||
7250 | break; |
||
7251 | } |
||
7252 | case 2 : { |
||
7253 | OS << " __attribute__((shared_capability"; |
||
7254 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7255 | OS << "\"" << getName() << "\""; |
||
7256 | if (!IsFirstArgument) |
||
7257 | OS << ")"; |
||
7258 | OS << "))"; |
||
7259 | break; |
||
7260 | } |
||
7261 | case 3 : { |
||
7262 | OS << " [[clang::shared_capability"; |
||
7263 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7264 | OS << "\"" << getName() << "\""; |
||
7265 | if (!IsFirstArgument) |
||
7266 | OS << ")"; |
||
7267 | OS << "]]"; |
||
7268 | break; |
||
7269 | } |
||
7270 | } |
||
7271 | } |
||
7272 | |||
7273 | const char *CapabilityAttr::getSpelling() const { |
||
7274 | switch (getAttributeSpellingListIndex()) { |
||
7275 | default: |
||
7276 | llvm_unreachable("Unknown attribute spelling!"); |
||
7277 | return "(No spelling)"; |
||
7278 | case 0: |
||
7279 | return "capability"; |
||
7280 | case 1: |
||
7281 | return "capability"; |
||
7282 | case 2: |
||
7283 | return "shared_capability"; |
||
7284 | case 3: |
||
7285 | return "shared_capability"; |
||
7286 | } |
||
7287 | } |
||
7288 | |||
7289 | |||
7290 | // CapturedRecordAttr implementation |
||
7291 | |||
7292 | CapturedRecordAttr *CapturedRecordAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7293 | auto *A = new (Ctx) CapturedRecordAttr(Ctx, CommonInfo); |
||
7294 | A->setImplicit(true); |
||
7295 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7296 | A->setAttributeSpellingListIndex(0); |
||
7297 | return A; |
||
7298 | } |
||
7299 | |||
7300 | CapturedRecordAttr *CapturedRecordAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7301 | auto *A = new (Ctx) CapturedRecordAttr(Ctx, CommonInfo); |
||
7302 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7303 | A->setAttributeSpellingListIndex(0); |
||
7304 | return A; |
||
7305 | } |
||
7306 | |||
7307 | CapturedRecordAttr *CapturedRecordAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7308 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7309 | return CreateImplicit(Ctx, I); |
||
7310 | } |
||
7311 | |||
7312 | CapturedRecordAttr *CapturedRecordAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7313 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7314 | return Create(Ctx, I); |
||
7315 | } |
||
7316 | |||
7317 | CapturedRecordAttr::CapturedRecordAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7318 | ) |
||
7319 | : InheritableAttr(Ctx, CommonInfo, attr::CapturedRecord, false, false) |
||
7320 | { |
||
7321 | } |
||
7322 | |||
7323 | CapturedRecordAttr *CapturedRecordAttr::clone(ASTContext &C) const { |
||
7324 | auto *A = new (C) CapturedRecordAttr(C, *this); |
||
7325 | A->Inherited = Inherited; |
||
7326 | A->IsPackExpansion = IsPackExpansion; |
||
7327 | A->setImplicit(Implicit); |
||
7328 | return A; |
||
7329 | } |
||
7330 | |||
7331 | void CapturedRecordAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7332 | } |
||
7333 | |||
7334 | const char *CapturedRecordAttr::getSpelling() const { |
||
7335 | return "(No spelling)"; |
||
7336 | } |
||
7337 | |||
7338 | |||
7339 | // CarriesDependencyAttr implementation |
||
7340 | |||
7341 | CarriesDependencyAttr *CarriesDependencyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7342 | auto *A = new (Ctx) CarriesDependencyAttr(Ctx, CommonInfo); |
||
7343 | A->setImplicit(true); |
||
7344 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7345 | A->setAttributeSpellingListIndex(0); |
||
7346 | return A; |
||
7347 | } |
||
7348 | |||
7349 | CarriesDependencyAttr *CarriesDependencyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7350 | auto *A = new (Ctx) CarriesDependencyAttr(Ctx, CommonInfo); |
||
7351 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7352 | A->setAttributeSpellingListIndex(0); |
||
7353 | return A; |
||
7354 | } |
||
7355 | |||
7356 | CarriesDependencyAttr *CarriesDependencyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7357 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7358 | return CreateImplicit(Ctx, I); |
||
7359 | } |
||
7360 | |||
7361 | CarriesDependencyAttr *CarriesDependencyAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7362 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7363 | return Create(Ctx, I); |
||
7364 | } |
||
7365 | |||
7366 | CarriesDependencyAttr::CarriesDependencyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7367 | ) |
||
7368 | : InheritableParamAttr(Ctx, CommonInfo, attr::CarriesDependency, false, false) |
||
7369 | { |
||
7370 | } |
||
7371 | |||
7372 | CarriesDependencyAttr *CarriesDependencyAttr::clone(ASTContext &C) const { |
||
7373 | auto *A = new (C) CarriesDependencyAttr(C, *this); |
||
7374 | A->Inherited = Inherited; |
||
7375 | A->IsPackExpansion = IsPackExpansion; |
||
7376 | A->setImplicit(Implicit); |
||
7377 | return A; |
||
7378 | } |
||
7379 | |||
7380 | void CarriesDependencyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7381 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7382 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7383 | switch (getAttributeSpellingListIndex()) { |
||
7384 | default: |
||
7385 | llvm_unreachable("Unknown attribute spelling!"); |
||
7386 | break; |
||
7387 | case 0 : { |
||
7388 | OS << " __attribute__((carries_dependency"; |
||
7389 | OS << "))"; |
||
7390 | break; |
||
7391 | } |
||
7392 | case 1 : { |
||
7393 | OS << " [[carries_dependency"; |
||
7394 | OS << "]]"; |
||
7395 | break; |
||
7396 | } |
||
7397 | } |
||
7398 | } |
||
7399 | |||
7400 | const char *CarriesDependencyAttr::getSpelling() const { |
||
7401 | switch (getAttributeSpellingListIndex()) { |
||
7402 | default: |
||
7403 | llvm_unreachable("Unknown attribute spelling!"); |
||
7404 | return "(No spelling)"; |
||
7405 | case 0: |
||
7406 | return "carries_dependency"; |
||
7407 | case 1: |
||
7408 | return "carries_dependency"; |
||
7409 | } |
||
7410 | } |
||
7411 | |||
7412 | |||
7413 | // CleanupAttr implementation |
||
7414 | |||
7415 | CleanupAttr *CleanupAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * FunctionDecl, const AttributeCommonInfo &CommonInfo) { |
||
7416 | auto *A = new (Ctx) CleanupAttr(Ctx, CommonInfo, FunctionDecl); |
||
7417 | A->setImplicit(true); |
||
7418 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7419 | A->setAttributeSpellingListIndex(0); |
||
7420 | return A; |
||
7421 | } |
||
7422 | |||
7423 | CleanupAttr *CleanupAttr::Create(ASTContext &Ctx, FunctionDecl * FunctionDecl, const AttributeCommonInfo &CommonInfo) { |
||
7424 | auto *A = new (Ctx) CleanupAttr(Ctx, CommonInfo, FunctionDecl); |
||
7425 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7426 | A->setAttributeSpellingListIndex(0); |
||
7427 | return A; |
||
7428 | } |
||
7429 | |||
7430 | CleanupAttr *CleanupAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * FunctionDecl, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7431 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7432 | return CreateImplicit(Ctx, FunctionDecl, I); |
||
7433 | } |
||
7434 | |||
7435 | CleanupAttr *CleanupAttr::Create(ASTContext &Ctx, FunctionDecl * FunctionDecl, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7436 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7437 | return Create(Ctx, FunctionDecl, I); |
||
7438 | } |
||
7439 | |||
7440 | CleanupAttr::CleanupAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7441 | , FunctionDecl * FunctionDecl |
||
7442 | ) |
||
7443 | : InheritableAttr(Ctx, CommonInfo, attr::Cleanup, false, false) |
||
7444 | , functionDecl(FunctionDecl) |
||
7445 | { |
||
7446 | } |
||
7447 | |||
7448 | |||
7449 | |||
7450 | CleanupAttr *CleanupAttr::clone(ASTContext &C) const { |
||
7451 | auto *A = new (C) CleanupAttr(C, *this, functionDecl); |
||
7452 | A->Inherited = Inherited; |
||
7453 | A->IsPackExpansion = IsPackExpansion; |
||
7454 | A->setImplicit(Implicit); |
||
7455 | return A; |
||
7456 | } |
||
7457 | |||
7458 | void CleanupAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7459 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7460 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7461 | switch (getAttributeSpellingListIndex()) { |
||
7462 | default: |
||
7463 | llvm_unreachable("Unknown attribute spelling!"); |
||
7464 | break; |
||
7465 | case 0 : { |
||
7466 | OS << " __attribute__((cleanup"; |
||
7467 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7468 | OS << "" << getFunctionDecl()->getNameInfo().getAsString() << ""; |
||
7469 | if (!IsFirstArgument) |
||
7470 | OS << ")"; |
||
7471 | OS << "))"; |
||
7472 | break; |
||
7473 | } |
||
7474 | case 1 : { |
||
7475 | OS << " [[gnu::cleanup"; |
||
7476 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7477 | OS << "" << getFunctionDecl()->getNameInfo().getAsString() << ""; |
||
7478 | if (!IsFirstArgument) |
||
7479 | OS << ")"; |
||
7480 | OS << "]]"; |
||
7481 | break; |
||
7482 | } |
||
7483 | case 2 : { |
||
7484 | OS << " [[gnu::cleanup"; |
||
7485 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7486 | OS << "" << getFunctionDecl()->getNameInfo().getAsString() << ""; |
||
7487 | if (!IsFirstArgument) |
||
7488 | OS << ")"; |
||
7489 | OS << "]]"; |
||
7490 | break; |
||
7491 | } |
||
7492 | } |
||
7493 | } |
||
7494 | |||
7495 | const char *CleanupAttr::getSpelling() const { |
||
7496 | switch (getAttributeSpellingListIndex()) { |
||
7497 | default: |
||
7498 | llvm_unreachable("Unknown attribute spelling!"); |
||
7499 | return "(No spelling)"; |
||
7500 | case 0: |
||
7501 | return "cleanup"; |
||
7502 | case 1: |
||
7503 | return "cleanup"; |
||
7504 | case 2: |
||
7505 | return "cleanup"; |
||
7506 | } |
||
7507 | } |
||
7508 | |||
7509 | |||
7510 | // CmseNSCallAttr implementation |
||
7511 | |||
7512 | CmseNSCallAttr *CmseNSCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7513 | auto *A = new (Ctx) CmseNSCallAttr(Ctx, CommonInfo); |
||
7514 | A->setImplicit(true); |
||
7515 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7516 | A->setAttributeSpellingListIndex(0); |
||
7517 | return A; |
||
7518 | } |
||
7519 | |||
7520 | CmseNSCallAttr *CmseNSCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7521 | auto *A = new (Ctx) CmseNSCallAttr(Ctx, CommonInfo); |
||
7522 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7523 | A->setAttributeSpellingListIndex(0); |
||
7524 | return A; |
||
7525 | } |
||
7526 | |||
7527 | CmseNSCallAttr *CmseNSCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7528 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7529 | return CreateImplicit(Ctx, I); |
||
7530 | } |
||
7531 | |||
7532 | CmseNSCallAttr *CmseNSCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7533 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7534 | return Create(Ctx, I); |
||
7535 | } |
||
7536 | |||
7537 | CmseNSCallAttr::CmseNSCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7538 | ) |
||
7539 | : TypeAttr(Ctx, CommonInfo, attr::CmseNSCall, false) |
||
7540 | { |
||
7541 | } |
||
7542 | |||
7543 | CmseNSCallAttr *CmseNSCallAttr::clone(ASTContext &C) const { |
||
7544 | auto *A = new (C) CmseNSCallAttr(C, *this); |
||
7545 | A->Inherited = Inherited; |
||
7546 | A->IsPackExpansion = IsPackExpansion; |
||
7547 | A->setImplicit(Implicit); |
||
7548 | return A; |
||
7549 | } |
||
7550 | |||
7551 | void CmseNSCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7552 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7553 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7554 | switch (getAttributeSpellingListIndex()) { |
||
7555 | default: |
||
7556 | llvm_unreachable("Unknown attribute spelling!"); |
||
7557 | break; |
||
7558 | case 0 : { |
||
7559 | OS << " __attribute__((cmse_nonsecure_call"; |
||
7560 | OS << "))"; |
||
7561 | break; |
||
7562 | } |
||
7563 | } |
||
7564 | } |
||
7565 | |||
7566 | const char *CmseNSCallAttr::getSpelling() const { |
||
7567 | switch (getAttributeSpellingListIndex()) { |
||
7568 | default: |
||
7569 | llvm_unreachable("Unknown attribute spelling!"); |
||
7570 | return "(No spelling)"; |
||
7571 | case 0: |
||
7572 | return "cmse_nonsecure_call"; |
||
7573 | } |
||
7574 | } |
||
7575 | |||
7576 | |||
7577 | // CmseNSEntryAttr implementation |
||
7578 | |||
7579 | CmseNSEntryAttr *CmseNSEntryAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7580 | auto *A = new (Ctx) CmseNSEntryAttr(Ctx, CommonInfo); |
||
7581 | A->setImplicit(true); |
||
7582 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7583 | A->setAttributeSpellingListIndex(0); |
||
7584 | return A; |
||
7585 | } |
||
7586 | |||
7587 | CmseNSEntryAttr *CmseNSEntryAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7588 | auto *A = new (Ctx) CmseNSEntryAttr(Ctx, CommonInfo); |
||
7589 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7590 | A->setAttributeSpellingListIndex(0); |
||
7591 | return A; |
||
7592 | } |
||
7593 | |||
7594 | CmseNSEntryAttr *CmseNSEntryAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7595 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7596 | return CreateImplicit(Ctx, I); |
||
7597 | } |
||
7598 | |||
7599 | CmseNSEntryAttr *CmseNSEntryAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7600 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7601 | return Create(Ctx, I); |
||
7602 | } |
||
7603 | |||
7604 | CmseNSEntryAttr::CmseNSEntryAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7605 | ) |
||
7606 | : InheritableAttr(Ctx, CommonInfo, attr::CmseNSEntry, false, false) |
||
7607 | { |
||
7608 | } |
||
7609 | |||
7610 | CmseNSEntryAttr *CmseNSEntryAttr::clone(ASTContext &C) const { |
||
7611 | auto *A = new (C) CmseNSEntryAttr(C, *this); |
||
7612 | A->Inherited = Inherited; |
||
7613 | A->IsPackExpansion = IsPackExpansion; |
||
7614 | A->setImplicit(Implicit); |
||
7615 | return A; |
||
7616 | } |
||
7617 | |||
7618 | void CmseNSEntryAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7619 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7620 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7621 | switch (getAttributeSpellingListIndex()) { |
||
7622 | default: |
||
7623 | llvm_unreachable("Unknown attribute spelling!"); |
||
7624 | break; |
||
7625 | case 0 : { |
||
7626 | OS << " __attribute__((cmse_nonsecure_entry"; |
||
7627 | OS << "))"; |
||
7628 | break; |
||
7629 | } |
||
7630 | } |
||
7631 | } |
||
7632 | |||
7633 | const char *CmseNSEntryAttr::getSpelling() const { |
||
7634 | switch (getAttributeSpellingListIndex()) { |
||
7635 | default: |
||
7636 | llvm_unreachable("Unknown attribute spelling!"); |
||
7637 | return "(No spelling)"; |
||
7638 | case 0: |
||
7639 | return "cmse_nonsecure_entry"; |
||
7640 | } |
||
7641 | } |
||
7642 | |||
7643 | |||
7644 | // CodeSegAttr implementation |
||
7645 | |||
7646 | CodeSegAttr *CodeSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
7647 | auto *A = new (Ctx) CodeSegAttr(Ctx, CommonInfo, Name); |
||
7648 | A->setImplicit(true); |
||
7649 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7650 | A->setAttributeSpellingListIndex(0); |
||
7651 | return A; |
||
7652 | } |
||
7653 | |||
7654 | CodeSegAttr *CodeSegAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
7655 | auto *A = new (Ctx) CodeSegAttr(Ctx, CommonInfo, Name); |
||
7656 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7657 | A->setAttributeSpellingListIndex(0); |
||
7658 | return A; |
||
7659 | } |
||
7660 | |||
7661 | CodeSegAttr *CodeSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7662 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7663 | return CreateImplicit(Ctx, Name, I); |
||
7664 | } |
||
7665 | |||
7666 | CodeSegAttr *CodeSegAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7667 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7668 | return Create(Ctx, Name, I); |
||
7669 | } |
||
7670 | |||
7671 | CodeSegAttr::CodeSegAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7672 | , llvm::StringRef Name |
||
7673 | ) |
||
7674 | : InheritableAttr(Ctx, CommonInfo, attr::CodeSeg, false, false) |
||
7675 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
7676 | { |
||
7677 | if (!Name.empty()) |
||
7678 | std::memcpy(name, Name.data(), nameLength); |
||
7679 | } |
||
7680 | |||
7681 | |||
7682 | |||
7683 | CodeSegAttr *CodeSegAttr::clone(ASTContext &C) const { |
||
7684 | auto *A = new (C) CodeSegAttr(C, *this, getName()); |
||
7685 | A->Inherited = Inherited; |
||
7686 | A->IsPackExpansion = IsPackExpansion; |
||
7687 | A->setImplicit(Implicit); |
||
7688 | return A; |
||
7689 | } |
||
7690 | |||
7691 | void CodeSegAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7692 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7693 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7694 | switch (getAttributeSpellingListIndex()) { |
||
7695 | default: |
||
7696 | llvm_unreachable("Unknown attribute spelling!"); |
||
7697 | break; |
||
7698 | case 0 : { |
||
7699 | OS << " __declspec(code_seg"; |
||
7700 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
7701 | OS << "\"" << getName() << "\""; |
||
7702 | if (!IsFirstArgument) |
||
7703 | OS << ")"; |
||
7704 | OS << ")"; |
||
7705 | break; |
||
7706 | } |
||
7707 | } |
||
7708 | } |
||
7709 | |||
7710 | const char *CodeSegAttr::getSpelling() const { |
||
7711 | switch (getAttributeSpellingListIndex()) { |
||
7712 | default: |
||
7713 | llvm_unreachable("Unknown attribute spelling!"); |
||
7714 | return "(No spelling)"; |
||
7715 | case 0: |
||
7716 | return "code_seg"; |
||
7717 | } |
||
7718 | } |
||
7719 | |||
7720 | |||
7721 | // ColdAttr implementation |
||
7722 | |||
7723 | ColdAttr *ColdAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7724 | auto *A = new (Ctx) ColdAttr(Ctx, CommonInfo); |
||
7725 | A->setImplicit(true); |
||
7726 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7727 | A->setAttributeSpellingListIndex(0); |
||
7728 | return A; |
||
7729 | } |
||
7730 | |||
7731 | ColdAttr *ColdAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7732 | auto *A = new (Ctx) ColdAttr(Ctx, CommonInfo); |
||
7733 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7734 | A->setAttributeSpellingListIndex(0); |
||
7735 | return A; |
||
7736 | } |
||
7737 | |||
7738 | ColdAttr *ColdAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7739 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7740 | return CreateImplicit(Ctx, I); |
||
7741 | } |
||
7742 | |||
7743 | ColdAttr *ColdAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7744 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7745 | return Create(Ctx, I); |
||
7746 | } |
||
7747 | |||
7748 | ColdAttr::ColdAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7749 | ) |
||
7750 | : InheritableAttr(Ctx, CommonInfo, attr::Cold, false, false) |
||
7751 | { |
||
7752 | } |
||
7753 | |||
7754 | ColdAttr *ColdAttr::clone(ASTContext &C) const { |
||
7755 | auto *A = new (C) ColdAttr(C, *this); |
||
7756 | A->Inherited = Inherited; |
||
7757 | A->IsPackExpansion = IsPackExpansion; |
||
7758 | A->setImplicit(Implicit); |
||
7759 | return A; |
||
7760 | } |
||
7761 | |||
7762 | void ColdAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7763 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7764 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7765 | switch (getAttributeSpellingListIndex()) { |
||
7766 | default: |
||
7767 | llvm_unreachable("Unknown attribute spelling!"); |
||
7768 | break; |
||
7769 | case 0 : { |
||
7770 | OS << " __attribute__((cold"; |
||
7771 | OS << "))"; |
||
7772 | break; |
||
7773 | } |
||
7774 | case 1 : { |
||
7775 | OS << " [[gnu::cold"; |
||
7776 | OS << "]]"; |
||
7777 | break; |
||
7778 | } |
||
7779 | case 2 : { |
||
7780 | OS << " [[gnu::cold"; |
||
7781 | OS << "]]"; |
||
7782 | break; |
||
7783 | } |
||
7784 | } |
||
7785 | } |
||
7786 | |||
7787 | const char *ColdAttr::getSpelling() const { |
||
7788 | switch (getAttributeSpellingListIndex()) { |
||
7789 | default: |
||
7790 | llvm_unreachable("Unknown attribute spelling!"); |
||
7791 | return "(No spelling)"; |
||
7792 | case 0: |
||
7793 | return "cold"; |
||
7794 | case 1: |
||
7795 | return "cold"; |
||
7796 | case 2: |
||
7797 | return "cold"; |
||
7798 | } |
||
7799 | } |
||
7800 | |||
7801 | |||
7802 | // CommonAttr implementation |
||
7803 | |||
7804 | CommonAttr *CommonAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7805 | auto *A = new (Ctx) CommonAttr(Ctx, CommonInfo); |
||
7806 | A->setImplicit(true); |
||
7807 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7808 | A->setAttributeSpellingListIndex(0); |
||
7809 | return A; |
||
7810 | } |
||
7811 | |||
7812 | CommonAttr *CommonAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7813 | auto *A = new (Ctx) CommonAttr(Ctx, CommonInfo); |
||
7814 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7815 | A->setAttributeSpellingListIndex(0); |
||
7816 | return A; |
||
7817 | } |
||
7818 | |||
7819 | CommonAttr *CommonAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7820 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7821 | return CreateImplicit(Ctx, I); |
||
7822 | } |
||
7823 | |||
7824 | CommonAttr *CommonAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7825 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7826 | return Create(Ctx, I); |
||
7827 | } |
||
7828 | |||
7829 | CommonAttr::CommonAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7830 | ) |
||
7831 | : InheritableAttr(Ctx, CommonInfo, attr::Common, false, false) |
||
7832 | { |
||
7833 | } |
||
7834 | |||
7835 | CommonAttr *CommonAttr::clone(ASTContext &C) const { |
||
7836 | auto *A = new (C) CommonAttr(C, *this); |
||
7837 | A->Inherited = Inherited; |
||
7838 | A->IsPackExpansion = IsPackExpansion; |
||
7839 | A->setImplicit(Implicit); |
||
7840 | return A; |
||
7841 | } |
||
7842 | |||
7843 | void CommonAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7844 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7845 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7846 | switch (getAttributeSpellingListIndex()) { |
||
7847 | default: |
||
7848 | llvm_unreachable("Unknown attribute spelling!"); |
||
7849 | break; |
||
7850 | case 0 : { |
||
7851 | OS << " __attribute__((common"; |
||
7852 | OS << "))"; |
||
7853 | break; |
||
7854 | } |
||
7855 | case 1 : { |
||
7856 | OS << " [[gnu::common"; |
||
7857 | OS << "]]"; |
||
7858 | break; |
||
7859 | } |
||
7860 | case 2 : { |
||
7861 | OS << " [[gnu::common"; |
||
7862 | OS << "]]"; |
||
7863 | break; |
||
7864 | } |
||
7865 | } |
||
7866 | } |
||
7867 | |||
7868 | const char *CommonAttr::getSpelling() const { |
||
7869 | switch (getAttributeSpellingListIndex()) { |
||
7870 | default: |
||
7871 | llvm_unreachable("Unknown attribute spelling!"); |
||
7872 | return "(No spelling)"; |
||
7873 | case 0: |
||
7874 | return "common"; |
||
7875 | case 1: |
||
7876 | return "common"; |
||
7877 | case 2: |
||
7878 | return "common"; |
||
7879 | } |
||
7880 | } |
||
7881 | |||
7882 | |||
7883 | // ConstAttr implementation |
||
7884 | |||
7885 | ConstAttr *ConstAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7886 | auto *A = new (Ctx) ConstAttr(Ctx, CommonInfo); |
||
7887 | A->setImplicit(true); |
||
7888 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7889 | A->setAttributeSpellingListIndex(0); |
||
7890 | return A; |
||
7891 | } |
||
7892 | |||
7893 | ConstAttr *ConstAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7894 | auto *A = new (Ctx) ConstAttr(Ctx, CommonInfo); |
||
7895 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7896 | A->setAttributeSpellingListIndex(0); |
||
7897 | return A; |
||
7898 | } |
||
7899 | |||
7900 | ConstAttr *ConstAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7901 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7902 | return CreateImplicit(Ctx, I); |
||
7903 | } |
||
7904 | |||
7905 | ConstAttr *ConstAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
7906 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
7907 | return Create(Ctx, I); |
||
7908 | } |
||
7909 | |||
7910 | ConstAttr::ConstAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
7911 | ) |
||
7912 | : InheritableAttr(Ctx, CommonInfo, attr::Const, false, false) |
||
7913 | { |
||
7914 | } |
||
7915 | |||
7916 | ConstAttr *ConstAttr::clone(ASTContext &C) const { |
||
7917 | auto *A = new (C) ConstAttr(C, *this); |
||
7918 | A->Inherited = Inherited; |
||
7919 | A->IsPackExpansion = IsPackExpansion; |
||
7920 | A->setImplicit(Implicit); |
||
7921 | return A; |
||
7922 | } |
||
7923 | |||
7924 | void ConstAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
7925 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
7926 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
7927 | switch (getAttributeSpellingListIndex()) { |
||
7928 | default: |
||
7929 | llvm_unreachable("Unknown attribute spelling!"); |
||
7930 | break; |
||
7931 | case 0 : { |
||
7932 | OS << " __attribute__((const"; |
||
7933 | OS << "))"; |
||
7934 | break; |
||
7935 | } |
||
7936 | case 1 : { |
||
7937 | OS << " [[gnu::const"; |
||
7938 | OS << "]]"; |
||
7939 | break; |
||
7940 | } |
||
7941 | case 2 : { |
||
7942 | OS << " [[gnu::const"; |
||
7943 | OS << "]]"; |
||
7944 | break; |
||
7945 | } |
||
7946 | case 3 : { |
||
7947 | OS << " __attribute__((__const"; |
||
7948 | OS << "))"; |
||
7949 | break; |
||
7950 | } |
||
7951 | case 4 : { |
||
7952 | OS << " [[gnu::__const"; |
||
7953 | OS << "]]"; |
||
7954 | break; |
||
7955 | } |
||
7956 | case 5 : { |
||
7957 | OS << " [[gnu::__const"; |
||
7958 | OS << "]]"; |
||
7959 | break; |
||
7960 | } |
||
7961 | } |
||
7962 | } |
||
7963 | |||
7964 | const char *ConstAttr::getSpelling() const { |
||
7965 | switch (getAttributeSpellingListIndex()) { |
||
7966 | default: |
||
7967 | llvm_unreachable("Unknown attribute spelling!"); |
||
7968 | return "(No spelling)"; |
||
7969 | case 0: |
||
7970 | return "const"; |
||
7971 | case 1: |
||
7972 | return "const"; |
||
7973 | case 2: |
||
7974 | return "const"; |
||
7975 | case 3: |
||
7976 | return "__const"; |
||
7977 | case 4: |
||
7978 | return "__const"; |
||
7979 | case 5: |
||
7980 | return "__const"; |
||
7981 | } |
||
7982 | } |
||
7983 | |||
7984 | |||
7985 | // ConstInitAttr implementation |
||
7986 | |||
7987 | ConstInitAttr *ConstInitAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7988 | auto *A = new (Ctx) ConstInitAttr(Ctx, CommonInfo); |
||
7989 | A->setImplicit(true); |
||
7990 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
7991 | A->setAttributeSpellingListIndex(0); |
||
7992 | return A; |
||
7993 | } |
||
7994 | |||
7995 | ConstInitAttr *ConstInitAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
7996 | auto *A = new (Ctx) ConstInitAttr(Ctx, CommonInfo); |
||
7997 | return A; |
||
7998 | } |
||
7999 | |||
8000 | ConstInitAttr *ConstInitAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ConstInitAttr::Spelling S) { |
||
8001 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
8002 | return CreateImplicit(Ctx, I); |
||
8003 | } |
||
8004 | |||
8005 | ConstInitAttr *ConstInitAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ConstInitAttr::Spelling S) { |
||
8006 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
8007 | return Create(Ctx, I); |
||
8008 | } |
||
8009 | |||
8010 | ConstInitAttr::ConstInitAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8011 | ) |
||
8012 | : InheritableAttr(Ctx, CommonInfo, attr::ConstInit, false, false) |
||
8013 | { |
||
8014 | } |
||
8015 | |||
8016 | ConstInitAttr::Spelling ConstInitAttr::getSemanticSpelling() const { |
||
8017 | switch (getAttributeSpellingListIndex()) { |
||
8018 | default: llvm_unreachable("Unknown spelling list index"); |
||
8019 | case 0: return Keyword_constinit; |
||
8020 | case 1: return GNU_require_constant_initialization; |
||
8021 | case 2: return CXX11_clang_require_constant_initialization; |
||
8022 | } |
||
8023 | } |
||
8024 | ConstInitAttr *ConstInitAttr::clone(ASTContext &C) const { |
||
8025 | auto *A = new (C) ConstInitAttr(C, *this); |
||
8026 | A->Inherited = Inherited; |
||
8027 | A->IsPackExpansion = IsPackExpansion; |
||
8028 | A->setImplicit(Implicit); |
||
8029 | return A; |
||
8030 | } |
||
8031 | |||
8032 | void ConstInitAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8033 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8034 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8035 | switch (getAttributeSpellingListIndex()) { |
||
8036 | default: |
||
8037 | llvm_unreachable("Unknown attribute spelling!"); |
||
8038 | break; |
||
8039 | case 0 : { |
||
8040 | OS << " constinit"; |
||
8041 | OS << ""; |
||
8042 | break; |
||
8043 | } |
||
8044 | case 1 : { |
||
8045 | OS << " __attribute__((require_constant_initialization"; |
||
8046 | OS << "))"; |
||
8047 | break; |
||
8048 | } |
||
8049 | case 2 : { |
||
8050 | OS << " [[clang::require_constant_initialization"; |
||
8051 | OS << "]]"; |
||
8052 | break; |
||
8053 | } |
||
8054 | } |
||
8055 | } |
||
8056 | |||
8057 | const char *ConstInitAttr::getSpelling() const { |
||
8058 | switch (getAttributeSpellingListIndex()) { |
||
8059 | default: |
||
8060 | llvm_unreachable("Unknown attribute spelling!"); |
||
8061 | return "(No spelling)"; |
||
8062 | case 0: |
||
8063 | return "constinit"; |
||
8064 | case 1: |
||
8065 | return "require_constant_initialization"; |
||
8066 | case 2: |
||
8067 | return "require_constant_initialization"; |
||
8068 | } |
||
8069 | } |
||
8070 | |||
8071 | |||
8072 | // ConstructorAttr implementation |
||
8073 | |||
8074 | ConstructorAttr *ConstructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) { |
||
8075 | auto *A = new (Ctx) ConstructorAttr(Ctx, CommonInfo, Priority); |
||
8076 | A->setImplicit(true); |
||
8077 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8078 | A->setAttributeSpellingListIndex(0); |
||
8079 | return A; |
||
8080 | } |
||
8081 | |||
8082 | ConstructorAttr *ConstructorAttr::Create(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) { |
||
8083 | auto *A = new (Ctx) ConstructorAttr(Ctx, CommonInfo, Priority); |
||
8084 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8085 | A->setAttributeSpellingListIndex(0); |
||
8086 | return A; |
||
8087 | } |
||
8088 | |||
8089 | ConstructorAttr *ConstructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8090 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8091 | return CreateImplicit(Ctx, Priority, I); |
||
8092 | } |
||
8093 | |||
8094 | ConstructorAttr *ConstructorAttr::Create(ASTContext &Ctx, int Priority, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8095 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8096 | return Create(Ctx, Priority, I); |
||
8097 | } |
||
8098 | |||
8099 | ConstructorAttr::ConstructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8100 | , int Priority |
||
8101 | ) |
||
8102 | : InheritableAttr(Ctx, CommonInfo, attr::Constructor, false, false) |
||
8103 | , priority(Priority) |
||
8104 | { |
||
8105 | } |
||
8106 | |||
8107 | ConstructorAttr::ConstructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8108 | ) |
||
8109 | : InheritableAttr(Ctx, CommonInfo, attr::Constructor, false, false) |
||
8110 | , priority() |
||
8111 | { |
||
8112 | } |
||
8113 | |||
8114 | |||
8115 | |||
8116 | ConstructorAttr *ConstructorAttr::clone(ASTContext &C) const { |
||
8117 | auto *A = new (C) ConstructorAttr(C, *this, priority); |
||
8118 | A->Inherited = Inherited; |
||
8119 | A->IsPackExpansion = IsPackExpansion; |
||
8120 | A->setImplicit(Implicit); |
||
8121 | return A; |
||
8122 | } |
||
8123 | |||
8124 | void ConstructorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8125 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8126 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8127 | switch (getAttributeSpellingListIndex()) { |
||
8128 | default: |
||
8129 | llvm_unreachable("Unknown attribute spelling!"); |
||
8130 | break; |
||
8131 | case 0 : { |
||
8132 | OS << " __attribute__((constructor"; |
||
8133 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
8134 | OS << "" << getPriority() << ""; |
||
8135 | if (!IsFirstArgument) |
||
8136 | OS << ")"; |
||
8137 | OS << "))"; |
||
8138 | break; |
||
8139 | } |
||
8140 | case 1 : { |
||
8141 | OS << " [[gnu::constructor"; |
||
8142 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
8143 | OS << "" << getPriority() << ""; |
||
8144 | if (!IsFirstArgument) |
||
8145 | OS << ")"; |
||
8146 | OS << "]]"; |
||
8147 | break; |
||
8148 | } |
||
8149 | case 2 : { |
||
8150 | OS << " [[gnu::constructor"; |
||
8151 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
8152 | OS << "" << getPriority() << ""; |
||
8153 | if (!IsFirstArgument) |
||
8154 | OS << ")"; |
||
8155 | OS << "]]"; |
||
8156 | break; |
||
8157 | } |
||
8158 | } |
||
8159 | } |
||
8160 | |||
8161 | const char *ConstructorAttr::getSpelling() const { |
||
8162 | switch (getAttributeSpellingListIndex()) { |
||
8163 | default: |
||
8164 | llvm_unreachable("Unknown attribute spelling!"); |
||
8165 | return "(No spelling)"; |
||
8166 | case 0: |
||
8167 | return "constructor"; |
||
8168 | case 1: |
||
8169 | return "constructor"; |
||
8170 | case 2: |
||
8171 | return "constructor"; |
||
8172 | } |
||
8173 | } |
||
8174 | |||
8175 | |||
8176 | // ConsumableAttr implementation |
||
8177 | |||
8178 | ConsumableAttr *ConsumableAttr::CreateImplicit(ASTContext &Ctx, ConsumedState DefaultState, const AttributeCommonInfo &CommonInfo) { |
||
8179 | auto *A = new (Ctx) ConsumableAttr(Ctx, CommonInfo, DefaultState); |
||
8180 | A->setImplicit(true); |
||
8181 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8182 | A->setAttributeSpellingListIndex(0); |
||
8183 | return A; |
||
8184 | } |
||
8185 | |||
8186 | ConsumableAttr *ConsumableAttr::Create(ASTContext &Ctx, ConsumedState DefaultState, const AttributeCommonInfo &CommonInfo) { |
||
8187 | auto *A = new (Ctx) ConsumableAttr(Ctx, CommonInfo, DefaultState); |
||
8188 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8189 | A->setAttributeSpellingListIndex(0); |
||
8190 | return A; |
||
8191 | } |
||
8192 | |||
8193 | ConsumableAttr *ConsumableAttr::CreateImplicit(ASTContext &Ctx, ConsumedState DefaultState, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8194 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8195 | return CreateImplicit(Ctx, DefaultState, I); |
||
8196 | } |
||
8197 | |||
8198 | ConsumableAttr *ConsumableAttr::Create(ASTContext &Ctx, ConsumedState DefaultState, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8199 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8200 | return Create(Ctx, DefaultState, I); |
||
8201 | } |
||
8202 | |||
8203 | ConsumableAttr::ConsumableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8204 | , ConsumedState DefaultState |
||
8205 | ) |
||
8206 | : InheritableAttr(Ctx, CommonInfo, attr::Consumable, false, false) |
||
8207 | , defaultState(DefaultState) |
||
8208 | { |
||
8209 | } |
||
8210 | |||
8211 | |||
8212 | |||
8213 | bool ConsumableAttr::ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) { |
||
8214 | std::optional<ConsumedState> R = llvm::StringSwitch<std::optional<ConsumedState>>(Val) |
||
8215 | .Case("unknown", ConsumableAttr::Unknown) |
||
8216 | .Case("consumed", ConsumableAttr::Consumed) |
||
8217 | .Case("unconsumed", ConsumableAttr::Unconsumed) |
||
8218 | .Default(std::optional<ConsumedState>()); |
||
8219 | if (R) { |
||
8220 | Out = *R; |
||
8221 | return true; |
||
8222 | } |
||
8223 | return false; |
||
8224 | } |
||
8225 | |||
8226 | const char *ConsumableAttr::ConvertConsumedStateToStr(ConsumedState Val) { |
||
8227 | switch(Val) { |
||
8228 | case ConsumableAttr::Unknown: return "unknown"; |
||
8229 | case ConsumableAttr::Consumed: return "consumed"; |
||
8230 | case ConsumableAttr::Unconsumed: return "unconsumed"; |
||
8231 | } |
||
8232 | llvm_unreachable("No enumerator with that value"); |
||
8233 | } |
||
8234 | ConsumableAttr *ConsumableAttr::clone(ASTContext &C) const { |
||
8235 | auto *A = new (C) ConsumableAttr(C, *this, defaultState); |
||
8236 | A->Inherited = Inherited; |
||
8237 | A->IsPackExpansion = IsPackExpansion; |
||
8238 | A->setImplicit(Implicit); |
||
8239 | return A; |
||
8240 | } |
||
8241 | |||
8242 | void ConsumableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8243 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8244 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8245 | switch (getAttributeSpellingListIndex()) { |
||
8246 | default: |
||
8247 | llvm_unreachable("Unknown attribute spelling!"); |
||
8248 | break; |
||
8249 | case 0 : { |
||
8250 | OS << " __attribute__((consumable"; |
||
8251 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
8252 | OS << "\"" << ConsumableAttr::ConvertConsumedStateToStr(getDefaultState()) << "\""; |
||
8253 | if (!IsFirstArgument) |
||
8254 | OS << ")"; |
||
8255 | OS << "))"; |
||
8256 | break; |
||
8257 | } |
||
8258 | case 1 : { |
||
8259 | OS << " [[clang::consumable"; |
||
8260 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
8261 | OS << "\"" << ConsumableAttr::ConvertConsumedStateToStr(getDefaultState()) << "\""; |
||
8262 | if (!IsFirstArgument) |
||
8263 | OS << ")"; |
||
8264 | OS << "]]"; |
||
8265 | break; |
||
8266 | } |
||
8267 | } |
||
8268 | } |
||
8269 | |||
8270 | const char *ConsumableAttr::getSpelling() const { |
||
8271 | switch (getAttributeSpellingListIndex()) { |
||
8272 | default: |
||
8273 | llvm_unreachable("Unknown attribute spelling!"); |
||
8274 | return "(No spelling)"; |
||
8275 | case 0: |
||
8276 | return "consumable"; |
||
8277 | case 1: |
||
8278 | return "consumable"; |
||
8279 | } |
||
8280 | } |
||
8281 | |||
8282 | |||
8283 | // ConsumableAutoCastAttr implementation |
||
8284 | |||
8285 | ConsumableAutoCastAttr *ConsumableAutoCastAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8286 | auto *A = new (Ctx) ConsumableAutoCastAttr(Ctx, CommonInfo); |
||
8287 | A->setImplicit(true); |
||
8288 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8289 | A->setAttributeSpellingListIndex(0); |
||
8290 | return A; |
||
8291 | } |
||
8292 | |||
8293 | ConsumableAutoCastAttr *ConsumableAutoCastAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8294 | auto *A = new (Ctx) ConsumableAutoCastAttr(Ctx, CommonInfo); |
||
8295 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8296 | A->setAttributeSpellingListIndex(0); |
||
8297 | return A; |
||
8298 | } |
||
8299 | |||
8300 | ConsumableAutoCastAttr *ConsumableAutoCastAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8301 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8302 | return CreateImplicit(Ctx, I); |
||
8303 | } |
||
8304 | |||
8305 | ConsumableAutoCastAttr *ConsumableAutoCastAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8306 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8307 | return Create(Ctx, I); |
||
8308 | } |
||
8309 | |||
8310 | ConsumableAutoCastAttr::ConsumableAutoCastAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8311 | ) |
||
8312 | : InheritableAttr(Ctx, CommonInfo, attr::ConsumableAutoCast, false, false) |
||
8313 | { |
||
8314 | } |
||
8315 | |||
8316 | ConsumableAutoCastAttr *ConsumableAutoCastAttr::clone(ASTContext &C) const { |
||
8317 | auto *A = new (C) ConsumableAutoCastAttr(C, *this); |
||
8318 | A->Inherited = Inherited; |
||
8319 | A->IsPackExpansion = IsPackExpansion; |
||
8320 | A->setImplicit(Implicit); |
||
8321 | return A; |
||
8322 | } |
||
8323 | |||
8324 | void ConsumableAutoCastAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8325 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8326 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8327 | switch (getAttributeSpellingListIndex()) { |
||
8328 | default: |
||
8329 | llvm_unreachable("Unknown attribute spelling!"); |
||
8330 | break; |
||
8331 | case 0 : { |
||
8332 | OS << " __attribute__((consumable_auto_cast_state"; |
||
8333 | OS << "))"; |
||
8334 | break; |
||
8335 | } |
||
8336 | case 1 : { |
||
8337 | OS << " [[clang::consumable_auto_cast_state"; |
||
8338 | OS << "]]"; |
||
8339 | break; |
||
8340 | } |
||
8341 | } |
||
8342 | } |
||
8343 | |||
8344 | const char *ConsumableAutoCastAttr::getSpelling() const { |
||
8345 | switch (getAttributeSpellingListIndex()) { |
||
8346 | default: |
||
8347 | llvm_unreachable("Unknown attribute spelling!"); |
||
8348 | return "(No spelling)"; |
||
8349 | case 0: |
||
8350 | return "consumable_auto_cast_state"; |
||
8351 | case 1: |
||
8352 | return "consumable_auto_cast_state"; |
||
8353 | } |
||
8354 | } |
||
8355 | |||
8356 | |||
8357 | // ConsumableSetOnReadAttr implementation |
||
8358 | |||
8359 | ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8360 | auto *A = new (Ctx) ConsumableSetOnReadAttr(Ctx, CommonInfo); |
||
8361 | A->setImplicit(true); |
||
8362 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8363 | A->setAttributeSpellingListIndex(0); |
||
8364 | return A; |
||
8365 | } |
||
8366 | |||
8367 | ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8368 | auto *A = new (Ctx) ConsumableSetOnReadAttr(Ctx, CommonInfo); |
||
8369 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8370 | A->setAttributeSpellingListIndex(0); |
||
8371 | return A; |
||
8372 | } |
||
8373 | |||
8374 | ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8375 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8376 | return CreateImplicit(Ctx, I); |
||
8377 | } |
||
8378 | |||
8379 | ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8380 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8381 | return Create(Ctx, I); |
||
8382 | } |
||
8383 | |||
8384 | ConsumableSetOnReadAttr::ConsumableSetOnReadAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8385 | ) |
||
8386 | : InheritableAttr(Ctx, CommonInfo, attr::ConsumableSetOnRead, false, false) |
||
8387 | { |
||
8388 | } |
||
8389 | |||
8390 | ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::clone(ASTContext &C) const { |
||
8391 | auto *A = new (C) ConsumableSetOnReadAttr(C, *this); |
||
8392 | A->Inherited = Inherited; |
||
8393 | A->IsPackExpansion = IsPackExpansion; |
||
8394 | A->setImplicit(Implicit); |
||
8395 | return A; |
||
8396 | } |
||
8397 | |||
8398 | void ConsumableSetOnReadAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8399 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8400 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8401 | switch (getAttributeSpellingListIndex()) { |
||
8402 | default: |
||
8403 | llvm_unreachable("Unknown attribute spelling!"); |
||
8404 | break; |
||
8405 | case 0 : { |
||
8406 | OS << " __attribute__((consumable_set_state_on_read"; |
||
8407 | OS << "))"; |
||
8408 | break; |
||
8409 | } |
||
8410 | case 1 : { |
||
8411 | OS << " [[clang::consumable_set_state_on_read"; |
||
8412 | OS << "]]"; |
||
8413 | break; |
||
8414 | } |
||
8415 | } |
||
8416 | } |
||
8417 | |||
8418 | const char *ConsumableSetOnReadAttr::getSpelling() const { |
||
8419 | switch (getAttributeSpellingListIndex()) { |
||
8420 | default: |
||
8421 | llvm_unreachable("Unknown attribute spelling!"); |
||
8422 | return "(No spelling)"; |
||
8423 | case 0: |
||
8424 | return "consumable_set_state_on_read"; |
||
8425 | case 1: |
||
8426 | return "consumable_set_state_on_read"; |
||
8427 | } |
||
8428 | } |
||
8429 | |||
8430 | |||
8431 | // ConvergentAttr implementation |
||
8432 | |||
8433 | ConvergentAttr *ConvergentAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8434 | auto *A = new (Ctx) ConvergentAttr(Ctx, CommonInfo); |
||
8435 | A->setImplicit(true); |
||
8436 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8437 | A->setAttributeSpellingListIndex(0); |
||
8438 | return A; |
||
8439 | } |
||
8440 | |||
8441 | ConvergentAttr *ConvergentAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8442 | auto *A = new (Ctx) ConvergentAttr(Ctx, CommonInfo); |
||
8443 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8444 | A->setAttributeSpellingListIndex(0); |
||
8445 | return A; |
||
8446 | } |
||
8447 | |||
8448 | ConvergentAttr *ConvergentAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8449 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8450 | return CreateImplicit(Ctx, I); |
||
8451 | } |
||
8452 | |||
8453 | ConvergentAttr *ConvergentAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8454 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8455 | return Create(Ctx, I); |
||
8456 | } |
||
8457 | |||
8458 | ConvergentAttr::ConvergentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8459 | ) |
||
8460 | : InheritableAttr(Ctx, CommonInfo, attr::Convergent, false, false) |
||
8461 | { |
||
8462 | } |
||
8463 | |||
8464 | ConvergentAttr *ConvergentAttr::clone(ASTContext &C) const { |
||
8465 | auto *A = new (C) ConvergentAttr(C, *this); |
||
8466 | A->Inherited = Inherited; |
||
8467 | A->IsPackExpansion = IsPackExpansion; |
||
8468 | A->setImplicit(Implicit); |
||
8469 | return A; |
||
8470 | } |
||
8471 | |||
8472 | void ConvergentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8473 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8474 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8475 | switch (getAttributeSpellingListIndex()) { |
||
8476 | default: |
||
8477 | llvm_unreachable("Unknown attribute spelling!"); |
||
8478 | break; |
||
8479 | case 0 : { |
||
8480 | OS << " __attribute__((convergent"; |
||
8481 | OS << "))"; |
||
8482 | break; |
||
8483 | } |
||
8484 | case 1 : { |
||
8485 | OS << " [[clang::convergent"; |
||
8486 | OS << "]]"; |
||
8487 | break; |
||
8488 | } |
||
8489 | case 2 : { |
||
8490 | OS << " [[clang::convergent"; |
||
8491 | OS << "]]"; |
||
8492 | break; |
||
8493 | } |
||
8494 | } |
||
8495 | } |
||
8496 | |||
8497 | const char *ConvergentAttr::getSpelling() const { |
||
8498 | switch (getAttributeSpellingListIndex()) { |
||
8499 | default: |
||
8500 | llvm_unreachable("Unknown attribute spelling!"); |
||
8501 | return "(No spelling)"; |
||
8502 | case 0: |
||
8503 | return "convergent"; |
||
8504 | case 1: |
||
8505 | return "convergent"; |
||
8506 | case 2: |
||
8507 | return "convergent"; |
||
8508 | } |
||
8509 | } |
||
8510 | |||
8511 | |||
8512 | // DLLExportAttr implementation |
||
8513 | |||
8514 | DLLExportAttr *DLLExportAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8515 | auto *A = new (Ctx) DLLExportAttr(Ctx, CommonInfo); |
||
8516 | A->setImplicit(true); |
||
8517 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8518 | A->setAttributeSpellingListIndex(0); |
||
8519 | return A; |
||
8520 | } |
||
8521 | |||
8522 | DLLExportAttr *DLLExportAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8523 | auto *A = new (Ctx) DLLExportAttr(Ctx, CommonInfo); |
||
8524 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8525 | A->setAttributeSpellingListIndex(0); |
||
8526 | return A; |
||
8527 | } |
||
8528 | |||
8529 | DLLExportAttr *DLLExportAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8530 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8531 | return CreateImplicit(Ctx, I); |
||
8532 | } |
||
8533 | |||
8534 | DLLExportAttr *DLLExportAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8535 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8536 | return Create(Ctx, I); |
||
8537 | } |
||
8538 | |||
8539 | DLLExportAttr::DLLExportAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8540 | ) |
||
8541 | : InheritableAttr(Ctx, CommonInfo, attr::DLLExport, false, false) |
||
8542 | { |
||
8543 | } |
||
8544 | |||
8545 | DLLExportAttr *DLLExportAttr::clone(ASTContext &C) const { |
||
8546 | auto *A = new (C) DLLExportAttr(C, *this); |
||
8547 | A->Inherited = Inherited; |
||
8548 | A->IsPackExpansion = IsPackExpansion; |
||
8549 | A->setImplicit(Implicit); |
||
8550 | return A; |
||
8551 | } |
||
8552 | |||
8553 | void DLLExportAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8554 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8555 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8556 | switch (getAttributeSpellingListIndex()) { |
||
8557 | default: |
||
8558 | llvm_unreachable("Unknown attribute spelling!"); |
||
8559 | break; |
||
8560 | case 0 : { |
||
8561 | OS << " __declspec(dllexport"; |
||
8562 | OS << ")"; |
||
8563 | break; |
||
8564 | } |
||
8565 | case 1 : { |
||
8566 | OS << " __attribute__((dllexport"; |
||
8567 | OS << "))"; |
||
8568 | break; |
||
8569 | } |
||
8570 | case 2 : { |
||
8571 | OS << " [[gnu::dllexport"; |
||
8572 | OS << "]]"; |
||
8573 | break; |
||
8574 | } |
||
8575 | case 3 : { |
||
8576 | OS << " [[gnu::dllexport"; |
||
8577 | OS << "]]"; |
||
8578 | break; |
||
8579 | } |
||
8580 | } |
||
8581 | } |
||
8582 | |||
8583 | const char *DLLExportAttr::getSpelling() const { |
||
8584 | switch (getAttributeSpellingListIndex()) { |
||
8585 | default: |
||
8586 | llvm_unreachable("Unknown attribute spelling!"); |
||
8587 | return "(No spelling)"; |
||
8588 | case 0: |
||
8589 | return "dllexport"; |
||
8590 | case 1: |
||
8591 | return "dllexport"; |
||
8592 | case 2: |
||
8593 | return "dllexport"; |
||
8594 | case 3: |
||
8595 | return "dllexport"; |
||
8596 | } |
||
8597 | } |
||
8598 | |||
8599 | |||
8600 | // DLLExportStaticLocalAttr implementation |
||
8601 | |||
8602 | DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8603 | auto *A = new (Ctx) DLLExportStaticLocalAttr(Ctx, CommonInfo); |
||
8604 | A->setImplicit(true); |
||
8605 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8606 | A->setAttributeSpellingListIndex(0); |
||
8607 | return A; |
||
8608 | } |
||
8609 | |||
8610 | DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8611 | auto *A = new (Ctx) DLLExportStaticLocalAttr(Ctx, CommonInfo); |
||
8612 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8613 | A->setAttributeSpellingListIndex(0); |
||
8614 | return A; |
||
8615 | } |
||
8616 | |||
8617 | DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8618 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8619 | return CreateImplicit(Ctx, I); |
||
8620 | } |
||
8621 | |||
8622 | DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8623 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8624 | return Create(Ctx, I); |
||
8625 | } |
||
8626 | |||
8627 | DLLExportStaticLocalAttr::DLLExportStaticLocalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8628 | ) |
||
8629 | : InheritableAttr(Ctx, CommonInfo, attr::DLLExportStaticLocal, false, false) |
||
8630 | { |
||
8631 | } |
||
8632 | |||
8633 | DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::clone(ASTContext &C) const { |
||
8634 | auto *A = new (C) DLLExportStaticLocalAttr(C, *this); |
||
8635 | A->Inherited = Inherited; |
||
8636 | A->IsPackExpansion = IsPackExpansion; |
||
8637 | A->setImplicit(Implicit); |
||
8638 | return A; |
||
8639 | } |
||
8640 | |||
8641 | void DLLExportStaticLocalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8642 | } |
||
8643 | |||
8644 | const char *DLLExportStaticLocalAttr::getSpelling() const { |
||
8645 | return "(No spelling)"; |
||
8646 | } |
||
8647 | |||
8648 | |||
8649 | // DLLImportAttr implementation |
||
8650 | |||
8651 | DLLImportAttr *DLLImportAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8652 | auto *A = new (Ctx) DLLImportAttr(Ctx, CommonInfo); |
||
8653 | A->setImplicit(true); |
||
8654 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8655 | A->setAttributeSpellingListIndex(0); |
||
8656 | return A; |
||
8657 | } |
||
8658 | |||
8659 | DLLImportAttr *DLLImportAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8660 | auto *A = new (Ctx) DLLImportAttr(Ctx, CommonInfo); |
||
8661 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8662 | A->setAttributeSpellingListIndex(0); |
||
8663 | return A; |
||
8664 | } |
||
8665 | |||
8666 | DLLImportAttr *DLLImportAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8667 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8668 | return CreateImplicit(Ctx, I); |
||
8669 | } |
||
8670 | |||
8671 | DLLImportAttr *DLLImportAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8672 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8673 | return Create(Ctx, I); |
||
8674 | } |
||
8675 | |||
8676 | DLLImportAttr::DLLImportAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8677 | ) |
||
8678 | : InheritableAttr(Ctx, CommonInfo, attr::DLLImport, false, false) |
||
8679 | { |
||
8680 | } |
||
8681 | |||
8682 | DLLImportAttr *DLLImportAttr::clone(ASTContext &C) const { |
||
8683 | auto *A = new (C) DLLImportAttr(C, *this); |
||
8684 | A->Inherited = Inherited; |
||
8685 | A->IsPackExpansion = IsPackExpansion; |
||
8686 | A->setImplicit(Implicit); |
||
8687 | return A; |
||
8688 | } |
||
8689 | |||
8690 | void DLLImportAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8691 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8692 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8693 | switch (getAttributeSpellingListIndex()) { |
||
8694 | default: |
||
8695 | llvm_unreachable("Unknown attribute spelling!"); |
||
8696 | break; |
||
8697 | case 0 : { |
||
8698 | OS << " __declspec(dllimport"; |
||
8699 | OS << ")"; |
||
8700 | break; |
||
8701 | } |
||
8702 | case 1 : { |
||
8703 | OS << " __attribute__((dllimport"; |
||
8704 | OS << "))"; |
||
8705 | break; |
||
8706 | } |
||
8707 | case 2 : { |
||
8708 | OS << " [[gnu::dllimport"; |
||
8709 | OS << "]]"; |
||
8710 | break; |
||
8711 | } |
||
8712 | case 3 : { |
||
8713 | OS << " [[gnu::dllimport"; |
||
8714 | OS << "]]"; |
||
8715 | break; |
||
8716 | } |
||
8717 | } |
||
8718 | } |
||
8719 | |||
8720 | const char *DLLImportAttr::getSpelling() const { |
||
8721 | switch (getAttributeSpellingListIndex()) { |
||
8722 | default: |
||
8723 | llvm_unreachable("Unknown attribute spelling!"); |
||
8724 | return "(No spelling)"; |
||
8725 | case 0: |
||
8726 | return "dllimport"; |
||
8727 | case 1: |
||
8728 | return "dllimport"; |
||
8729 | case 2: |
||
8730 | return "dllimport"; |
||
8731 | case 3: |
||
8732 | return "dllimport"; |
||
8733 | } |
||
8734 | } |
||
8735 | |||
8736 | |||
8737 | // DLLImportStaticLocalAttr implementation |
||
8738 | |||
8739 | DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8740 | auto *A = new (Ctx) DLLImportStaticLocalAttr(Ctx, CommonInfo); |
||
8741 | A->setImplicit(true); |
||
8742 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8743 | A->setAttributeSpellingListIndex(0); |
||
8744 | return A; |
||
8745 | } |
||
8746 | |||
8747 | DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
8748 | auto *A = new (Ctx) DLLImportStaticLocalAttr(Ctx, CommonInfo); |
||
8749 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8750 | A->setAttributeSpellingListIndex(0); |
||
8751 | return A; |
||
8752 | } |
||
8753 | |||
8754 | DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8755 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8756 | return CreateImplicit(Ctx, I); |
||
8757 | } |
||
8758 | |||
8759 | DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8760 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8761 | return Create(Ctx, I); |
||
8762 | } |
||
8763 | |||
8764 | DLLImportStaticLocalAttr::DLLImportStaticLocalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8765 | ) |
||
8766 | : InheritableAttr(Ctx, CommonInfo, attr::DLLImportStaticLocal, false, false) |
||
8767 | { |
||
8768 | } |
||
8769 | |||
8770 | DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::clone(ASTContext &C) const { |
||
8771 | auto *A = new (C) DLLImportStaticLocalAttr(C, *this); |
||
8772 | A->Inherited = Inherited; |
||
8773 | A->IsPackExpansion = IsPackExpansion; |
||
8774 | A->setImplicit(Implicit); |
||
8775 | return A; |
||
8776 | } |
||
8777 | |||
8778 | void DLLImportStaticLocalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8779 | } |
||
8780 | |||
8781 | const char *DLLImportStaticLocalAttr::getSpelling() const { |
||
8782 | return "(No spelling)"; |
||
8783 | } |
||
8784 | |||
8785 | |||
8786 | // DeprecatedAttr implementation |
||
8787 | |||
8788 | DeprecatedAttr *DeprecatedAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, const AttributeCommonInfo &CommonInfo) { |
||
8789 | auto *A = new (Ctx) DeprecatedAttr(Ctx, CommonInfo, Message, Replacement); |
||
8790 | A->setImplicit(true); |
||
8791 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8792 | A->setAttributeSpellingListIndex(0); |
||
8793 | return A; |
||
8794 | } |
||
8795 | |||
8796 | DeprecatedAttr *DeprecatedAttr::Create(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, const AttributeCommonInfo &CommonInfo) { |
||
8797 | auto *A = new (Ctx) DeprecatedAttr(Ctx, CommonInfo, Message, Replacement); |
||
8798 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8799 | A->setAttributeSpellingListIndex(0); |
||
8800 | return A; |
||
8801 | } |
||
8802 | |||
8803 | DeprecatedAttr *DeprecatedAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8804 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8805 | return CreateImplicit(Ctx, Message, Replacement, I); |
||
8806 | } |
||
8807 | |||
8808 | DeprecatedAttr *DeprecatedAttr::Create(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8809 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8810 | return Create(Ctx, Message, Replacement, I); |
||
8811 | } |
||
8812 | |||
8813 | DeprecatedAttr::DeprecatedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8814 | , llvm::StringRef Message |
||
8815 | , llvm::StringRef Replacement |
||
8816 | ) |
||
8817 | : InheritableAttr(Ctx, CommonInfo, attr::Deprecated, false, false) |
||
8818 | , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) |
||
8819 | , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength]) |
||
8820 | { |
||
8821 | if (!Message.empty()) |
||
8822 | std::memcpy(message, Message.data(), messageLength); |
||
8823 | if (!Replacement.empty()) |
||
8824 | std::memcpy(replacement, Replacement.data(), replacementLength); |
||
8825 | } |
||
8826 | |||
8827 | DeprecatedAttr::DeprecatedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8828 | ) |
||
8829 | : InheritableAttr(Ctx, CommonInfo, attr::Deprecated, false, false) |
||
8830 | , messageLength(0),message(nullptr) |
||
8831 | , replacementLength(0),replacement(nullptr) |
||
8832 | { |
||
8833 | } |
||
8834 | |||
8835 | |||
8836 | |||
8837 | |||
8838 | |||
8839 | DeprecatedAttr *DeprecatedAttr::clone(ASTContext &C) const { |
||
8840 | auto *A = new (C) DeprecatedAttr(C, *this, getMessage(), getReplacement()); |
||
8841 | A->Inherited = Inherited; |
||
8842 | A->IsPackExpansion = IsPackExpansion; |
||
8843 | A->setImplicit(Implicit); |
||
8844 | return A; |
||
8845 | } |
||
8846 | |||
8847 | void DeprecatedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8848 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8849 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8850 | switch (getAttributeSpellingListIndex()) { |
||
8851 | default: |
||
8852 | llvm_unreachable("Unknown attribute spelling!"); |
||
8853 | break; |
||
8854 | case 0 : { |
||
8855 | OS << " __attribute__((deprecated"; |
||
8856 | OS << "(\"" << getMessage() << "\""; |
||
8857 | if (!getReplacement().empty()) OS << ", \"" << getReplacement() << "\""; |
||
8858 | OS << ")"; |
||
8859 | OS << "))"; |
||
8860 | break; |
||
8861 | } |
||
8862 | case 1 : { |
||
8863 | OS << " [[gnu::deprecated"; |
||
8864 | OS << "(\"" << getMessage() << "\""; |
||
8865 | OS << ")"; |
||
8866 | OS << "]]"; |
||
8867 | break; |
||
8868 | } |
||
8869 | case 2 : { |
||
8870 | OS << " [[gnu::deprecated"; |
||
8871 | OS << "(\"" << getMessage() << "\""; |
||
8872 | OS << ")"; |
||
8873 | OS << "]]"; |
||
8874 | break; |
||
8875 | } |
||
8876 | case 3 : { |
||
8877 | OS << " __declspec(deprecated"; |
||
8878 | OS << "(\"" << getMessage() << "\""; |
||
8879 | OS << ")"; |
||
8880 | OS << ")"; |
||
8881 | break; |
||
8882 | } |
||
8883 | case 4 : { |
||
8884 | OS << " [[deprecated"; |
||
8885 | OS << "(\"" << getMessage() << "\""; |
||
8886 | OS << ")"; |
||
8887 | OS << "]]"; |
||
8888 | break; |
||
8889 | } |
||
8890 | case 5 : { |
||
8891 | OS << " [[deprecated"; |
||
8892 | OS << "(\"" << getMessage() << "\""; |
||
8893 | OS << ")"; |
||
8894 | OS << "]]"; |
||
8895 | break; |
||
8896 | } |
||
8897 | } |
||
8898 | } |
||
8899 | |||
8900 | const char *DeprecatedAttr::getSpelling() const { |
||
8901 | switch (getAttributeSpellingListIndex()) { |
||
8902 | default: |
||
8903 | llvm_unreachable("Unknown attribute spelling!"); |
||
8904 | return "(No spelling)"; |
||
8905 | case 0: |
||
8906 | return "deprecated"; |
||
8907 | case 1: |
||
8908 | return "deprecated"; |
||
8909 | case 2: |
||
8910 | return "deprecated"; |
||
8911 | case 3: |
||
8912 | return "deprecated"; |
||
8913 | case 4: |
||
8914 | return "deprecated"; |
||
8915 | case 5: |
||
8916 | return "deprecated"; |
||
8917 | } |
||
8918 | } |
||
8919 | |||
8920 | |||
8921 | // DestructorAttr implementation |
||
8922 | |||
8923 | DestructorAttr *DestructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) { |
||
8924 | auto *A = new (Ctx) DestructorAttr(Ctx, CommonInfo, Priority); |
||
8925 | A->setImplicit(true); |
||
8926 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8927 | A->setAttributeSpellingListIndex(0); |
||
8928 | return A; |
||
8929 | } |
||
8930 | |||
8931 | DestructorAttr *DestructorAttr::Create(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) { |
||
8932 | auto *A = new (Ctx) DestructorAttr(Ctx, CommonInfo, Priority); |
||
8933 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
8934 | A->setAttributeSpellingListIndex(0); |
||
8935 | return A; |
||
8936 | } |
||
8937 | |||
8938 | DestructorAttr *DestructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8939 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8940 | return CreateImplicit(Ctx, Priority, I); |
||
8941 | } |
||
8942 | |||
8943 | DestructorAttr *DestructorAttr::Create(ASTContext &Ctx, int Priority, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
8944 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
8945 | return Create(Ctx, Priority, I); |
||
8946 | } |
||
8947 | |||
8948 | DestructorAttr::DestructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8949 | , int Priority |
||
8950 | ) |
||
8951 | : InheritableAttr(Ctx, CommonInfo, attr::Destructor, false, false) |
||
8952 | , priority(Priority) |
||
8953 | { |
||
8954 | } |
||
8955 | |||
8956 | DestructorAttr::DestructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
8957 | ) |
||
8958 | : InheritableAttr(Ctx, CommonInfo, attr::Destructor, false, false) |
||
8959 | , priority() |
||
8960 | { |
||
8961 | } |
||
8962 | |||
8963 | |||
8964 | |||
8965 | DestructorAttr *DestructorAttr::clone(ASTContext &C) const { |
||
8966 | auto *A = new (C) DestructorAttr(C, *this, priority); |
||
8967 | A->Inherited = Inherited; |
||
8968 | A->IsPackExpansion = IsPackExpansion; |
||
8969 | A->setImplicit(Implicit); |
||
8970 | return A; |
||
8971 | } |
||
8972 | |||
8973 | void DestructorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
8974 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
8975 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
8976 | switch (getAttributeSpellingListIndex()) { |
||
8977 | default: |
||
8978 | llvm_unreachable("Unknown attribute spelling!"); |
||
8979 | break; |
||
8980 | case 0 : { |
||
8981 | OS << " __attribute__((destructor"; |
||
8982 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
8983 | OS << "" << getPriority() << ""; |
||
8984 | if (!IsFirstArgument) |
||
8985 | OS << ")"; |
||
8986 | OS << "))"; |
||
8987 | break; |
||
8988 | } |
||
8989 | case 1 : { |
||
8990 | OS << " [[gnu::destructor"; |
||
8991 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
8992 | OS << "" << getPriority() << ""; |
||
8993 | if (!IsFirstArgument) |
||
8994 | OS << ")"; |
||
8995 | OS << "]]"; |
||
8996 | break; |
||
8997 | } |
||
8998 | case 2 : { |
||
8999 | OS << " [[gnu::destructor"; |
||
9000 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9001 | OS << "" << getPriority() << ""; |
||
9002 | if (!IsFirstArgument) |
||
9003 | OS << ")"; |
||
9004 | OS << "]]"; |
||
9005 | break; |
||
9006 | } |
||
9007 | } |
||
9008 | } |
||
9009 | |||
9010 | const char *DestructorAttr::getSpelling() const { |
||
9011 | switch (getAttributeSpellingListIndex()) { |
||
9012 | default: |
||
9013 | llvm_unreachable("Unknown attribute spelling!"); |
||
9014 | return "(No spelling)"; |
||
9015 | case 0: |
||
9016 | return "destructor"; |
||
9017 | case 1: |
||
9018 | return "destructor"; |
||
9019 | case 2: |
||
9020 | return "destructor"; |
||
9021 | } |
||
9022 | } |
||
9023 | |||
9024 | |||
9025 | // DiagnoseAsBuiltinAttr implementation |
||
9026 | |||
9027 | DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, const AttributeCommonInfo &CommonInfo) { |
||
9028 | auto *A = new (Ctx) DiagnoseAsBuiltinAttr(Ctx, CommonInfo, Function, ArgIndices, ArgIndicesSize); |
||
9029 | A->setImplicit(true); |
||
9030 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9031 | A->setAttributeSpellingListIndex(0); |
||
9032 | return A; |
||
9033 | } |
||
9034 | |||
9035 | DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::Create(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, const AttributeCommonInfo &CommonInfo) { |
||
9036 | auto *A = new (Ctx) DiagnoseAsBuiltinAttr(Ctx, CommonInfo, Function, ArgIndices, ArgIndicesSize); |
||
9037 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9038 | A->setAttributeSpellingListIndex(0); |
||
9039 | return A; |
||
9040 | } |
||
9041 | |||
9042 | DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9043 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9044 | return CreateImplicit(Ctx, Function, ArgIndices, ArgIndicesSize, I); |
||
9045 | } |
||
9046 | |||
9047 | DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::Create(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9048 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9049 | return Create(Ctx, Function, ArgIndices, ArgIndicesSize, I); |
||
9050 | } |
||
9051 | |||
9052 | DiagnoseAsBuiltinAttr::DiagnoseAsBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9053 | , FunctionDecl * Function |
||
9054 | , unsigned *ArgIndices, unsigned ArgIndicesSize |
||
9055 | ) |
||
9056 | : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseAsBuiltin, false, false) |
||
9057 | , function(Function) |
||
9058 | , argIndices_Size(ArgIndicesSize), argIndices_(new (Ctx, 16) unsigned[argIndices_Size]) |
||
9059 | { |
||
9060 | std::copy(ArgIndices, ArgIndices + argIndices_Size, argIndices_); |
||
9061 | } |
||
9062 | |||
9063 | DiagnoseAsBuiltinAttr::DiagnoseAsBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9064 | , FunctionDecl * Function |
||
9065 | ) |
||
9066 | : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseAsBuiltin, false, false) |
||
9067 | , function(Function) |
||
9068 | , argIndices_Size(0), argIndices_(nullptr) |
||
9069 | { |
||
9070 | } |
||
9071 | |||
9072 | |||
9073 | |||
9074 | |||
9075 | |||
9076 | DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::clone(ASTContext &C) const { |
||
9077 | auto *A = new (C) DiagnoseAsBuiltinAttr(C, *this, function, argIndices_, argIndices_Size); |
||
9078 | A->Inherited = Inherited; |
||
9079 | A->IsPackExpansion = IsPackExpansion; |
||
9080 | A->setImplicit(Implicit); |
||
9081 | return A; |
||
9082 | } |
||
9083 | |||
9084 | void DiagnoseAsBuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9085 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9086 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
9087 | switch (getAttributeSpellingListIndex()) { |
||
9088 | default: |
||
9089 | llvm_unreachable("Unknown attribute spelling!"); |
||
9090 | break; |
||
9091 | case 0 : { |
||
9092 | OS << " __attribute__((diagnose_as_builtin"; |
||
9093 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9094 | OS << "" << getFunction()->getNameInfo().getAsString() << ""; |
||
9095 | OS << ""; |
||
9096 | for (const auto &Val : argIndices()) { |
||
9097 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9098 | OS << Val; |
||
9099 | } |
||
9100 | OS << ""; |
||
9101 | if (!IsFirstArgument) |
||
9102 | OS << ")"; |
||
9103 | OS << "))"; |
||
9104 | break; |
||
9105 | } |
||
9106 | case 1 : { |
||
9107 | OS << " [[clang::diagnose_as_builtin"; |
||
9108 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9109 | OS << "" << getFunction()->getNameInfo().getAsString() << ""; |
||
9110 | OS << ""; |
||
9111 | for (const auto &Val : argIndices()) { |
||
9112 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9113 | OS << Val; |
||
9114 | } |
||
9115 | OS << ""; |
||
9116 | if (!IsFirstArgument) |
||
9117 | OS << ")"; |
||
9118 | OS << "]]"; |
||
9119 | break; |
||
9120 | } |
||
9121 | case 2 : { |
||
9122 | OS << " [[clang::diagnose_as_builtin"; |
||
9123 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9124 | OS << "" << getFunction()->getNameInfo().getAsString() << ""; |
||
9125 | OS << ""; |
||
9126 | for (const auto &Val : argIndices()) { |
||
9127 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9128 | OS << Val; |
||
9129 | } |
||
9130 | OS << ""; |
||
9131 | if (!IsFirstArgument) |
||
9132 | OS << ")"; |
||
9133 | OS << "]]"; |
||
9134 | break; |
||
9135 | } |
||
9136 | } |
||
9137 | } |
||
9138 | |||
9139 | const char *DiagnoseAsBuiltinAttr::getSpelling() const { |
||
9140 | switch (getAttributeSpellingListIndex()) { |
||
9141 | default: |
||
9142 | llvm_unreachable("Unknown attribute spelling!"); |
||
9143 | return "(No spelling)"; |
||
9144 | case 0: |
||
9145 | return "diagnose_as_builtin"; |
||
9146 | case 1: |
||
9147 | return "diagnose_as_builtin"; |
||
9148 | case 2: |
||
9149 | return "diagnose_as_builtin"; |
||
9150 | } |
||
9151 | } |
||
9152 | |||
9153 | |||
9154 | // DiagnoseIfAttr implementation |
||
9155 | |||
9156 | DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, const AttributeCommonInfo &CommonInfo) { |
||
9157 | auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DiagnosticType, ArgDependent, Parent); |
||
9158 | A->setImplicit(true); |
||
9159 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9160 | A->setAttributeSpellingListIndex(0); |
||
9161 | return A; |
||
9162 | } |
||
9163 | |||
9164 | DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, const AttributeCommonInfo &CommonInfo) { |
||
9165 | auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DiagnosticType, ArgDependent, Parent); |
||
9166 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9167 | A->setAttributeSpellingListIndex(0); |
||
9168 | return A; |
||
9169 | } |
||
9170 | |||
9171 | DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9172 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9173 | return CreateImplicit(Ctx, Cond, Message, DiagnosticType, ArgDependent, Parent, I); |
||
9174 | } |
||
9175 | |||
9176 | DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9177 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9178 | return Create(Ctx, Cond, Message, DiagnosticType, ArgDependent, Parent, I); |
||
9179 | } |
||
9180 | |||
9181 | DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, const AttributeCommonInfo &CommonInfo) { |
||
9182 | auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DiagnosticType); |
||
9183 | A->setImplicit(true); |
||
9184 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9185 | A->setAttributeSpellingListIndex(0); |
||
9186 | return A; |
||
9187 | } |
||
9188 | |||
9189 | DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, const AttributeCommonInfo &CommonInfo) { |
||
9190 | auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DiagnosticType); |
||
9191 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9192 | A->setAttributeSpellingListIndex(0); |
||
9193 | return A; |
||
9194 | } |
||
9195 | |||
9196 | DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9197 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9198 | return CreateImplicit(Ctx, Cond, Message, DiagnosticType, I); |
||
9199 | } |
||
9200 | |||
9201 | DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9202 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9203 | return Create(Ctx, Cond, Message, DiagnosticType, I); |
||
9204 | } |
||
9205 | |||
9206 | DiagnoseIfAttr::DiagnoseIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9207 | , Expr * Cond |
||
9208 | , llvm::StringRef Message |
||
9209 | , DiagnosticType DiagnosticType |
||
9210 | , bool ArgDependent |
||
9211 | , NamedDecl * Parent |
||
9212 | ) |
||
9213 | : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseIf, true, true) |
||
9214 | , cond(Cond) |
||
9215 | , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) |
||
9216 | , diagnosticType(DiagnosticType) |
||
9217 | , argDependent(ArgDependent) |
||
9218 | , parent(Parent) |
||
9219 | { |
||
9220 | if (!Message.empty()) |
||
9221 | std::memcpy(message, Message.data(), messageLength); |
||
9222 | } |
||
9223 | |||
9224 | DiagnoseIfAttr::DiagnoseIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9225 | , Expr * Cond |
||
9226 | , llvm::StringRef Message |
||
9227 | , DiagnosticType DiagnosticType |
||
9228 | ) |
||
9229 | : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseIf, true, true) |
||
9230 | , cond(Cond) |
||
9231 | , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) |
||
9232 | , diagnosticType(DiagnosticType) |
||
9233 | , argDependent() |
||
9234 | , parent() |
||
9235 | { |
||
9236 | if (!Message.empty()) |
||
9237 | std::memcpy(message, Message.data(), messageLength); |
||
9238 | } |
||
9239 | |||
9240 | |||
9241 | |||
9242 | |||
9243 | |||
9244 | |||
9245 | |||
9246 | bool DiagnoseIfAttr::ConvertStrToDiagnosticType(StringRef Val, DiagnosticType &Out) { |
||
9247 | std::optional<DiagnosticType> R = llvm::StringSwitch<std::optional<DiagnosticType>>(Val) |
||
9248 | .Case("error", DiagnoseIfAttr::DT_Error) |
||
9249 | .Case("warning", DiagnoseIfAttr::DT_Warning) |
||
9250 | .Default(std::optional<DiagnosticType>()); |
||
9251 | if (R) { |
||
9252 | Out = *R; |
||
9253 | return true; |
||
9254 | } |
||
9255 | return false; |
||
9256 | } |
||
9257 | |||
9258 | const char *DiagnoseIfAttr::ConvertDiagnosticTypeToStr(DiagnosticType Val) { |
||
9259 | switch(Val) { |
||
9260 | case DiagnoseIfAttr::DT_Error: return "error"; |
||
9261 | case DiagnoseIfAttr::DT_Warning: return "warning"; |
||
9262 | } |
||
9263 | llvm_unreachable("No enumerator with that value"); |
||
9264 | } |
||
9265 | |||
9266 | |||
9267 | |||
9268 | |||
9269 | DiagnoseIfAttr *DiagnoseIfAttr::clone(ASTContext &C) const { |
||
9270 | auto *A = new (C) DiagnoseIfAttr(C, *this, cond, getMessage(), diagnosticType, argDependent, parent); |
||
9271 | A->Inherited = Inherited; |
||
9272 | A->IsPackExpansion = IsPackExpansion; |
||
9273 | A->setImplicit(Implicit); |
||
9274 | return A; |
||
9275 | } |
||
9276 | |||
9277 | void DiagnoseIfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9278 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9279 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
9280 | switch (getAttributeSpellingListIndex()) { |
||
9281 | default: |
||
9282 | llvm_unreachable("Unknown attribute spelling!"); |
||
9283 | break; |
||
9284 | case 0 : { |
||
9285 | OS << " __attribute__((diagnose_if"; |
||
9286 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9287 | OS << ""; |
||
9288 | getCond()->printPretty(OS, nullptr, Policy); |
||
9289 | OS << ""; |
||
9290 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9291 | OS << "\"" << getMessage() << "\""; |
||
9292 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9293 | OS << "\"" << DiagnoseIfAttr::ConvertDiagnosticTypeToStr(getDiagnosticType()) << "\""; |
||
9294 | if (!IsFirstArgument) |
||
9295 | OS << ")"; |
||
9296 | OS << "))"; |
||
9297 | break; |
||
9298 | } |
||
9299 | } |
||
9300 | } |
||
9301 | |||
9302 | const char *DiagnoseIfAttr::getSpelling() const { |
||
9303 | switch (getAttributeSpellingListIndex()) { |
||
9304 | default: |
||
9305 | llvm_unreachable("Unknown attribute spelling!"); |
||
9306 | return "(No spelling)"; |
||
9307 | case 0: |
||
9308 | return "diagnose_if"; |
||
9309 | } |
||
9310 | } |
||
9311 | |||
9312 | |||
9313 | // DisableSanitizerInstrumentationAttr implementation |
||
9314 | |||
9315 | DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
9316 | auto *A = new (Ctx) DisableSanitizerInstrumentationAttr(Ctx, CommonInfo); |
||
9317 | A->setImplicit(true); |
||
9318 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9319 | A->setAttributeSpellingListIndex(0); |
||
9320 | return A; |
||
9321 | } |
||
9322 | |||
9323 | DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
9324 | auto *A = new (Ctx) DisableSanitizerInstrumentationAttr(Ctx, CommonInfo); |
||
9325 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9326 | A->setAttributeSpellingListIndex(0); |
||
9327 | return A; |
||
9328 | } |
||
9329 | |||
9330 | DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9331 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9332 | return CreateImplicit(Ctx, I); |
||
9333 | } |
||
9334 | |||
9335 | DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9336 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9337 | return Create(Ctx, I); |
||
9338 | } |
||
9339 | |||
9340 | DisableSanitizerInstrumentationAttr::DisableSanitizerInstrumentationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9341 | ) |
||
9342 | : InheritableAttr(Ctx, CommonInfo, attr::DisableSanitizerInstrumentation, false, false) |
||
9343 | { |
||
9344 | } |
||
9345 | |||
9346 | DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::clone(ASTContext &C) const { |
||
9347 | auto *A = new (C) DisableSanitizerInstrumentationAttr(C, *this); |
||
9348 | A->Inherited = Inherited; |
||
9349 | A->IsPackExpansion = IsPackExpansion; |
||
9350 | A->setImplicit(Implicit); |
||
9351 | return A; |
||
9352 | } |
||
9353 | |||
9354 | void DisableSanitizerInstrumentationAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9355 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9356 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
9357 | switch (getAttributeSpellingListIndex()) { |
||
9358 | default: |
||
9359 | llvm_unreachable("Unknown attribute spelling!"); |
||
9360 | break; |
||
9361 | case 0 : { |
||
9362 | OS << " __attribute__((disable_sanitizer_instrumentation"; |
||
9363 | OS << "))"; |
||
9364 | break; |
||
9365 | } |
||
9366 | case 1 : { |
||
9367 | OS << " [[clang::disable_sanitizer_instrumentation"; |
||
9368 | OS << "]]"; |
||
9369 | break; |
||
9370 | } |
||
9371 | case 2 : { |
||
9372 | OS << " [[clang::disable_sanitizer_instrumentation"; |
||
9373 | OS << "]]"; |
||
9374 | break; |
||
9375 | } |
||
9376 | } |
||
9377 | } |
||
9378 | |||
9379 | const char *DisableSanitizerInstrumentationAttr::getSpelling() const { |
||
9380 | switch (getAttributeSpellingListIndex()) { |
||
9381 | default: |
||
9382 | llvm_unreachable("Unknown attribute spelling!"); |
||
9383 | return "(No spelling)"; |
||
9384 | case 0: |
||
9385 | return "disable_sanitizer_instrumentation"; |
||
9386 | case 1: |
||
9387 | return "disable_sanitizer_instrumentation"; |
||
9388 | case 2: |
||
9389 | return "disable_sanitizer_instrumentation"; |
||
9390 | } |
||
9391 | } |
||
9392 | |||
9393 | |||
9394 | // DisableTailCallsAttr implementation |
||
9395 | |||
9396 | DisableTailCallsAttr *DisableTailCallsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
9397 | auto *A = new (Ctx) DisableTailCallsAttr(Ctx, CommonInfo); |
||
9398 | A->setImplicit(true); |
||
9399 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9400 | A->setAttributeSpellingListIndex(0); |
||
9401 | return A; |
||
9402 | } |
||
9403 | |||
9404 | DisableTailCallsAttr *DisableTailCallsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
9405 | auto *A = new (Ctx) DisableTailCallsAttr(Ctx, CommonInfo); |
||
9406 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9407 | A->setAttributeSpellingListIndex(0); |
||
9408 | return A; |
||
9409 | } |
||
9410 | |||
9411 | DisableTailCallsAttr *DisableTailCallsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9412 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9413 | return CreateImplicit(Ctx, I); |
||
9414 | } |
||
9415 | |||
9416 | DisableTailCallsAttr *DisableTailCallsAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9417 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9418 | return Create(Ctx, I); |
||
9419 | } |
||
9420 | |||
9421 | DisableTailCallsAttr::DisableTailCallsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9422 | ) |
||
9423 | : InheritableAttr(Ctx, CommonInfo, attr::DisableTailCalls, false, false) |
||
9424 | { |
||
9425 | } |
||
9426 | |||
9427 | DisableTailCallsAttr *DisableTailCallsAttr::clone(ASTContext &C) const { |
||
9428 | auto *A = new (C) DisableTailCallsAttr(C, *this); |
||
9429 | A->Inherited = Inherited; |
||
9430 | A->IsPackExpansion = IsPackExpansion; |
||
9431 | A->setImplicit(Implicit); |
||
9432 | return A; |
||
9433 | } |
||
9434 | |||
9435 | void DisableTailCallsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9436 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9437 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
9438 | switch (getAttributeSpellingListIndex()) { |
||
9439 | default: |
||
9440 | llvm_unreachable("Unknown attribute spelling!"); |
||
9441 | break; |
||
9442 | case 0 : { |
||
9443 | OS << " __attribute__((disable_tail_calls"; |
||
9444 | OS << "))"; |
||
9445 | break; |
||
9446 | } |
||
9447 | case 1 : { |
||
9448 | OS << " [[clang::disable_tail_calls"; |
||
9449 | OS << "]]"; |
||
9450 | break; |
||
9451 | } |
||
9452 | case 2 : { |
||
9453 | OS << " [[clang::disable_tail_calls"; |
||
9454 | OS << "]]"; |
||
9455 | break; |
||
9456 | } |
||
9457 | } |
||
9458 | } |
||
9459 | |||
9460 | const char *DisableTailCallsAttr::getSpelling() const { |
||
9461 | switch (getAttributeSpellingListIndex()) { |
||
9462 | default: |
||
9463 | llvm_unreachable("Unknown attribute spelling!"); |
||
9464 | return "(No spelling)"; |
||
9465 | case 0: |
||
9466 | return "disable_tail_calls"; |
||
9467 | case 1: |
||
9468 | return "disable_tail_calls"; |
||
9469 | case 2: |
||
9470 | return "disable_tail_calls"; |
||
9471 | } |
||
9472 | } |
||
9473 | |||
9474 | |||
9475 | // EmptyBasesAttr implementation |
||
9476 | |||
9477 | EmptyBasesAttr *EmptyBasesAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
9478 | auto *A = new (Ctx) EmptyBasesAttr(Ctx, CommonInfo); |
||
9479 | A->setImplicit(true); |
||
9480 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9481 | A->setAttributeSpellingListIndex(0); |
||
9482 | return A; |
||
9483 | } |
||
9484 | |||
9485 | EmptyBasesAttr *EmptyBasesAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
9486 | auto *A = new (Ctx) EmptyBasesAttr(Ctx, CommonInfo); |
||
9487 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9488 | A->setAttributeSpellingListIndex(0); |
||
9489 | return A; |
||
9490 | } |
||
9491 | |||
9492 | EmptyBasesAttr *EmptyBasesAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9493 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9494 | return CreateImplicit(Ctx, I); |
||
9495 | } |
||
9496 | |||
9497 | EmptyBasesAttr *EmptyBasesAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9498 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9499 | return Create(Ctx, I); |
||
9500 | } |
||
9501 | |||
9502 | EmptyBasesAttr::EmptyBasesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9503 | ) |
||
9504 | : InheritableAttr(Ctx, CommonInfo, attr::EmptyBases, false, false) |
||
9505 | { |
||
9506 | } |
||
9507 | |||
9508 | EmptyBasesAttr *EmptyBasesAttr::clone(ASTContext &C) const { |
||
9509 | auto *A = new (C) EmptyBasesAttr(C, *this); |
||
9510 | A->Inherited = Inherited; |
||
9511 | A->IsPackExpansion = IsPackExpansion; |
||
9512 | A->setImplicit(Implicit); |
||
9513 | return A; |
||
9514 | } |
||
9515 | |||
9516 | void EmptyBasesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9517 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9518 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
9519 | switch (getAttributeSpellingListIndex()) { |
||
9520 | default: |
||
9521 | llvm_unreachable("Unknown attribute spelling!"); |
||
9522 | break; |
||
9523 | case 0 : { |
||
9524 | OS << " __declspec(empty_bases"; |
||
9525 | OS << ")"; |
||
9526 | break; |
||
9527 | } |
||
9528 | } |
||
9529 | } |
||
9530 | |||
9531 | const char *EmptyBasesAttr::getSpelling() const { |
||
9532 | switch (getAttributeSpellingListIndex()) { |
||
9533 | default: |
||
9534 | llvm_unreachable("Unknown attribute spelling!"); |
||
9535 | return "(No spelling)"; |
||
9536 | case 0: |
||
9537 | return "empty_bases"; |
||
9538 | } |
||
9539 | } |
||
9540 | |||
9541 | |||
9542 | // EnableIfAttr implementation |
||
9543 | |||
9544 | EnableIfAttr *EnableIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { |
||
9545 | auto *A = new (Ctx) EnableIfAttr(Ctx, CommonInfo, Cond, Message); |
||
9546 | A->setImplicit(true); |
||
9547 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9548 | A->setAttributeSpellingListIndex(0); |
||
9549 | return A; |
||
9550 | } |
||
9551 | |||
9552 | EnableIfAttr *EnableIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { |
||
9553 | auto *A = new (Ctx) EnableIfAttr(Ctx, CommonInfo, Cond, Message); |
||
9554 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9555 | A->setAttributeSpellingListIndex(0); |
||
9556 | return A; |
||
9557 | } |
||
9558 | |||
9559 | EnableIfAttr *EnableIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9560 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9561 | return CreateImplicit(Ctx, Cond, Message, I); |
||
9562 | } |
||
9563 | |||
9564 | EnableIfAttr *EnableIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9565 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9566 | return Create(Ctx, Cond, Message, I); |
||
9567 | } |
||
9568 | |||
9569 | EnableIfAttr::EnableIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9570 | , Expr * Cond |
||
9571 | , llvm::StringRef Message |
||
9572 | ) |
||
9573 | : InheritableAttr(Ctx, CommonInfo, attr::EnableIf, false, false) |
||
9574 | , cond(Cond) |
||
9575 | , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) |
||
9576 | { |
||
9577 | if (!Message.empty()) |
||
9578 | std::memcpy(message, Message.data(), messageLength); |
||
9579 | } |
||
9580 | |||
9581 | |||
9582 | |||
9583 | |||
9584 | |||
9585 | EnableIfAttr *EnableIfAttr::clone(ASTContext &C) const { |
||
9586 | auto *A = new (C) EnableIfAttr(C, *this, cond, getMessage()); |
||
9587 | A->Inherited = Inherited; |
||
9588 | A->IsPackExpansion = IsPackExpansion; |
||
9589 | A->setImplicit(Implicit); |
||
9590 | return A; |
||
9591 | } |
||
9592 | |||
9593 | void EnableIfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9594 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9595 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
9596 | switch (getAttributeSpellingListIndex()) { |
||
9597 | default: |
||
9598 | llvm_unreachable("Unknown attribute spelling!"); |
||
9599 | break; |
||
9600 | case 0 : { |
||
9601 | OS << " __attribute__((enable_if"; |
||
9602 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9603 | OS << ""; |
||
9604 | getCond()->printPretty(OS, nullptr, Policy); |
||
9605 | OS << ""; |
||
9606 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9607 | OS << "\"" << getMessage() << "\""; |
||
9608 | if (!IsFirstArgument) |
||
9609 | OS << ")"; |
||
9610 | OS << "))"; |
||
9611 | break; |
||
9612 | } |
||
9613 | } |
||
9614 | } |
||
9615 | |||
9616 | const char *EnableIfAttr::getSpelling() const { |
||
9617 | switch (getAttributeSpellingListIndex()) { |
||
9618 | default: |
||
9619 | llvm_unreachable("Unknown attribute spelling!"); |
||
9620 | return "(No spelling)"; |
||
9621 | case 0: |
||
9622 | return "enable_if"; |
||
9623 | } |
||
9624 | } |
||
9625 | |||
9626 | |||
9627 | // EnforceTCBAttr implementation |
||
9628 | |||
9629 | EnforceTCBAttr *EnforceTCBAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) { |
||
9630 | auto *A = new (Ctx) EnforceTCBAttr(Ctx, CommonInfo, TCBName); |
||
9631 | A->setImplicit(true); |
||
9632 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9633 | A->setAttributeSpellingListIndex(0); |
||
9634 | return A; |
||
9635 | } |
||
9636 | |||
9637 | EnforceTCBAttr *EnforceTCBAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) { |
||
9638 | auto *A = new (Ctx) EnforceTCBAttr(Ctx, CommonInfo, TCBName); |
||
9639 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9640 | A->setAttributeSpellingListIndex(0); |
||
9641 | return A; |
||
9642 | } |
||
9643 | |||
9644 | EnforceTCBAttr *EnforceTCBAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9645 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9646 | return CreateImplicit(Ctx, TCBName, I); |
||
9647 | } |
||
9648 | |||
9649 | EnforceTCBAttr *EnforceTCBAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9650 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9651 | return Create(Ctx, TCBName, I); |
||
9652 | } |
||
9653 | |||
9654 | EnforceTCBAttr::EnforceTCBAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9655 | , llvm::StringRef TCBName |
||
9656 | ) |
||
9657 | : InheritableAttr(Ctx, CommonInfo, attr::EnforceTCB, false, true) |
||
9658 | , tCBNameLength(TCBName.size()),tCBName(new (Ctx, 1) char[tCBNameLength]) |
||
9659 | { |
||
9660 | if (!TCBName.empty()) |
||
9661 | std::memcpy(tCBName, TCBName.data(), tCBNameLength); |
||
9662 | } |
||
9663 | |||
9664 | |||
9665 | |||
9666 | EnforceTCBAttr *EnforceTCBAttr::clone(ASTContext &C) const { |
||
9667 | auto *A = new (C) EnforceTCBAttr(C, *this, getTCBName()); |
||
9668 | A->Inherited = Inherited; |
||
9669 | A->IsPackExpansion = IsPackExpansion; |
||
9670 | A->setImplicit(Implicit); |
||
9671 | return A; |
||
9672 | } |
||
9673 | |||
9674 | void EnforceTCBAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9675 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9676 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
9677 | switch (getAttributeSpellingListIndex()) { |
||
9678 | default: |
||
9679 | llvm_unreachable("Unknown attribute spelling!"); |
||
9680 | break; |
||
9681 | case 0 : { |
||
9682 | OS << " __attribute__((enforce_tcb"; |
||
9683 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9684 | OS << "\"" << getTCBName() << "\""; |
||
9685 | if (!IsFirstArgument) |
||
9686 | OS << ")"; |
||
9687 | OS << "))"; |
||
9688 | break; |
||
9689 | } |
||
9690 | case 1 : { |
||
9691 | OS << " [[clang::enforce_tcb"; |
||
9692 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9693 | OS << "\"" << getTCBName() << "\""; |
||
9694 | if (!IsFirstArgument) |
||
9695 | OS << ")"; |
||
9696 | OS << "]]"; |
||
9697 | break; |
||
9698 | } |
||
9699 | case 2 : { |
||
9700 | OS << " [[clang::enforce_tcb"; |
||
9701 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9702 | OS << "\"" << getTCBName() << "\""; |
||
9703 | if (!IsFirstArgument) |
||
9704 | OS << ")"; |
||
9705 | OS << "]]"; |
||
9706 | break; |
||
9707 | } |
||
9708 | } |
||
9709 | } |
||
9710 | |||
9711 | const char *EnforceTCBAttr::getSpelling() const { |
||
9712 | switch (getAttributeSpellingListIndex()) { |
||
9713 | default: |
||
9714 | llvm_unreachable("Unknown attribute spelling!"); |
||
9715 | return "(No spelling)"; |
||
9716 | case 0: |
||
9717 | return "enforce_tcb"; |
||
9718 | case 1: |
||
9719 | return "enforce_tcb"; |
||
9720 | case 2: |
||
9721 | return "enforce_tcb"; |
||
9722 | } |
||
9723 | } |
||
9724 | |||
9725 | |||
9726 | // EnforceTCBLeafAttr implementation |
||
9727 | |||
9728 | EnforceTCBLeafAttr *EnforceTCBLeafAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) { |
||
9729 | auto *A = new (Ctx) EnforceTCBLeafAttr(Ctx, CommonInfo, TCBName); |
||
9730 | A->setImplicit(true); |
||
9731 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9732 | A->setAttributeSpellingListIndex(0); |
||
9733 | return A; |
||
9734 | } |
||
9735 | |||
9736 | EnforceTCBLeafAttr *EnforceTCBLeafAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) { |
||
9737 | auto *A = new (Ctx) EnforceTCBLeafAttr(Ctx, CommonInfo, TCBName); |
||
9738 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9739 | A->setAttributeSpellingListIndex(0); |
||
9740 | return A; |
||
9741 | } |
||
9742 | |||
9743 | EnforceTCBLeafAttr *EnforceTCBLeafAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9744 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9745 | return CreateImplicit(Ctx, TCBName, I); |
||
9746 | } |
||
9747 | |||
9748 | EnforceTCBLeafAttr *EnforceTCBLeafAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9749 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9750 | return Create(Ctx, TCBName, I); |
||
9751 | } |
||
9752 | |||
9753 | EnforceTCBLeafAttr::EnforceTCBLeafAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9754 | , llvm::StringRef TCBName |
||
9755 | ) |
||
9756 | : InheritableAttr(Ctx, CommonInfo, attr::EnforceTCBLeaf, false, true) |
||
9757 | , tCBNameLength(TCBName.size()),tCBName(new (Ctx, 1) char[tCBNameLength]) |
||
9758 | { |
||
9759 | if (!TCBName.empty()) |
||
9760 | std::memcpy(tCBName, TCBName.data(), tCBNameLength); |
||
9761 | } |
||
9762 | |||
9763 | |||
9764 | |||
9765 | EnforceTCBLeafAttr *EnforceTCBLeafAttr::clone(ASTContext &C) const { |
||
9766 | auto *A = new (C) EnforceTCBLeafAttr(C, *this, getTCBName()); |
||
9767 | A->Inherited = Inherited; |
||
9768 | A->IsPackExpansion = IsPackExpansion; |
||
9769 | A->setImplicit(Implicit); |
||
9770 | return A; |
||
9771 | } |
||
9772 | |||
9773 | void EnforceTCBLeafAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9774 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9775 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
9776 | switch (getAttributeSpellingListIndex()) { |
||
9777 | default: |
||
9778 | llvm_unreachable("Unknown attribute spelling!"); |
||
9779 | break; |
||
9780 | case 0 : { |
||
9781 | OS << " __attribute__((enforce_tcb_leaf"; |
||
9782 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9783 | OS << "\"" << getTCBName() << "\""; |
||
9784 | if (!IsFirstArgument) |
||
9785 | OS << ")"; |
||
9786 | OS << "))"; |
||
9787 | break; |
||
9788 | } |
||
9789 | case 1 : { |
||
9790 | OS << " [[clang::enforce_tcb_leaf"; |
||
9791 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9792 | OS << "\"" << getTCBName() << "\""; |
||
9793 | if (!IsFirstArgument) |
||
9794 | OS << ")"; |
||
9795 | OS << "]]"; |
||
9796 | break; |
||
9797 | } |
||
9798 | case 2 : { |
||
9799 | OS << " [[clang::enforce_tcb_leaf"; |
||
9800 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9801 | OS << "\"" << getTCBName() << "\""; |
||
9802 | if (!IsFirstArgument) |
||
9803 | OS << ")"; |
||
9804 | OS << "]]"; |
||
9805 | break; |
||
9806 | } |
||
9807 | } |
||
9808 | } |
||
9809 | |||
9810 | const char *EnforceTCBLeafAttr::getSpelling() const { |
||
9811 | switch (getAttributeSpellingListIndex()) { |
||
9812 | default: |
||
9813 | llvm_unreachable("Unknown attribute spelling!"); |
||
9814 | return "(No spelling)"; |
||
9815 | case 0: |
||
9816 | return "enforce_tcb_leaf"; |
||
9817 | case 1: |
||
9818 | return "enforce_tcb_leaf"; |
||
9819 | case 2: |
||
9820 | return "enforce_tcb_leaf"; |
||
9821 | } |
||
9822 | } |
||
9823 | |||
9824 | |||
9825 | // EnumExtensibilityAttr implementation |
||
9826 | |||
9827 | EnumExtensibilityAttr *EnumExtensibilityAttr::CreateImplicit(ASTContext &Ctx, Kind Extensibility, const AttributeCommonInfo &CommonInfo) { |
||
9828 | auto *A = new (Ctx) EnumExtensibilityAttr(Ctx, CommonInfo, Extensibility); |
||
9829 | A->setImplicit(true); |
||
9830 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9831 | A->setAttributeSpellingListIndex(0); |
||
9832 | return A; |
||
9833 | } |
||
9834 | |||
9835 | EnumExtensibilityAttr *EnumExtensibilityAttr::Create(ASTContext &Ctx, Kind Extensibility, const AttributeCommonInfo &CommonInfo) { |
||
9836 | auto *A = new (Ctx) EnumExtensibilityAttr(Ctx, CommonInfo, Extensibility); |
||
9837 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9838 | A->setAttributeSpellingListIndex(0); |
||
9839 | return A; |
||
9840 | } |
||
9841 | |||
9842 | EnumExtensibilityAttr *EnumExtensibilityAttr::CreateImplicit(ASTContext &Ctx, Kind Extensibility, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9843 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9844 | return CreateImplicit(Ctx, Extensibility, I); |
||
9845 | } |
||
9846 | |||
9847 | EnumExtensibilityAttr *EnumExtensibilityAttr::Create(ASTContext &Ctx, Kind Extensibility, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
9848 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
9849 | return Create(Ctx, Extensibility, I); |
||
9850 | } |
||
9851 | |||
9852 | EnumExtensibilityAttr::EnumExtensibilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9853 | , Kind Extensibility |
||
9854 | ) |
||
9855 | : InheritableAttr(Ctx, CommonInfo, attr::EnumExtensibility, false, false) |
||
9856 | , extensibility(Extensibility) |
||
9857 | { |
||
9858 | } |
||
9859 | |||
9860 | |||
9861 | |||
9862 | bool EnumExtensibilityAttr::ConvertStrToKind(StringRef Val, Kind &Out) { |
||
9863 | std::optional<Kind> R = llvm::StringSwitch<std::optional<Kind>>(Val) |
||
9864 | .Case("closed", EnumExtensibilityAttr::Closed) |
||
9865 | .Case("open", EnumExtensibilityAttr::Open) |
||
9866 | .Default(std::optional<Kind>()); |
||
9867 | if (R) { |
||
9868 | Out = *R; |
||
9869 | return true; |
||
9870 | } |
||
9871 | return false; |
||
9872 | } |
||
9873 | |||
9874 | const char *EnumExtensibilityAttr::ConvertKindToStr(Kind Val) { |
||
9875 | switch(Val) { |
||
9876 | case EnumExtensibilityAttr::Closed: return "closed"; |
||
9877 | case EnumExtensibilityAttr::Open: return "open"; |
||
9878 | } |
||
9879 | llvm_unreachable("No enumerator with that value"); |
||
9880 | } |
||
9881 | EnumExtensibilityAttr *EnumExtensibilityAttr::clone(ASTContext &C) const { |
||
9882 | auto *A = new (C) EnumExtensibilityAttr(C, *this, extensibility); |
||
9883 | A->Inherited = Inherited; |
||
9884 | A->IsPackExpansion = IsPackExpansion; |
||
9885 | A->setImplicit(Implicit); |
||
9886 | return A; |
||
9887 | } |
||
9888 | |||
9889 | void EnumExtensibilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9890 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9891 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
9892 | switch (getAttributeSpellingListIndex()) { |
||
9893 | default: |
||
9894 | llvm_unreachable("Unknown attribute spelling!"); |
||
9895 | break; |
||
9896 | case 0 : { |
||
9897 | OS << " __attribute__((enum_extensibility"; |
||
9898 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9899 | OS << "\"" << EnumExtensibilityAttr::ConvertKindToStr(getExtensibility()) << "\""; |
||
9900 | if (!IsFirstArgument) |
||
9901 | OS << ")"; |
||
9902 | OS << "))"; |
||
9903 | break; |
||
9904 | } |
||
9905 | case 1 : { |
||
9906 | OS << " [[clang::enum_extensibility"; |
||
9907 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9908 | OS << "\"" << EnumExtensibilityAttr::ConvertKindToStr(getExtensibility()) << "\""; |
||
9909 | if (!IsFirstArgument) |
||
9910 | OS << ")"; |
||
9911 | OS << "]]"; |
||
9912 | break; |
||
9913 | } |
||
9914 | case 2 : { |
||
9915 | OS << " [[clang::enum_extensibility"; |
||
9916 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
9917 | OS << "\"" << EnumExtensibilityAttr::ConvertKindToStr(getExtensibility()) << "\""; |
||
9918 | if (!IsFirstArgument) |
||
9919 | OS << ")"; |
||
9920 | OS << "]]"; |
||
9921 | break; |
||
9922 | } |
||
9923 | } |
||
9924 | } |
||
9925 | |||
9926 | const char *EnumExtensibilityAttr::getSpelling() const { |
||
9927 | switch (getAttributeSpellingListIndex()) { |
||
9928 | default: |
||
9929 | llvm_unreachable("Unknown attribute spelling!"); |
||
9930 | return "(No spelling)"; |
||
9931 | case 0: |
||
9932 | return "enum_extensibility"; |
||
9933 | case 1: |
||
9934 | return "enum_extensibility"; |
||
9935 | case 2: |
||
9936 | return "enum_extensibility"; |
||
9937 | } |
||
9938 | } |
||
9939 | |||
9940 | |||
9941 | // ErrorAttr implementation |
||
9942 | |||
9943 | ErrorAttr *ErrorAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef UserDiagnostic, const AttributeCommonInfo &CommonInfo) { |
||
9944 | auto *A = new (Ctx) ErrorAttr(Ctx, CommonInfo, UserDiagnostic); |
||
9945 | A->setImplicit(true); |
||
9946 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
9947 | A->setAttributeSpellingListIndex(0); |
||
9948 | return A; |
||
9949 | } |
||
9950 | |||
9951 | ErrorAttr *ErrorAttr::Create(ASTContext &Ctx, llvm::StringRef UserDiagnostic, const AttributeCommonInfo &CommonInfo) { |
||
9952 | auto *A = new (Ctx) ErrorAttr(Ctx, CommonInfo, UserDiagnostic); |
||
9953 | return A; |
||
9954 | } |
||
9955 | |||
9956 | ErrorAttr *ErrorAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef UserDiagnostic, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ErrorAttr::Spelling S) { |
||
9957 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
9958 | return CreateImplicit(Ctx, UserDiagnostic, I); |
||
9959 | } |
||
9960 | |||
9961 | ErrorAttr *ErrorAttr::Create(ASTContext &Ctx, llvm::StringRef UserDiagnostic, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ErrorAttr::Spelling S) { |
||
9962 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
9963 | return Create(Ctx, UserDiagnostic, I); |
||
9964 | } |
||
9965 | |||
9966 | ErrorAttr::ErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
9967 | , llvm::StringRef UserDiagnostic |
||
9968 | ) |
||
9969 | : InheritableAttr(Ctx, CommonInfo, attr::Error, false, false) |
||
9970 | , userDiagnosticLength(UserDiagnostic.size()),userDiagnostic(new (Ctx, 1) char[userDiagnosticLength]) |
||
9971 | { |
||
9972 | if (!UserDiagnostic.empty()) |
||
9973 | std::memcpy(userDiagnostic, UserDiagnostic.data(), userDiagnosticLength); |
||
9974 | } |
||
9975 | |||
9976 | ErrorAttr::Spelling ErrorAttr::getSemanticSpelling() const { |
||
9977 | switch (getAttributeSpellingListIndex()) { |
||
9978 | default: llvm_unreachable("Unknown spelling list index"); |
||
9979 | case 0: return GNU_error; |
||
9980 | case 1: return CXX11_gnu_error; |
||
9981 | case 2: return C2x_gnu_error; |
||
9982 | case 3: return GNU_warning; |
||
9983 | case 4: return CXX11_gnu_warning; |
||
9984 | case 5: return C2x_gnu_warning; |
||
9985 | } |
||
9986 | } |
||
9987 | |||
9988 | |||
9989 | ErrorAttr *ErrorAttr::clone(ASTContext &C) const { |
||
9990 | auto *A = new (C) ErrorAttr(C, *this, getUserDiagnostic()); |
||
9991 | A->Inherited = Inherited; |
||
9992 | A->IsPackExpansion = IsPackExpansion; |
||
9993 | A->setImplicit(Implicit); |
||
9994 | return A; |
||
9995 | } |
||
9996 | |||
9997 | void ErrorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
9998 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
9999 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10000 | switch (getAttributeSpellingListIndex()) { |
||
10001 | default: |
||
10002 | llvm_unreachable("Unknown attribute spelling!"); |
||
10003 | break; |
||
10004 | case 0 : { |
||
10005 | OS << " __attribute__((error"; |
||
10006 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10007 | OS << "\"" << getUserDiagnostic() << "\""; |
||
10008 | if (!IsFirstArgument) |
||
10009 | OS << ")"; |
||
10010 | OS << "))"; |
||
10011 | break; |
||
10012 | } |
||
10013 | case 1 : { |
||
10014 | OS << " [[gnu::error"; |
||
10015 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10016 | OS << "\"" << getUserDiagnostic() << "\""; |
||
10017 | if (!IsFirstArgument) |
||
10018 | OS << ")"; |
||
10019 | OS << "]]"; |
||
10020 | break; |
||
10021 | } |
||
10022 | case 2 : { |
||
10023 | OS << " [[gnu::error"; |
||
10024 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10025 | OS << "\"" << getUserDiagnostic() << "\""; |
||
10026 | if (!IsFirstArgument) |
||
10027 | OS << ")"; |
||
10028 | OS << "]]"; |
||
10029 | break; |
||
10030 | } |
||
10031 | case 3 : { |
||
10032 | OS << " __attribute__((warning"; |
||
10033 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10034 | OS << "\"" << getUserDiagnostic() << "\""; |
||
10035 | if (!IsFirstArgument) |
||
10036 | OS << ")"; |
||
10037 | OS << "))"; |
||
10038 | break; |
||
10039 | } |
||
10040 | case 4 : { |
||
10041 | OS << " [[gnu::warning"; |
||
10042 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10043 | OS << "\"" << getUserDiagnostic() << "\""; |
||
10044 | if (!IsFirstArgument) |
||
10045 | OS << ")"; |
||
10046 | OS << "]]"; |
||
10047 | break; |
||
10048 | } |
||
10049 | case 5 : { |
||
10050 | OS << " [[gnu::warning"; |
||
10051 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10052 | OS << "\"" << getUserDiagnostic() << "\""; |
||
10053 | if (!IsFirstArgument) |
||
10054 | OS << ")"; |
||
10055 | OS << "]]"; |
||
10056 | break; |
||
10057 | } |
||
10058 | } |
||
10059 | } |
||
10060 | |||
10061 | const char *ErrorAttr::getSpelling() const { |
||
10062 | switch (getAttributeSpellingListIndex()) { |
||
10063 | default: |
||
10064 | llvm_unreachable("Unknown attribute spelling!"); |
||
10065 | return "(No spelling)"; |
||
10066 | case 0: |
||
10067 | return "error"; |
||
10068 | case 1: |
||
10069 | return "error"; |
||
10070 | case 2: |
||
10071 | return "error"; |
||
10072 | case 3: |
||
10073 | return "warning"; |
||
10074 | case 4: |
||
10075 | return "warning"; |
||
10076 | case 5: |
||
10077 | return "warning"; |
||
10078 | } |
||
10079 | } |
||
10080 | |||
10081 | |||
10082 | // ExcludeFromExplicitInstantiationAttr implementation |
||
10083 | |||
10084 | ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10085 | auto *A = new (Ctx) ExcludeFromExplicitInstantiationAttr(Ctx, CommonInfo); |
||
10086 | A->setImplicit(true); |
||
10087 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10088 | A->setAttributeSpellingListIndex(0); |
||
10089 | return A; |
||
10090 | } |
||
10091 | |||
10092 | ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10093 | auto *A = new (Ctx) ExcludeFromExplicitInstantiationAttr(Ctx, CommonInfo); |
||
10094 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10095 | A->setAttributeSpellingListIndex(0); |
||
10096 | return A; |
||
10097 | } |
||
10098 | |||
10099 | ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10100 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10101 | return CreateImplicit(Ctx, I); |
||
10102 | } |
||
10103 | |||
10104 | ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10105 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10106 | return Create(Ctx, I); |
||
10107 | } |
||
10108 | |||
10109 | ExcludeFromExplicitInstantiationAttr::ExcludeFromExplicitInstantiationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10110 | ) |
||
10111 | : InheritableAttr(Ctx, CommonInfo, attr::ExcludeFromExplicitInstantiation, false, false) |
||
10112 | { |
||
10113 | } |
||
10114 | |||
10115 | ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::clone(ASTContext &C) const { |
||
10116 | auto *A = new (C) ExcludeFromExplicitInstantiationAttr(C, *this); |
||
10117 | A->Inherited = Inherited; |
||
10118 | A->IsPackExpansion = IsPackExpansion; |
||
10119 | A->setImplicit(Implicit); |
||
10120 | return A; |
||
10121 | } |
||
10122 | |||
10123 | void ExcludeFromExplicitInstantiationAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10124 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10125 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10126 | switch (getAttributeSpellingListIndex()) { |
||
10127 | default: |
||
10128 | llvm_unreachable("Unknown attribute spelling!"); |
||
10129 | break; |
||
10130 | case 0 : { |
||
10131 | OS << " __attribute__((exclude_from_explicit_instantiation"; |
||
10132 | OS << "))"; |
||
10133 | break; |
||
10134 | } |
||
10135 | case 1 : { |
||
10136 | OS << " [[clang::exclude_from_explicit_instantiation"; |
||
10137 | OS << "]]"; |
||
10138 | break; |
||
10139 | } |
||
10140 | case 2 : { |
||
10141 | OS << " [[clang::exclude_from_explicit_instantiation"; |
||
10142 | OS << "]]"; |
||
10143 | break; |
||
10144 | } |
||
10145 | } |
||
10146 | } |
||
10147 | |||
10148 | const char *ExcludeFromExplicitInstantiationAttr::getSpelling() const { |
||
10149 | switch (getAttributeSpellingListIndex()) { |
||
10150 | default: |
||
10151 | llvm_unreachable("Unknown attribute spelling!"); |
||
10152 | return "(No spelling)"; |
||
10153 | case 0: |
||
10154 | return "exclude_from_explicit_instantiation"; |
||
10155 | case 1: |
||
10156 | return "exclude_from_explicit_instantiation"; |
||
10157 | case 2: |
||
10158 | return "exclude_from_explicit_instantiation"; |
||
10159 | } |
||
10160 | } |
||
10161 | |||
10162 | |||
10163 | // ExclusiveTrylockFunctionAttr implementation |
||
10164 | |||
10165 | ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
10166 | auto *A = new (Ctx) ExclusiveTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); |
||
10167 | A->setImplicit(true); |
||
10168 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10169 | A->setAttributeSpellingListIndex(0); |
||
10170 | return A; |
||
10171 | } |
||
10172 | |||
10173 | ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
10174 | auto *A = new (Ctx) ExclusiveTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); |
||
10175 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10176 | A->setAttributeSpellingListIndex(0); |
||
10177 | return A; |
||
10178 | } |
||
10179 | |||
10180 | ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10181 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10182 | return CreateImplicit(Ctx, SuccessValue, Args, ArgsSize, I); |
||
10183 | } |
||
10184 | |||
10185 | ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10186 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10187 | return Create(Ctx, SuccessValue, Args, ArgsSize, I); |
||
10188 | } |
||
10189 | |||
10190 | ExclusiveTrylockFunctionAttr::ExclusiveTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10191 | , Expr * SuccessValue |
||
10192 | , Expr * *Args, unsigned ArgsSize |
||
10193 | ) |
||
10194 | : InheritableAttr(Ctx, CommonInfo, attr::ExclusiveTrylockFunction, true, true) |
||
10195 | , successValue(SuccessValue) |
||
10196 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
10197 | { |
||
10198 | std::copy(Args, Args + args_Size, args_); |
||
10199 | } |
||
10200 | |||
10201 | ExclusiveTrylockFunctionAttr::ExclusiveTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10202 | , Expr * SuccessValue |
||
10203 | ) |
||
10204 | : InheritableAttr(Ctx, CommonInfo, attr::ExclusiveTrylockFunction, true, true) |
||
10205 | , successValue(SuccessValue) |
||
10206 | , args_Size(0), args_(nullptr) |
||
10207 | { |
||
10208 | } |
||
10209 | |||
10210 | |||
10211 | |||
10212 | |||
10213 | |||
10214 | ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::clone(ASTContext &C) const { |
||
10215 | auto *A = new (C) ExclusiveTrylockFunctionAttr(C, *this, successValue, args_, args_Size); |
||
10216 | A->Inherited = Inherited; |
||
10217 | A->IsPackExpansion = IsPackExpansion; |
||
10218 | A->setImplicit(Implicit); |
||
10219 | return A; |
||
10220 | } |
||
10221 | |||
10222 | void ExclusiveTrylockFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10223 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10224 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10225 | switch (getAttributeSpellingListIndex()) { |
||
10226 | default: |
||
10227 | llvm_unreachable("Unknown attribute spelling!"); |
||
10228 | break; |
||
10229 | case 0 : { |
||
10230 | OS << " __attribute__((exclusive_trylock_function"; |
||
10231 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10232 | OS << ""; |
||
10233 | getSuccessValue()->printPretty(OS, nullptr, Policy); |
||
10234 | OS << ""; |
||
10235 | OS << ""; |
||
10236 | for (const auto &Val : args()) { |
||
10237 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10238 | OS << Val; |
||
10239 | } |
||
10240 | OS << ""; |
||
10241 | if (!IsFirstArgument) |
||
10242 | OS << ")"; |
||
10243 | OS << "))"; |
||
10244 | break; |
||
10245 | } |
||
10246 | } |
||
10247 | } |
||
10248 | |||
10249 | const char *ExclusiveTrylockFunctionAttr::getSpelling() const { |
||
10250 | switch (getAttributeSpellingListIndex()) { |
||
10251 | default: |
||
10252 | llvm_unreachable("Unknown attribute spelling!"); |
||
10253 | return "(No spelling)"; |
||
10254 | case 0: |
||
10255 | return "exclusive_trylock_function"; |
||
10256 | } |
||
10257 | } |
||
10258 | |||
10259 | |||
10260 | // ExternalSourceSymbolAttr implementation |
||
10261 | |||
10262 | ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, const AttributeCommonInfo &CommonInfo) { |
||
10263 | auto *A = new (Ctx) ExternalSourceSymbolAttr(Ctx, CommonInfo, Language, DefinedIn, GeneratedDeclaration); |
||
10264 | A->setImplicit(true); |
||
10265 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10266 | A->setAttributeSpellingListIndex(0); |
||
10267 | return A; |
||
10268 | } |
||
10269 | |||
10270 | ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::Create(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, const AttributeCommonInfo &CommonInfo) { |
||
10271 | auto *A = new (Ctx) ExternalSourceSymbolAttr(Ctx, CommonInfo, Language, DefinedIn, GeneratedDeclaration); |
||
10272 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10273 | A->setAttributeSpellingListIndex(0); |
||
10274 | return A; |
||
10275 | } |
||
10276 | |||
10277 | ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10278 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10279 | return CreateImplicit(Ctx, Language, DefinedIn, GeneratedDeclaration, I); |
||
10280 | } |
||
10281 | |||
10282 | ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::Create(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10283 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10284 | return Create(Ctx, Language, DefinedIn, GeneratedDeclaration, I); |
||
10285 | } |
||
10286 | |||
10287 | ExternalSourceSymbolAttr::ExternalSourceSymbolAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10288 | , llvm::StringRef Language |
||
10289 | , llvm::StringRef DefinedIn |
||
10290 | , bool GeneratedDeclaration |
||
10291 | ) |
||
10292 | : InheritableAttr(Ctx, CommonInfo, attr::ExternalSourceSymbol, false, false) |
||
10293 | , languageLength(Language.size()),language(new (Ctx, 1) char[languageLength]) |
||
10294 | , definedInLength(DefinedIn.size()),definedIn(new (Ctx, 1) char[definedInLength]) |
||
10295 | , generatedDeclaration(GeneratedDeclaration) |
||
10296 | { |
||
10297 | if (!Language.empty()) |
||
10298 | std::memcpy(language, Language.data(), languageLength); |
||
10299 | if (!DefinedIn.empty()) |
||
10300 | std::memcpy(definedIn, DefinedIn.data(), definedInLength); |
||
10301 | } |
||
10302 | |||
10303 | ExternalSourceSymbolAttr::ExternalSourceSymbolAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10304 | ) |
||
10305 | : InheritableAttr(Ctx, CommonInfo, attr::ExternalSourceSymbol, false, false) |
||
10306 | , languageLength(0),language(nullptr) |
||
10307 | , definedInLength(0),definedIn(nullptr) |
||
10308 | , generatedDeclaration() |
||
10309 | { |
||
10310 | } |
||
10311 | |||
10312 | |||
10313 | |||
10314 | |||
10315 | |||
10316 | |||
10317 | |||
10318 | ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::clone(ASTContext &C) const { |
||
10319 | auto *A = new (C) ExternalSourceSymbolAttr(C, *this, getLanguage(), getDefinedIn(), generatedDeclaration); |
||
10320 | A->Inherited = Inherited; |
||
10321 | A->IsPackExpansion = IsPackExpansion; |
||
10322 | A->setImplicit(Implicit); |
||
10323 | return A; |
||
10324 | } |
||
10325 | |||
10326 | void ExternalSourceSymbolAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10327 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10328 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10329 | switch (getAttributeSpellingListIndex()) { |
||
10330 | default: |
||
10331 | llvm_unreachable("Unknown attribute spelling!"); |
||
10332 | break; |
||
10333 | case 0 : { |
||
10334 | OS << " __attribute__((external_source_symbol"; |
||
10335 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10336 | OS << "\"" << getLanguage() << "\""; |
||
10337 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10338 | OS << "\"" << getDefinedIn() << "\""; |
||
10339 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10340 | OS << "" << getGeneratedDeclaration() << ""; |
||
10341 | if (!IsFirstArgument) |
||
10342 | OS << ")"; |
||
10343 | OS << "))"; |
||
10344 | break; |
||
10345 | } |
||
10346 | case 1 : { |
||
10347 | OS << " [[clang::external_source_symbol"; |
||
10348 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10349 | OS << "\"" << getLanguage() << "\""; |
||
10350 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10351 | OS << "\"" << getDefinedIn() << "\""; |
||
10352 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10353 | OS << "" << getGeneratedDeclaration() << ""; |
||
10354 | if (!IsFirstArgument) |
||
10355 | OS << ")"; |
||
10356 | OS << "]]"; |
||
10357 | break; |
||
10358 | } |
||
10359 | case 2 : { |
||
10360 | OS << " [[clang::external_source_symbol"; |
||
10361 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10362 | OS << "\"" << getLanguage() << "\""; |
||
10363 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10364 | OS << "\"" << getDefinedIn() << "\""; |
||
10365 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10366 | OS << "" << getGeneratedDeclaration() << ""; |
||
10367 | if (!IsFirstArgument) |
||
10368 | OS << ")"; |
||
10369 | OS << "]]"; |
||
10370 | break; |
||
10371 | } |
||
10372 | } |
||
10373 | } |
||
10374 | |||
10375 | const char *ExternalSourceSymbolAttr::getSpelling() const { |
||
10376 | switch (getAttributeSpellingListIndex()) { |
||
10377 | default: |
||
10378 | llvm_unreachable("Unknown attribute spelling!"); |
||
10379 | return "(No spelling)"; |
||
10380 | case 0: |
||
10381 | return "external_source_symbol"; |
||
10382 | case 1: |
||
10383 | return "external_source_symbol"; |
||
10384 | case 2: |
||
10385 | return "external_source_symbol"; |
||
10386 | } |
||
10387 | } |
||
10388 | |||
10389 | |||
10390 | // FallThroughAttr implementation |
||
10391 | |||
10392 | FallThroughAttr *FallThroughAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10393 | auto *A = new (Ctx) FallThroughAttr(Ctx, CommonInfo); |
||
10394 | A->setImplicit(true); |
||
10395 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10396 | A->setAttributeSpellingListIndex(0); |
||
10397 | return A; |
||
10398 | } |
||
10399 | |||
10400 | FallThroughAttr *FallThroughAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10401 | auto *A = new (Ctx) FallThroughAttr(Ctx, CommonInfo); |
||
10402 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10403 | A->setAttributeSpellingListIndex(0); |
||
10404 | return A; |
||
10405 | } |
||
10406 | |||
10407 | FallThroughAttr *FallThroughAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10408 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10409 | return CreateImplicit(Ctx, I); |
||
10410 | } |
||
10411 | |||
10412 | FallThroughAttr *FallThroughAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10413 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10414 | return Create(Ctx, I); |
||
10415 | } |
||
10416 | |||
10417 | FallThroughAttr::FallThroughAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10418 | ) |
||
10419 | : StmtAttr(Ctx, CommonInfo, attr::FallThrough, false) |
||
10420 | { |
||
10421 | } |
||
10422 | |||
10423 | FallThroughAttr *FallThroughAttr::clone(ASTContext &C) const { |
||
10424 | auto *A = new (C) FallThroughAttr(C, *this); |
||
10425 | A->Inherited = Inherited; |
||
10426 | A->IsPackExpansion = IsPackExpansion; |
||
10427 | A->setImplicit(Implicit); |
||
10428 | return A; |
||
10429 | } |
||
10430 | |||
10431 | void FallThroughAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10432 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10433 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10434 | switch (getAttributeSpellingListIndex()) { |
||
10435 | default: |
||
10436 | llvm_unreachable("Unknown attribute spelling!"); |
||
10437 | break; |
||
10438 | case 0 : { |
||
10439 | OS << " [[fallthrough"; |
||
10440 | OS << "]]"; |
||
10441 | break; |
||
10442 | } |
||
10443 | case 1 : { |
||
10444 | OS << " [[fallthrough"; |
||
10445 | OS << "]]"; |
||
10446 | break; |
||
10447 | } |
||
10448 | case 2 : { |
||
10449 | OS << " [[clang::fallthrough"; |
||
10450 | OS << "]]"; |
||
10451 | break; |
||
10452 | } |
||
10453 | case 3 : { |
||
10454 | OS << " __attribute__((fallthrough"; |
||
10455 | OS << "))"; |
||
10456 | break; |
||
10457 | } |
||
10458 | case 4 : { |
||
10459 | OS << " [[gnu::fallthrough"; |
||
10460 | OS << "]]"; |
||
10461 | break; |
||
10462 | } |
||
10463 | case 5 : { |
||
10464 | OS << " [[gnu::fallthrough"; |
||
10465 | OS << "]]"; |
||
10466 | break; |
||
10467 | } |
||
10468 | } |
||
10469 | } |
||
10470 | |||
10471 | const char *FallThroughAttr::getSpelling() const { |
||
10472 | switch (getAttributeSpellingListIndex()) { |
||
10473 | default: |
||
10474 | llvm_unreachable("Unknown attribute spelling!"); |
||
10475 | return "(No spelling)"; |
||
10476 | case 0: |
||
10477 | return "fallthrough"; |
||
10478 | case 1: |
||
10479 | return "fallthrough"; |
||
10480 | case 2: |
||
10481 | return "fallthrough"; |
||
10482 | case 3: |
||
10483 | return "fallthrough"; |
||
10484 | case 4: |
||
10485 | return "fallthrough"; |
||
10486 | case 5: |
||
10487 | return "fallthrough"; |
||
10488 | } |
||
10489 | } |
||
10490 | |||
10491 | |||
10492 | // FastCallAttr implementation |
||
10493 | |||
10494 | FastCallAttr *FastCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10495 | auto *A = new (Ctx) FastCallAttr(Ctx, CommonInfo); |
||
10496 | A->setImplicit(true); |
||
10497 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10498 | A->setAttributeSpellingListIndex(0); |
||
10499 | return A; |
||
10500 | } |
||
10501 | |||
10502 | FastCallAttr *FastCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10503 | auto *A = new (Ctx) FastCallAttr(Ctx, CommonInfo); |
||
10504 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10505 | A->setAttributeSpellingListIndex(0); |
||
10506 | return A; |
||
10507 | } |
||
10508 | |||
10509 | FastCallAttr *FastCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10510 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10511 | return CreateImplicit(Ctx, I); |
||
10512 | } |
||
10513 | |||
10514 | FastCallAttr *FastCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10515 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10516 | return Create(Ctx, I); |
||
10517 | } |
||
10518 | |||
10519 | FastCallAttr::FastCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10520 | ) |
||
10521 | : InheritableAttr(Ctx, CommonInfo, attr::FastCall, false, false) |
||
10522 | { |
||
10523 | } |
||
10524 | |||
10525 | FastCallAttr *FastCallAttr::clone(ASTContext &C) const { |
||
10526 | auto *A = new (C) FastCallAttr(C, *this); |
||
10527 | A->Inherited = Inherited; |
||
10528 | A->IsPackExpansion = IsPackExpansion; |
||
10529 | A->setImplicit(Implicit); |
||
10530 | return A; |
||
10531 | } |
||
10532 | |||
10533 | void FastCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10534 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10535 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10536 | switch (getAttributeSpellingListIndex()) { |
||
10537 | default: |
||
10538 | llvm_unreachable("Unknown attribute spelling!"); |
||
10539 | break; |
||
10540 | case 0 : { |
||
10541 | OS << " __attribute__((fastcall"; |
||
10542 | OS << "))"; |
||
10543 | break; |
||
10544 | } |
||
10545 | case 1 : { |
||
10546 | OS << " [[gnu::fastcall"; |
||
10547 | OS << "]]"; |
||
10548 | break; |
||
10549 | } |
||
10550 | case 2 : { |
||
10551 | OS << " [[gnu::fastcall"; |
||
10552 | OS << "]]"; |
||
10553 | break; |
||
10554 | } |
||
10555 | case 3 : { |
||
10556 | OS << " __fastcall"; |
||
10557 | OS << ""; |
||
10558 | break; |
||
10559 | } |
||
10560 | case 4 : { |
||
10561 | OS << " _fastcall"; |
||
10562 | OS << ""; |
||
10563 | break; |
||
10564 | } |
||
10565 | } |
||
10566 | } |
||
10567 | |||
10568 | const char *FastCallAttr::getSpelling() const { |
||
10569 | switch (getAttributeSpellingListIndex()) { |
||
10570 | default: |
||
10571 | llvm_unreachable("Unknown attribute spelling!"); |
||
10572 | return "(No spelling)"; |
||
10573 | case 0: |
||
10574 | return "fastcall"; |
||
10575 | case 1: |
||
10576 | return "fastcall"; |
||
10577 | case 2: |
||
10578 | return "fastcall"; |
||
10579 | case 3: |
||
10580 | return "__fastcall"; |
||
10581 | case 4: |
||
10582 | return "_fastcall"; |
||
10583 | } |
||
10584 | } |
||
10585 | |||
10586 | |||
10587 | // FinalAttr implementation |
||
10588 | |||
10589 | FinalAttr *FinalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10590 | auto *A = new (Ctx) FinalAttr(Ctx, CommonInfo); |
||
10591 | A->setImplicit(true); |
||
10592 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10593 | A->setAttributeSpellingListIndex(0); |
||
10594 | return A; |
||
10595 | } |
||
10596 | |||
10597 | FinalAttr *FinalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10598 | auto *A = new (Ctx) FinalAttr(Ctx, CommonInfo); |
||
10599 | return A; |
||
10600 | } |
||
10601 | |||
10602 | FinalAttr *FinalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, FinalAttr::Spelling S) { |
||
10603 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
10604 | return CreateImplicit(Ctx, I); |
||
10605 | } |
||
10606 | |||
10607 | FinalAttr *FinalAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, FinalAttr::Spelling S) { |
||
10608 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
10609 | return Create(Ctx, I); |
||
10610 | } |
||
10611 | |||
10612 | FinalAttr::FinalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10613 | ) |
||
10614 | : InheritableAttr(Ctx, CommonInfo, attr::Final, false, false) |
||
10615 | { |
||
10616 | } |
||
10617 | |||
10618 | FinalAttr::Spelling FinalAttr::getSemanticSpelling() const { |
||
10619 | switch (getAttributeSpellingListIndex()) { |
||
10620 | default: llvm_unreachable("Unknown spelling list index"); |
||
10621 | case 0: return Keyword_final; |
||
10622 | case 1: return Keyword_sealed; |
||
10623 | } |
||
10624 | } |
||
10625 | FinalAttr *FinalAttr::clone(ASTContext &C) const { |
||
10626 | auto *A = new (C) FinalAttr(C, *this); |
||
10627 | A->Inherited = Inherited; |
||
10628 | A->IsPackExpansion = IsPackExpansion; |
||
10629 | A->setImplicit(Implicit); |
||
10630 | return A; |
||
10631 | } |
||
10632 | |||
10633 | void FinalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10634 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10635 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10636 | switch (getAttributeSpellingListIndex()) { |
||
10637 | default: |
||
10638 | llvm_unreachable("Unknown attribute spelling!"); |
||
10639 | break; |
||
10640 | case 0 : { |
||
10641 | OS << " final"; |
||
10642 | OS << ""; |
||
10643 | break; |
||
10644 | } |
||
10645 | case 1 : { |
||
10646 | OS << " sealed"; |
||
10647 | OS << ""; |
||
10648 | break; |
||
10649 | } |
||
10650 | } |
||
10651 | } |
||
10652 | |||
10653 | const char *FinalAttr::getSpelling() const { |
||
10654 | switch (getAttributeSpellingListIndex()) { |
||
10655 | default: |
||
10656 | llvm_unreachable("Unknown attribute spelling!"); |
||
10657 | return "(No spelling)"; |
||
10658 | case 0: |
||
10659 | return "final"; |
||
10660 | case 1: |
||
10661 | return "sealed"; |
||
10662 | } |
||
10663 | } |
||
10664 | |||
10665 | |||
10666 | // FlagEnumAttr implementation |
||
10667 | |||
10668 | FlagEnumAttr *FlagEnumAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10669 | auto *A = new (Ctx) FlagEnumAttr(Ctx, CommonInfo); |
||
10670 | A->setImplicit(true); |
||
10671 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10672 | A->setAttributeSpellingListIndex(0); |
||
10673 | return A; |
||
10674 | } |
||
10675 | |||
10676 | FlagEnumAttr *FlagEnumAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10677 | auto *A = new (Ctx) FlagEnumAttr(Ctx, CommonInfo); |
||
10678 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10679 | A->setAttributeSpellingListIndex(0); |
||
10680 | return A; |
||
10681 | } |
||
10682 | |||
10683 | FlagEnumAttr *FlagEnumAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10684 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10685 | return CreateImplicit(Ctx, I); |
||
10686 | } |
||
10687 | |||
10688 | FlagEnumAttr *FlagEnumAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10689 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10690 | return Create(Ctx, I); |
||
10691 | } |
||
10692 | |||
10693 | FlagEnumAttr::FlagEnumAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10694 | ) |
||
10695 | : InheritableAttr(Ctx, CommonInfo, attr::FlagEnum, false, false) |
||
10696 | { |
||
10697 | } |
||
10698 | |||
10699 | FlagEnumAttr *FlagEnumAttr::clone(ASTContext &C) const { |
||
10700 | auto *A = new (C) FlagEnumAttr(C, *this); |
||
10701 | A->Inherited = Inherited; |
||
10702 | A->IsPackExpansion = IsPackExpansion; |
||
10703 | A->setImplicit(Implicit); |
||
10704 | return A; |
||
10705 | } |
||
10706 | |||
10707 | void FlagEnumAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10708 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10709 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10710 | switch (getAttributeSpellingListIndex()) { |
||
10711 | default: |
||
10712 | llvm_unreachable("Unknown attribute spelling!"); |
||
10713 | break; |
||
10714 | case 0 : { |
||
10715 | OS << " __attribute__((flag_enum"; |
||
10716 | OS << "))"; |
||
10717 | break; |
||
10718 | } |
||
10719 | case 1 : { |
||
10720 | OS << " [[clang::flag_enum"; |
||
10721 | OS << "]]"; |
||
10722 | break; |
||
10723 | } |
||
10724 | case 2 : { |
||
10725 | OS << " [[clang::flag_enum"; |
||
10726 | OS << "]]"; |
||
10727 | break; |
||
10728 | } |
||
10729 | } |
||
10730 | } |
||
10731 | |||
10732 | const char *FlagEnumAttr::getSpelling() const { |
||
10733 | switch (getAttributeSpellingListIndex()) { |
||
10734 | default: |
||
10735 | llvm_unreachable("Unknown attribute spelling!"); |
||
10736 | return "(No spelling)"; |
||
10737 | case 0: |
||
10738 | return "flag_enum"; |
||
10739 | case 1: |
||
10740 | return "flag_enum"; |
||
10741 | case 2: |
||
10742 | return "flag_enum"; |
||
10743 | } |
||
10744 | } |
||
10745 | |||
10746 | |||
10747 | // FlattenAttr implementation |
||
10748 | |||
10749 | FlattenAttr *FlattenAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10750 | auto *A = new (Ctx) FlattenAttr(Ctx, CommonInfo); |
||
10751 | A->setImplicit(true); |
||
10752 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10753 | A->setAttributeSpellingListIndex(0); |
||
10754 | return A; |
||
10755 | } |
||
10756 | |||
10757 | FlattenAttr *FlattenAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
10758 | auto *A = new (Ctx) FlattenAttr(Ctx, CommonInfo); |
||
10759 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10760 | A->setAttributeSpellingListIndex(0); |
||
10761 | return A; |
||
10762 | } |
||
10763 | |||
10764 | FlattenAttr *FlattenAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10765 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10766 | return CreateImplicit(Ctx, I); |
||
10767 | } |
||
10768 | |||
10769 | FlattenAttr *FlattenAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10770 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10771 | return Create(Ctx, I); |
||
10772 | } |
||
10773 | |||
10774 | FlattenAttr::FlattenAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10775 | ) |
||
10776 | : InheritableAttr(Ctx, CommonInfo, attr::Flatten, false, false) |
||
10777 | { |
||
10778 | } |
||
10779 | |||
10780 | FlattenAttr *FlattenAttr::clone(ASTContext &C) const { |
||
10781 | auto *A = new (C) FlattenAttr(C, *this); |
||
10782 | A->Inherited = Inherited; |
||
10783 | A->IsPackExpansion = IsPackExpansion; |
||
10784 | A->setImplicit(Implicit); |
||
10785 | return A; |
||
10786 | } |
||
10787 | |||
10788 | void FlattenAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10789 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10790 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10791 | switch (getAttributeSpellingListIndex()) { |
||
10792 | default: |
||
10793 | llvm_unreachable("Unknown attribute spelling!"); |
||
10794 | break; |
||
10795 | case 0 : { |
||
10796 | OS << " __attribute__((flatten"; |
||
10797 | OS << "))"; |
||
10798 | break; |
||
10799 | } |
||
10800 | case 1 : { |
||
10801 | OS << " [[gnu::flatten"; |
||
10802 | OS << "]]"; |
||
10803 | break; |
||
10804 | } |
||
10805 | case 2 : { |
||
10806 | OS << " [[gnu::flatten"; |
||
10807 | OS << "]]"; |
||
10808 | break; |
||
10809 | } |
||
10810 | } |
||
10811 | } |
||
10812 | |||
10813 | const char *FlattenAttr::getSpelling() const { |
||
10814 | switch (getAttributeSpellingListIndex()) { |
||
10815 | default: |
||
10816 | llvm_unreachable("Unknown attribute spelling!"); |
||
10817 | return "(No spelling)"; |
||
10818 | case 0: |
||
10819 | return "flatten"; |
||
10820 | case 1: |
||
10821 | return "flatten"; |
||
10822 | case 2: |
||
10823 | return "flatten"; |
||
10824 | } |
||
10825 | } |
||
10826 | |||
10827 | |||
10828 | // FormatAttr implementation |
||
10829 | |||
10830 | FormatAttr *FormatAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, const AttributeCommonInfo &CommonInfo) { |
||
10831 | auto *A = new (Ctx) FormatAttr(Ctx, CommonInfo, Type, FormatIdx, FirstArg); |
||
10832 | A->setImplicit(true); |
||
10833 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10834 | A->setAttributeSpellingListIndex(0); |
||
10835 | return A; |
||
10836 | } |
||
10837 | |||
10838 | FormatAttr *FormatAttr::Create(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, const AttributeCommonInfo &CommonInfo) { |
||
10839 | auto *A = new (Ctx) FormatAttr(Ctx, CommonInfo, Type, FormatIdx, FirstArg); |
||
10840 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10841 | A->setAttributeSpellingListIndex(0); |
||
10842 | return A; |
||
10843 | } |
||
10844 | |||
10845 | FormatAttr *FormatAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10846 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10847 | return CreateImplicit(Ctx, Type, FormatIdx, FirstArg, I); |
||
10848 | } |
||
10849 | |||
10850 | FormatAttr *FormatAttr::Create(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10851 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10852 | return Create(Ctx, Type, FormatIdx, FirstArg, I); |
||
10853 | } |
||
10854 | |||
10855 | FormatAttr::FormatAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10856 | , IdentifierInfo * Type |
||
10857 | , int FormatIdx |
||
10858 | , int FirstArg |
||
10859 | ) |
||
10860 | : InheritableAttr(Ctx, CommonInfo, attr::Format, false, false) |
||
10861 | , type(Type) |
||
10862 | , formatIdx(FormatIdx) |
||
10863 | , firstArg(FirstArg) |
||
10864 | { |
||
10865 | } |
||
10866 | |||
10867 | |||
10868 | |||
10869 | |||
10870 | |||
10871 | |||
10872 | |||
10873 | FormatAttr *FormatAttr::clone(ASTContext &C) const { |
||
10874 | auto *A = new (C) FormatAttr(C, *this, type, formatIdx, firstArg); |
||
10875 | A->Inherited = Inherited; |
||
10876 | A->IsPackExpansion = IsPackExpansion; |
||
10877 | A->setImplicit(Implicit); |
||
10878 | return A; |
||
10879 | } |
||
10880 | |||
10881 | void FormatAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10882 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10883 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10884 | switch (getAttributeSpellingListIndex()) { |
||
10885 | default: |
||
10886 | llvm_unreachable("Unknown attribute spelling!"); |
||
10887 | break; |
||
10888 | case 0 : { |
||
10889 | OS << " __attribute__((format"; |
||
10890 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10891 | OS << "" << (getType() ? getType()->getName() : "") << ""; |
||
10892 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10893 | OS << "" << getFormatIdx() << ""; |
||
10894 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10895 | OS << "" << getFirstArg() << ""; |
||
10896 | if (!IsFirstArgument) |
||
10897 | OS << ")"; |
||
10898 | OS << "))"; |
||
10899 | break; |
||
10900 | } |
||
10901 | case 1 : { |
||
10902 | OS << " [[gnu::format"; |
||
10903 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10904 | OS << "" << (getType() ? getType()->getName() : "") << ""; |
||
10905 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10906 | OS << "" << getFormatIdx() << ""; |
||
10907 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10908 | OS << "" << getFirstArg() << ""; |
||
10909 | if (!IsFirstArgument) |
||
10910 | OS << ")"; |
||
10911 | OS << "]]"; |
||
10912 | break; |
||
10913 | } |
||
10914 | case 2 : { |
||
10915 | OS << " [[gnu::format"; |
||
10916 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10917 | OS << "" << (getType() ? getType()->getName() : "") << ""; |
||
10918 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10919 | OS << "" << getFormatIdx() << ""; |
||
10920 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
10921 | OS << "" << getFirstArg() << ""; |
||
10922 | if (!IsFirstArgument) |
||
10923 | OS << ")"; |
||
10924 | OS << "]]"; |
||
10925 | break; |
||
10926 | } |
||
10927 | } |
||
10928 | } |
||
10929 | |||
10930 | const char *FormatAttr::getSpelling() const { |
||
10931 | switch (getAttributeSpellingListIndex()) { |
||
10932 | default: |
||
10933 | llvm_unreachable("Unknown attribute spelling!"); |
||
10934 | return "(No spelling)"; |
||
10935 | case 0: |
||
10936 | return "format"; |
||
10937 | case 1: |
||
10938 | return "format"; |
||
10939 | case 2: |
||
10940 | return "format"; |
||
10941 | } |
||
10942 | } |
||
10943 | |||
10944 | |||
10945 | // FormatArgAttr implementation |
||
10946 | |||
10947 | FormatArgAttr *FormatArgAttr::CreateImplicit(ASTContext &Ctx, ParamIdx FormatIdx, const AttributeCommonInfo &CommonInfo) { |
||
10948 | auto *A = new (Ctx) FormatArgAttr(Ctx, CommonInfo, FormatIdx); |
||
10949 | A->setImplicit(true); |
||
10950 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10951 | A->setAttributeSpellingListIndex(0); |
||
10952 | return A; |
||
10953 | } |
||
10954 | |||
10955 | FormatArgAttr *FormatArgAttr::Create(ASTContext &Ctx, ParamIdx FormatIdx, const AttributeCommonInfo &CommonInfo) { |
||
10956 | auto *A = new (Ctx) FormatArgAttr(Ctx, CommonInfo, FormatIdx); |
||
10957 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
10958 | A->setAttributeSpellingListIndex(0); |
||
10959 | return A; |
||
10960 | } |
||
10961 | |||
10962 | FormatArgAttr *FormatArgAttr::CreateImplicit(ASTContext &Ctx, ParamIdx FormatIdx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10963 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10964 | return CreateImplicit(Ctx, FormatIdx, I); |
||
10965 | } |
||
10966 | |||
10967 | FormatArgAttr *FormatArgAttr::Create(ASTContext &Ctx, ParamIdx FormatIdx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
10968 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
10969 | return Create(Ctx, FormatIdx, I); |
||
10970 | } |
||
10971 | |||
10972 | FormatArgAttr::FormatArgAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
10973 | , ParamIdx FormatIdx |
||
10974 | ) |
||
10975 | : InheritableAttr(Ctx, CommonInfo, attr::FormatArg, false, false) |
||
10976 | , formatIdx(FormatIdx) |
||
10977 | { |
||
10978 | } |
||
10979 | |||
10980 | |||
10981 | |||
10982 | FormatArgAttr *FormatArgAttr::clone(ASTContext &C) const { |
||
10983 | auto *A = new (C) FormatArgAttr(C, *this, formatIdx); |
||
10984 | A->Inherited = Inherited; |
||
10985 | A->IsPackExpansion = IsPackExpansion; |
||
10986 | A->setImplicit(Implicit); |
||
10987 | return A; |
||
10988 | } |
||
10989 | |||
10990 | void FormatArgAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
10991 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
10992 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
10993 | switch (getAttributeSpellingListIndex()) { |
||
10994 | default: |
||
10995 | llvm_unreachable("Unknown attribute spelling!"); |
||
10996 | break; |
||
10997 | case 0 : { |
||
10998 | OS << " __attribute__((format_arg"; |
||
10999 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11000 | OS << "" << getFormatIdx().getSourceIndex() << ""; |
||
11001 | if (!IsFirstArgument) |
||
11002 | OS << ")"; |
||
11003 | OS << "))"; |
||
11004 | break; |
||
11005 | } |
||
11006 | case 1 : { |
||
11007 | OS << " [[gnu::format_arg"; |
||
11008 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11009 | OS << "" << getFormatIdx().getSourceIndex() << ""; |
||
11010 | if (!IsFirstArgument) |
||
11011 | OS << ")"; |
||
11012 | OS << "]]"; |
||
11013 | break; |
||
11014 | } |
||
11015 | case 2 : { |
||
11016 | OS << " [[gnu::format_arg"; |
||
11017 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11018 | OS << "" << getFormatIdx().getSourceIndex() << ""; |
||
11019 | if (!IsFirstArgument) |
||
11020 | OS << ")"; |
||
11021 | OS << "]]"; |
||
11022 | break; |
||
11023 | } |
||
11024 | } |
||
11025 | } |
||
11026 | |||
11027 | const char *FormatArgAttr::getSpelling() const { |
||
11028 | switch (getAttributeSpellingListIndex()) { |
||
11029 | default: |
||
11030 | llvm_unreachable("Unknown attribute spelling!"); |
||
11031 | return "(No spelling)"; |
||
11032 | case 0: |
||
11033 | return "format_arg"; |
||
11034 | case 1: |
||
11035 | return "format_arg"; |
||
11036 | case 2: |
||
11037 | return "format_arg"; |
||
11038 | } |
||
11039 | } |
||
11040 | |||
11041 | |||
11042 | // FunctionReturnThunksAttr implementation |
||
11043 | |||
11044 | FunctionReturnThunksAttr *FunctionReturnThunksAttr::CreateImplicit(ASTContext &Ctx, Kind ThunkType, const AttributeCommonInfo &CommonInfo) { |
||
11045 | auto *A = new (Ctx) FunctionReturnThunksAttr(Ctx, CommonInfo, ThunkType); |
||
11046 | A->setImplicit(true); |
||
11047 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11048 | A->setAttributeSpellingListIndex(0); |
||
11049 | return A; |
||
11050 | } |
||
11051 | |||
11052 | FunctionReturnThunksAttr *FunctionReturnThunksAttr::Create(ASTContext &Ctx, Kind ThunkType, const AttributeCommonInfo &CommonInfo) { |
||
11053 | auto *A = new (Ctx) FunctionReturnThunksAttr(Ctx, CommonInfo, ThunkType); |
||
11054 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11055 | A->setAttributeSpellingListIndex(0); |
||
11056 | return A; |
||
11057 | } |
||
11058 | |||
11059 | FunctionReturnThunksAttr *FunctionReturnThunksAttr::CreateImplicit(ASTContext &Ctx, Kind ThunkType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11060 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11061 | return CreateImplicit(Ctx, ThunkType, I); |
||
11062 | } |
||
11063 | |||
11064 | FunctionReturnThunksAttr *FunctionReturnThunksAttr::Create(ASTContext &Ctx, Kind ThunkType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11065 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11066 | return Create(Ctx, ThunkType, I); |
||
11067 | } |
||
11068 | |||
11069 | FunctionReturnThunksAttr::FunctionReturnThunksAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11070 | , Kind ThunkType |
||
11071 | ) |
||
11072 | : InheritableAttr(Ctx, CommonInfo, attr::FunctionReturnThunks, false, false) |
||
11073 | , thunkType(ThunkType) |
||
11074 | { |
||
11075 | } |
||
11076 | |||
11077 | |||
11078 | |||
11079 | bool FunctionReturnThunksAttr::ConvertStrToKind(StringRef Val, Kind &Out) { |
||
11080 | std::optional<Kind> R = llvm::StringSwitch<std::optional<Kind>>(Val) |
||
11081 | .Case("keep", FunctionReturnThunksAttr::Keep) |
||
11082 | .Case("thunk-extern", FunctionReturnThunksAttr::Extern) |
||
11083 | .Default(std::optional<Kind>()); |
||
11084 | if (R) { |
||
11085 | Out = *R; |
||
11086 | return true; |
||
11087 | } |
||
11088 | return false; |
||
11089 | } |
||
11090 | |||
11091 | const char *FunctionReturnThunksAttr::ConvertKindToStr(Kind Val) { |
||
11092 | switch(Val) { |
||
11093 | case FunctionReturnThunksAttr::Keep: return "keep"; |
||
11094 | case FunctionReturnThunksAttr::Extern: return "thunk-extern"; |
||
11095 | } |
||
11096 | llvm_unreachable("No enumerator with that value"); |
||
11097 | } |
||
11098 | FunctionReturnThunksAttr *FunctionReturnThunksAttr::clone(ASTContext &C) const { |
||
11099 | auto *A = new (C) FunctionReturnThunksAttr(C, *this, thunkType); |
||
11100 | A->Inherited = Inherited; |
||
11101 | A->IsPackExpansion = IsPackExpansion; |
||
11102 | A->setImplicit(Implicit); |
||
11103 | return A; |
||
11104 | } |
||
11105 | |||
11106 | void FunctionReturnThunksAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11107 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11108 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11109 | switch (getAttributeSpellingListIndex()) { |
||
11110 | default: |
||
11111 | llvm_unreachable("Unknown attribute spelling!"); |
||
11112 | break; |
||
11113 | case 0 : { |
||
11114 | OS << " __attribute__((function_return"; |
||
11115 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11116 | OS << "\"" << FunctionReturnThunksAttr::ConvertKindToStr(getThunkType()) << "\""; |
||
11117 | if (!IsFirstArgument) |
||
11118 | OS << ")"; |
||
11119 | OS << "))"; |
||
11120 | break; |
||
11121 | } |
||
11122 | case 1 : { |
||
11123 | OS << " [[gnu::function_return"; |
||
11124 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11125 | OS << "\"" << FunctionReturnThunksAttr::ConvertKindToStr(getThunkType()) << "\""; |
||
11126 | if (!IsFirstArgument) |
||
11127 | OS << ")"; |
||
11128 | OS << "]]"; |
||
11129 | break; |
||
11130 | } |
||
11131 | case 2 : { |
||
11132 | OS << " [[gnu::function_return"; |
||
11133 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11134 | OS << "\"" << FunctionReturnThunksAttr::ConvertKindToStr(getThunkType()) << "\""; |
||
11135 | if (!IsFirstArgument) |
||
11136 | OS << ")"; |
||
11137 | OS << "]]"; |
||
11138 | break; |
||
11139 | } |
||
11140 | } |
||
11141 | } |
||
11142 | |||
11143 | const char *FunctionReturnThunksAttr::getSpelling() const { |
||
11144 | switch (getAttributeSpellingListIndex()) { |
||
11145 | default: |
||
11146 | llvm_unreachable("Unknown attribute spelling!"); |
||
11147 | return "(No spelling)"; |
||
11148 | case 0: |
||
11149 | return "function_return"; |
||
11150 | case 1: |
||
11151 | return "function_return"; |
||
11152 | case 2: |
||
11153 | return "function_return"; |
||
11154 | } |
||
11155 | } |
||
11156 | |||
11157 | |||
11158 | // GNUInlineAttr implementation |
||
11159 | |||
11160 | GNUInlineAttr *GNUInlineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11161 | auto *A = new (Ctx) GNUInlineAttr(Ctx, CommonInfo); |
||
11162 | A->setImplicit(true); |
||
11163 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11164 | A->setAttributeSpellingListIndex(0); |
||
11165 | return A; |
||
11166 | } |
||
11167 | |||
11168 | GNUInlineAttr *GNUInlineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11169 | auto *A = new (Ctx) GNUInlineAttr(Ctx, CommonInfo); |
||
11170 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11171 | A->setAttributeSpellingListIndex(0); |
||
11172 | return A; |
||
11173 | } |
||
11174 | |||
11175 | GNUInlineAttr *GNUInlineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11176 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11177 | return CreateImplicit(Ctx, I); |
||
11178 | } |
||
11179 | |||
11180 | GNUInlineAttr *GNUInlineAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11181 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11182 | return Create(Ctx, I); |
||
11183 | } |
||
11184 | |||
11185 | GNUInlineAttr::GNUInlineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11186 | ) |
||
11187 | : InheritableAttr(Ctx, CommonInfo, attr::GNUInline, false, false) |
||
11188 | { |
||
11189 | } |
||
11190 | |||
11191 | GNUInlineAttr *GNUInlineAttr::clone(ASTContext &C) const { |
||
11192 | auto *A = new (C) GNUInlineAttr(C, *this); |
||
11193 | A->Inherited = Inherited; |
||
11194 | A->IsPackExpansion = IsPackExpansion; |
||
11195 | A->setImplicit(Implicit); |
||
11196 | return A; |
||
11197 | } |
||
11198 | |||
11199 | void GNUInlineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11200 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11201 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11202 | switch (getAttributeSpellingListIndex()) { |
||
11203 | default: |
||
11204 | llvm_unreachable("Unknown attribute spelling!"); |
||
11205 | break; |
||
11206 | case 0 : { |
||
11207 | OS << " __attribute__((gnu_inline"; |
||
11208 | OS << "))"; |
||
11209 | break; |
||
11210 | } |
||
11211 | case 1 : { |
||
11212 | OS << " [[gnu::gnu_inline"; |
||
11213 | OS << "]]"; |
||
11214 | break; |
||
11215 | } |
||
11216 | case 2 : { |
||
11217 | OS << " [[gnu::gnu_inline"; |
||
11218 | OS << "]]"; |
||
11219 | break; |
||
11220 | } |
||
11221 | } |
||
11222 | } |
||
11223 | |||
11224 | const char *GNUInlineAttr::getSpelling() const { |
||
11225 | switch (getAttributeSpellingListIndex()) { |
||
11226 | default: |
||
11227 | llvm_unreachable("Unknown attribute spelling!"); |
||
11228 | return "(No spelling)"; |
||
11229 | case 0: |
||
11230 | return "gnu_inline"; |
||
11231 | case 1: |
||
11232 | return "gnu_inline"; |
||
11233 | case 2: |
||
11234 | return "gnu_inline"; |
||
11235 | } |
||
11236 | } |
||
11237 | |||
11238 | |||
11239 | // GuardedByAttr implementation |
||
11240 | |||
11241 | GuardedByAttr *GuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { |
||
11242 | auto *A = new (Ctx) GuardedByAttr(Ctx, CommonInfo, Arg); |
||
11243 | A->setImplicit(true); |
||
11244 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11245 | A->setAttributeSpellingListIndex(0); |
||
11246 | return A; |
||
11247 | } |
||
11248 | |||
11249 | GuardedByAttr *GuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { |
||
11250 | auto *A = new (Ctx) GuardedByAttr(Ctx, CommonInfo, Arg); |
||
11251 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11252 | A->setAttributeSpellingListIndex(0); |
||
11253 | return A; |
||
11254 | } |
||
11255 | |||
11256 | GuardedByAttr *GuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11257 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11258 | return CreateImplicit(Ctx, Arg, I); |
||
11259 | } |
||
11260 | |||
11261 | GuardedByAttr *GuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11262 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11263 | return Create(Ctx, Arg, I); |
||
11264 | } |
||
11265 | |||
11266 | GuardedByAttr::GuardedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11267 | , Expr * Arg |
||
11268 | ) |
||
11269 | : InheritableAttr(Ctx, CommonInfo, attr::GuardedBy, true, true) |
||
11270 | , arg(Arg) |
||
11271 | { |
||
11272 | } |
||
11273 | |||
11274 | |||
11275 | |||
11276 | GuardedByAttr *GuardedByAttr::clone(ASTContext &C) const { |
||
11277 | auto *A = new (C) GuardedByAttr(C, *this, arg); |
||
11278 | A->Inherited = Inherited; |
||
11279 | A->IsPackExpansion = IsPackExpansion; |
||
11280 | A->setImplicit(Implicit); |
||
11281 | return A; |
||
11282 | } |
||
11283 | |||
11284 | void GuardedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11285 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11286 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11287 | switch (getAttributeSpellingListIndex()) { |
||
11288 | default: |
||
11289 | llvm_unreachable("Unknown attribute spelling!"); |
||
11290 | break; |
||
11291 | case 0 : { |
||
11292 | OS << " __attribute__((guarded_by"; |
||
11293 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11294 | OS << ""; |
||
11295 | getArg()->printPretty(OS, nullptr, Policy); |
||
11296 | OS << ""; |
||
11297 | if (!IsFirstArgument) |
||
11298 | OS << ")"; |
||
11299 | OS << "))"; |
||
11300 | break; |
||
11301 | } |
||
11302 | } |
||
11303 | } |
||
11304 | |||
11305 | const char *GuardedByAttr::getSpelling() const { |
||
11306 | switch (getAttributeSpellingListIndex()) { |
||
11307 | default: |
||
11308 | llvm_unreachable("Unknown attribute spelling!"); |
||
11309 | return "(No spelling)"; |
||
11310 | case 0: |
||
11311 | return "guarded_by"; |
||
11312 | } |
||
11313 | } |
||
11314 | |||
11315 | |||
11316 | // GuardedVarAttr implementation |
||
11317 | |||
11318 | GuardedVarAttr *GuardedVarAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11319 | auto *A = new (Ctx) GuardedVarAttr(Ctx, CommonInfo); |
||
11320 | A->setImplicit(true); |
||
11321 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11322 | A->setAttributeSpellingListIndex(0); |
||
11323 | return A; |
||
11324 | } |
||
11325 | |||
11326 | GuardedVarAttr *GuardedVarAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11327 | auto *A = new (Ctx) GuardedVarAttr(Ctx, CommonInfo); |
||
11328 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11329 | A->setAttributeSpellingListIndex(0); |
||
11330 | return A; |
||
11331 | } |
||
11332 | |||
11333 | GuardedVarAttr *GuardedVarAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11334 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11335 | return CreateImplicit(Ctx, I); |
||
11336 | } |
||
11337 | |||
11338 | GuardedVarAttr *GuardedVarAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11339 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11340 | return Create(Ctx, I); |
||
11341 | } |
||
11342 | |||
11343 | GuardedVarAttr::GuardedVarAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11344 | ) |
||
11345 | : InheritableAttr(Ctx, CommonInfo, attr::GuardedVar, false, false) |
||
11346 | { |
||
11347 | } |
||
11348 | |||
11349 | GuardedVarAttr *GuardedVarAttr::clone(ASTContext &C) const { |
||
11350 | auto *A = new (C) GuardedVarAttr(C, *this); |
||
11351 | A->Inherited = Inherited; |
||
11352 | A->IsPackExpansion = IsPackExpansion; |
||
11353 | A->setImplicit(Implicit); |
||
11354 | return A; |
||
11355 | } |
||
11356 | |||
11357 | void GuardedVarAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11358 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11359 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11360 | switch (getAttributeSpellingListIndex()) { |
||
11361 | default: |
||
11362 | llvm_unreachable("Unknown attribute spelling!"); |
||
11363 | break; |
||
11364 | case 0 : { |
||
11365 | OS << " __attribute__((guarded_var"; |
||
11366 | OS << "))"; |
||
11367 | break; |
||
11368 | } |
||
11369 | case 1 : { |
||
11370 | OS << " [[clang::guarded_var"; |
||
11371 | OS << "]]"; |
||
11372 | break; |
||
11373 | } |
||
11374 | } |
||
11375 | } |
||
11376 | |||
11377 | const char *GuardedVarAttr::getSpelling() const { |
||
11378 | switch (getAttributeSpellingListIndex()) { |
||
11379 | default: |
||
11380 | llvm_unreachable("Unknown attribute spelling!"); |
||
11381 | return "(No spelling)"; |
||
11382 | case 0: |
||
11383 | return "guarded_var"; |
||
11384 | case 1: |
||
11385 | return "guarded_var"; |
||
11386 | } |
||
11387 | } |
||
11388 | |||
11389 | |||
11390 | // HIPManagedAttr implementation |
||
11391 | |||
11392 | HIPManagedAttr *HIPManagedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11393 | auto *A = new (Ctx) HIPManagedAttr(Ctx, CommonInfo); |
||
11394 | A->setImplicit(true); |
||
11395 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11396 | A->setAttributeSpellingListIndex(0); |
||
11397 | return A; |
||
11398 | } |
||
11399 | |||
11400 | HIPManagedAttr *HIPManagedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11401 | auto *A = new (Ctx) HIPManagedAttr(Ctx, CommonInfo); |
||
11402 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11403 | A->setAttributeSpellingListIndex(0); |
||
11404 | return A; |
||
11405 | } |
||
11406 | |||
11407 | HIPManagedAttr *HIPManagedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11408 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11409 | return CreateImplicit(Ctx, I); |
||
11410 | } |
||
11411 | |||
11412 | HIPManagedAttr *HIPManagedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11413 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11414 | return Create(Ctx, I); |
||
11415 | } |
||
11416 | |||
11417 | HIPManagedAttr::HIPManagedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11418 | ) |
||
11419 | : InheritableAttr(Ctx, CommonInfo, attr::HIPManaged, false, false) |
||
11420 | { |
||
11421 | } |
||
11422 | |||
11423 | HIPManagedAttr *HIPManagedAttr::clone(ASTContext &C) const { |
||
11424 | auto *A = new (C) HIPManagedAttr(C, *this); |
||
11425 | A->Inherited = Inherited; |
||
11426 | A->IsPackExpansion = IsPackExpansion; |
||
11427 | A->setImplicit(Implicit); |
||
11428 | return A; |
||
11429 | } |
||
11430 | |||
11431 | void HIPManagedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11432 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11433 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11434 | switch (getAttributeSpellingListIndex()) { |
||
11435 | default: |
||
11436 | llvm_unreachable("Unknown attribute spelling!"); |
||
11437 | break; |
||
11438 | case 0 : { |
||
11439 | OS << " __attribute__((managed"; |
||
11440 | OS << "))"; |
||
11441 | break; |
||
11442 | } |
||
11443 | case 1 : { |
||
11444 | OS << " __declspec(__managed__"; |
||
11445 | OS << ")"; |
||
11446 | break; |
||
11447 | } |
||
11448 | } |
||
11449 | } |
||
11450 | |||
11451 | const char *HIPManagedAttr::getSpelling() const { |
||
11452 | switch (getAttributeSpellingListIndex()) { |
||
11453 | default: |
||
11454 | llvm_unreachable("Unknown attribute spelling!"); |
||
11455 | return "(No spelling)"; |
||
11456 | case 0: |
||
11457 | return "managed"; |
||
11458 | case 1: |
||
11459 | return "__managed__"; |
||
11460 | } |
||
11461 | } |
||
11462 | |||
11463 | |||
11464 | // HLSLGroupSharedAddressSpaceAttr implementation |
||
11465 | |||
11466 | HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11467 | auto *A = new (Ctx) HLSLGroupSharedAddressSpaceAttr(Ctx, CommonInfo); |
||
11468 | A->setImplicit(true); |
||
11469 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11470 | A->setAttributeSpellingListIndex(0); |
||
11471 | return A; |
||
11472 | } |
||
11473 | |||
11474 | HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11475 | auto *A = new (Ctx) HLSLGroupSharedAddressSpaceAttr(Ctx, CommonInfo); |
||
11476 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11477 | A->setAttributeSpellingListIndex(0); |
||
11478 | return A; |
||
11479 | } |
||
11480 | |||
11481 | HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11482 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11483 | return CreateImplicit(Ctx, I); |
||
11484 | } |
||
11485 | |||
11486 | HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11487 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11488 | return Create(Ctx, I); |
||
11489 | } |
||
11490 | |||
11491 | HLSLGroupSharedAddressSpaceAttr::HLSLGroupSharedAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11492 | ) |
||
11493 | : TypeAttr(Ctx, CommonInfo, attr::HLSLGroupSharedAddressSpace, false) |
||
11494 | { |
||
11495 | } |
||
11496 | |||
11497 | HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::clone(ASTContext &C) const { |
||
11498 | auto *A = new (C) HLSLGroupSharedAddressSpaceAttr(C, *this); |
||
11499 | A->Inherited = Inherited; |
||
11500 | A->IsPackExpansion = IsPackExpansion; |
||
11501 | A->setImplicit(Implicit); |
||
11502 | return A; |
||
11503 | } |
||
11504 | |||
11505 | void HLSLGroupSharedAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11506 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11507 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11508 | switch (getAttributeSpellingListIndex()) { |
||
11509 | default: |
||
11510 | llvm_unreachable("Unknown attribute spelling!"); |
||
11511 | break; |
||
11512 | case 0 : { |
||
11513 | OS << " groupshared"; |
||
11514 | OS << ""; |
||
11515 | break; |
||
11516 | } |
||
11517 | } |
||
11518 | } |
||
11519 | |||
11520 | const char *HLSLGroupSharedAddressSpaceAttr::getSpelling() const { |
||
11521 | switch (getAttributeSpellingListIndex()) { |
||
11522 | default: |
||
11523 | llvm_unreachable("Unknown attribute spelling!"); |
||
11524 | return "(No spelling)"; |
||
11525 | case 0: |
||
11526 | return "groupshared"; |
||
11527 | } |
||
11528 | } |
||
11529 | |||
11530 | |||
11531 | // HLSLNumThreadsAttr implementation |
||
11532 | |||
11533 | HLSLNumThreadsAttr *HLSLNumThreadsAttr::CreateImplicit(ASTContext &Ctx, int X, int Y, int Z, const AttributeCommonInfo &CommonInfo) { |
||
11534 | auto *A = new (Ctx) HLSLNumThreadsAttr(Ctx, CommonInfo, X, Y, Z); |
||
11535 | A->setImplicit(true); |
||
11536 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11537 | A->setAttributeSpellingListIndex(0); |
||
11538 | return A; |
||
11539 | } |
||
11540 | |||
11541 | HLSLNumThreadsAttr *HLSLNumThreadsAttr::Create(ASTContext &Ctx, int X, int Y, int Z, const AttributeCommonInfo &CommonInfo) { |
||
11542 | auto *A = new (Ctx) HLSLNumThreadsAttr(Ctx, CommonInfo, X, Y, Z); |
||
11543 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11544 | A->setAttributeSpellingListIndex(0); |
||
11545 | return A; |
||
11546 | } |
||
11547 | |||
11548 | HLSLNumThreadsAttr *HLSLNumThreadsAttr::CreateImplicit(ASTContext &Ctx, int X, int Y, int Z, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11549 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11550 | return CreateImplicit(Ctx, X, Y, Z, I); |
||
11551 | } |
||
11552 | |||
11553 | HLSLNumThreadsAttr *HLSLNumThreadsAttr::Create(ASTContext &Ctx, int X, int Y, int Z, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11554 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11555 | return Create(Ctx, X, Y, Z, I); |
||
11556 | } |
||
11557 | |||
11558 | HLSLNumThreadsAttr::HLSLNumThreadsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11559 | , int X |
||
11560 | , int Y |
||
11561 | , int Z |
||
11562 | ) |
||
11563 | : InheritableAttr(Ctx, CommonInfo, attr::HLSLNumThreads, false, false) |
||
11564 | , x(X) |
||
11565 | , y(Y) |
||
11566 | , z(Z) |
||
11567 | { |
||
11568 | } |
||
11569 | |||
11570 | |||
11571 | |||
11572 | |||
11573 | |||
11574 | |||
11575 | |||
11576 | HLSLNumThreadsAttr *HLSLNumThreadsAttr::clone(ASTContext &C) const { |
||
11577 | auto *A = new (C) HLSLNumThreadsAttr(C, *this, x, y, z); |
||
11578 | A->Inherited = Inherited; |
||
11579 | A->IsPackExpansion = IsPackExpansion; |
||
11580 | A->setImplicit(Implicit); |
||
11581 | return A; |
||
11582 | } |
||
11583 | |||
11584 | void HLSLNumThreadsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11585 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11586 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11587 | switch (getAttributeSpellingListIndex()) { |
||
11588 | default: |
||
11589 | llvm_unreachable("Unknown attribute spelling!"); |
||
11590 | break; |
||
11591 | case 0 : { |
||
11592 | OS << "[numthreads"; |
||
11593 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11594 | OS << "" << getX() << ""; |
||
11595 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11596 | OS << "" << getY() << ""; |
||
11597 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11598 | OS << "" << getZ() << ""; |
||
11599 | if (!IsFirstArgument) |
||
11600 | OS << ")"; |
||
11601 | OS << "]"; |
||
11602 | break; |
||
11603 | } |
||
11604 | } |
||
11605 | } |
||
11606 | |||
11607 | const char *HLSLNumThreadsAttr::getSpelling() const { |
||
11608 | switch (getAttributeSpellingListIndex()) { |
||
11609 | default: |
||
11610 | llvm_unreachable("Unknown attribute spelling!"); |
||
11611 | return "(No spelling)"; |
||
11612 | case 0: |
||
11613 | return "numthreads"; |
||
11614 | } |
||
11615 | } |
||
11616 | |||
11617 | |||
11618 | // HLSLResourceAttr implementation |
||
11619 | |||
11620 | HLSLResourceAttr *HLSLResourceAttr::CreateImplicit(ASTContext &Ctx, ResourceClass ResourceType, ResourceKind ResourceShape, const AttributeCommonInfo &CommonInfo) { |
||
11621 | auto *A = new (Ctx) HLSLResourceAttr(Ctx, CommonInfo, ResourceType, ResourceShape); |
||
11622 | A->setImplicit(true); |
||
11623 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11624 | A->setAttributeSpellingListIndex(0); |
||
11625 | return A; |
||
11626 | } |
||
11627 | |||
11628 | HLSLResourceAttr *HLSLResourceAttr::Create(ASTContext &Ctx, ResourceClass ResourceType, ResourceKind ResourceShape, const AttributeCommonInfo &CommonInfo) { |
||
11629 | auto *A = new (Ctx) HLSLResourceAttr(Ctx, CommonInfo, ResourceType, ResourceShape); |
||
11630 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11631 | A->setAttributeSpellingListIndex(0); |
||
11632 | return A; |
||
11633 | } |
||
11634 | |||
11635 | HLSLResourceAttr *HLSLResourceAttr::CreateImplicit(ASTContext &Ctx, ResourceClass ResourceType, ResourceKind ResourceShape, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11636 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11637 | return CreateImplicit(Ctx, ResourceType, ResourceShape, I); |
||
11638 | } |
||
11639 | |||
11640 | HLSLResourceAttr *HLSLResourceAttr::Create(ASTContext &Ctx, ResourceClass ResourceType, ResourceKind ResourceShape, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11641 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11642 | return Create(Ctx, ResourceType, ResourceShape, I); |
||
11643 | } |
||
11644 | |||
11645 | HLSLResourceAttr::HLSLResourceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11646 | , ResourceClass ResourceType |
||
11647 | , ResourceKind ResourceShape |
||
11648 | ) |
||
11649 | : InheritableAttr(Ctx, CommonInfo, attr::HLSLResource, false, false) |
||
11650 | , resourceType(ResourceType) |
||
11651 | , resourceShape(ResourceShape) |
||
11652 | { |
||
11653 | } |
||
11654 | |||
11655 | |||
11656 | |||
11657 | bool HLSLResourceAttr::ConvertStrToResourceClass(StringRef Val, ResourceClass &Out) { |
||
11658 | std::optional<ResourceClass> R = llvm::StringSwitch<std::optional<ResourceClass>>(Val) |
||
11659 | .Case("SRV", HLSLResourceAttr::SRV) |
||
11660 | .Case("UAV", HLSLResourceAttr::UAV) |
||
11661 | .Case("CBuffer", HLSLResourceAttr::CBuffer) |
||
11662 | .Case("Sampler", HLSLResourceAttr::Sampler) |
||
11663 | .Default(std::optional<ResourceClass>()); |
||
11664 | if (R) { |
||
11665 | Out = *R; |
||
11666 | return true; |
||
11667 | } |
||
11668 | return false; |
||
11669 | } |
||
11670 | |||
11671 | const char *HLSLResourceAttr::ConvertResourceClassToStr(ResourceClass Val) { |
||
11672 | switch(Val) { |
||
11673 | case HLSLResourceAttr::SRV: return "SRV"; |
||
11674 | case HLSLResourceAttr::UAV: return "UAV"; |
||
11675 | case HLSLResourceAttr::CBuffer: return "CBuffer"; |
||
11676 | case HLSLResourceAttr::Sampler: return "Sampler"; |
||
11677 | } |
||
11678 | llvm_unreachable("No enumerator with that value"); |
||
11679 | } |
||
11680 | |||
11681 | |||
11682 | bool HLSLResourceAttr::ConvertStrToResourceKind(StringRef Val, ResourceKind &Out) { |
||
11683 | std::optional<ResourceKind> R = llvm::StringSwitch<std::optional<ResourceKind>>(Val) |
||
11684 | .Case("Texture1D", HLSLResourceAttr::Texture1D) |
||
11685 | .Case("Texture2D", HLSLResourceAttr::Texture2D) |
||
11686 | .Case("Texture2DMS", HLSLResourceAttr::Texture2DMS) |
||
11687 | .Case("Texture3D", HLSLResourceAttr::Texture3D) |
||
11688 | .Case("TextureCube", HLSLResourceAttr::TextureCube) |
||
11689 | .Case("Texture1DArray", HLSLResourceAttr::Texture1DArray) |
||
11690 | .Case("Texture2DArray", HLSLResourceAttr::Texture2DArray) |
||
11691 | .Case("Texture2DMSArray", HLSLResourceAttr::Texture2DMSArray) |
||
11692 | .Case("TextureCubeArray", HLSLResourceAttr::TextureCubeArray) |
||
11693 | .Case("TypedBuffer", HLSLResourceAttr::TypedBuffer) |
||
11694 | .Case("RawBuffer", HLSLResourceAttr::RawBuffer) |
||
11695 | .Case("StructuredBuffer", HLSLResourceAttr::StructuredBuffer) |
||
11696 | .Case("CBufferKind", HLSLResourceAttr::CBufferKind) |
||
11697 | .Case("SamplerKind", HLSLResourceAttr::SamplerKind) |
||
11698 | .Case("TBuffer", HLSLResourceAttr::TBuffer) |
||
11699 | .Case("RTAccelerationStructure", HLSLResourceAttr::RTAccelerationStructure) |
||
11700 | .Case("FeedbackTexture2D", HLSLResourceAttr::FeedbackTexture2D) |
||
11701 | .Case("FeedbackTexture2DArray", HLSLResourceAttr::FeedbackTexture2DArray) |
||
11702 | .Default(std::optional<ResourceKind>()); |
||
11703 | if (R) { |
||
11704 | Out = *R; |
||
11705 | return true; |
||
11706 | } |
||
11707 | return false; |
||
11708 | } |
||
11709 | |||
11710 | const char *HLSLResourceAttr::ConvertResourceKindToStr(ResourceKind Val) { |
||
11711 | switch(Val) { |
||
11712 | case HLSLResourceAttr::Texture1D: return "Texture1D"; |
||
11713 | case HLSLResourceAttr::Texture2D: return "Texture2D"; |
||
11714 | case HLSLResourceAttr::Texture2DMS: return "Texture2DMS"; |
||
11715 | case HLSLResourceAttr::Texture3D: return "Texture3D"; |
||
11716 | case HLSLResourceAttr::TextureCube: return "TextureCube"; |
||
11717 | case HLSLResourceAttr::Texture1DArray: return "Texture1DArray"; |
||
11718 | case HLSLResourceAttr::Texture2DArray: return "Texture2DArray"; |
||
11719 | case HLSLResourceAttr::Texture2DMSArray: return "Texture2DMSArray"; |
||
11720 | case HLSLResourceAttr::TextureCubeArray: return "TextureCubeArray"; |
||
11721 | case HLSLResourceAttr::TypedBuffer: return "TypedBuffer"; |
||
11722 | case HLSLResourceAttr::RawBuffer: return "RawBuffer"; |
||
11723 | case HLSLResourceAttr::StructuredBuffer: return "StructuredBuffer"; |
||
11724 | case HLSLResourceAttr::CBufferKind: return "CBufferKind"; |
||
11725 | case HLSLResourceAttr::SamplerKind: return "SamplerKind"; |
||
11726 | case HLSLResourceAttr::TBuffer: return "TBuffer"; |
||
11727 | case HLSLResourceAttr::RTAccelerationStructure: return "RTAccelerationStructure"; |
||
11728 | case HLSLResourceAttr::FeedbackTexture2D: return "FeedbackTexture2D"; |
||
11729 | case HLSLResourceAttr::FeedbackTexture2DArray: return "FeedbackTexture2DArray"; |
||
11730 | } |
||
11731 | llvm_unreachable("No enumerator with that value"); |
||
11732 | } |
||
11733 | HLSLResourceAttr *HLSLResourceAttr::clone(ASTContext &C) const { |
||
11734 | auto *A = new (C) HLSLResourceAttr(C, *this, resourceType, resourceShape); |
||
11735 | A->Inherited = Inherited; |
||
11736 | A->IsPackExpansion = IsPackExpansion; |
||
11737 | A->setImplicit(Implicit); |
||
11738 | return A; |
||
11739 | } |
||
11740 | |||
11741 | void HLSLResourceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11742 | } |
||
11743 | |||
11744 | const char *HLSLResourceAttr::getSpelling() const { |
||
11745 | return "(No spelling)"; |
||
11746 | } |
||
11747 | |||
11748 | |||
11749 | // HLSLResourceBindingAttr implementation |
||
11750 | |||
11751 | HLSLResourceBindingAttr *HLSLResourceBindingAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, const AttributeCommonInfo &CommonInfo) { |
||
11752 | auto *A = new (Ctx) HLSLResourceBindingAttr(Ctx, CommonInfo, Slot, Space); |
||
11753 | A->setImplicit(true); |
||
11754 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11755 | A->setAttributeSpellingListIndex(0); |
||
11756 | return A; |
||
11757 | } |
||
11758 | |||
11759 | HLSLResourceBindingAttr *HLSLResourceBindingAttr::Create(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, const AttributeCommonInfo &CommonInfo) { |
||
11760 | auto *A = new (Ctx) HLSLResourceBindingAttr(Ctx, CommonInfo, Slot, Space); |
||
11761 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11762 | A->setAttributeSpellingListIndex(0); |
||
11763 | return A; |
||
11764 | } |
||
11765 | |||
11766 | HLSLResourceBindingAttr *HLSLResourceBindingAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11767 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11768 | return CreateImplicit(Ctx, Slot, Space, I); |
||
11769 | } |
||
11770 | |||
11771 | HLSLResourceBindingAttr *HLSLResourceBindingAttr::Create(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11772 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11773 | return Create(Ctx, Slot, Space, I); |
||
11774 | } |
||
11775 | |||
11776 | HLSLResourceBindingAttr::HLSLResourceBindingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11777 | , llvm::StringRef Slot |
||
11778 | , llvm::StringRef Space |
||
11779 | ) |
||
11780 | : InheritableAttr(Ctx, CommonInfo, attr::HLSLResourceBinding, false, false) |
||
11781 | , slotLength(Slot.size()),slot(new (Ctx, 1) char[slotLength]) |
||
11782 | , spaceLength(Space.size()),space(new (Ctx, 1) char[spaceLength]) |
||
11783 | { |
||
11784 | if (!Slot.empty()) |
||
11785 | std::memcpy(slot, Slot.data(), slotLength); |
||
11786 | if (!Space.empty()) |
||
11787 | std::memcpy(space, Space.data(), spaceLength); |
||
11788 | } |
||
11789 | |||
11790 | HLSLResourceBindingAttr::HLSLResourceBindingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11791 | , llvm::StringRef Slot |
||
11792 | ) |
||
11793 | : InheritableAttr(Ctx, CommonInfo, attr::HLSLResourceBinding, false, false) |
||
11794 | , slotLength(Slot.size()),slot(new (Ctx, 1) char[slotLength]) |
||
11795 | , spaceLength(0),space(nullptr) |
||
11796 | { |
||
11797 | if (!Slot.empty()) |
||
11798 | std::memcpy(slot, Slot.data(), slotLength); |
||
11799 | } |
||
11800 | |||
11801 | |||
11802 | |||
11803 | |||
11804 | |||
11805 | HLSLResourceBindingAttr *HLSLResourceBindingAttr::clone(ASTContext &C) const { |
||
11806 | auto *A = new (C) HLSLResourceBindingAttr(C, *this, getSlot(), getSpace()); |
||
11807 | A->Inherited = Inherited; |
||
11808 | A->IsPackExpansion = IsPackExpansion; |
||
11809 | A->setImplicit(Implicit); |
||
11810 | return A; |
||
11811 | } |
||
11812 | |||
11813 | void HLSLResourceBindingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11814 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11815 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11816 | switch (getAttributeSpellingListIndex()) { |
||
11817 | default: |
||
11818 | llvm_unreachable("Unknown attribute spelling!"); |
||
11819 | break; |
||
11820 | case 0 : { |
||
11821 | OS << ":register"; |
||
11822 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11823 | OS << "\"" << getSlot() << "\""; |
||
11824 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
11825 | OS << "\"" << getSpace() << "\""; |
||
11826 | if (!IsFirstArgument) |
||
11827 | OS << ")"; |
||
11828 | OS << ""; |
||
11829 | break; |
||
11830 | } |
||
11831 | } |
||
11832 | } |
||
11833 | |||
11834 | const char *HLSLResourceBindingAttr::getSpelling() const { |
||
11835 | switch (getAttributeSpellingListIndex()) { |
||
11836 | default: |
||
11837 | llvm_unreachable("Unknown attribute spelling!"); |
||
11838 | return "(No spelling)"; |
||
11839 | case 0: |
||
11840 | return "register"; |
||
11841 | } |
||
11842 | } |
||
11843 | |||
11844 | |||
11845 | // HLSLSV_DispatchThreadIDAttr implementation |
||
11846 | |||
11847 | HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11848 | auto *A = new (Ctx) HLSLSV_DispatchThreadIDAttr(Ctx, CommonInfo); |
||
11849 | A->setImplicit(true); |
||
11850 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11851 | A->setAttributeSpellingListIndex(0); |
||
11852 | return A; |
||
11853 | } |
||
11854 | |||
11855 | HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11856 | auto *A = new (Ctx) HLSLSV_DispatchThreadIDAttr(Ctx, CommonInfo); |
||
11857 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11858 | A->setAttributeSpellingListIndex(0); |
||
11859 | return A; |
||
11860 | } |
||
11861 | |||
11862 | HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11863 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11864 | return CreateImplicit(Ctx, I); |
||
11865 | } |
||
11866 | |||
11867 | HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11868 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11869 | return Create(Ctx, I); |
||
11870 | } |
||
11871 | |||
11872 | HLSLSV_DispatchThreadIDAttr::HLSLSV_DispatchThreadIDAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11873 | ) |
||
11874 | : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLSV_DispatchThreadID, false, false) |
||
11875 | { |
||
11876 | } |
||
11877 | |||
11878 | HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::clone(ASTContext &C) const { |
||
11879 | auto *A = new (C) HLSLSV_DispatchThreadIDAttr(C, *this); |
||
11880 | A->Inherited = Inherited; |
||
11881 | A->IsPackExpansion = IsPackExpansion; |
||
11882 | A->setImplicit(Implicit); |
||
11883 | return A; |
||
11884 | } |
||
11885 | |||
11886 | void HLSLSV_DispatchThreadIDAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11887 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11888 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11889 | switch (getAttributeSpellingListIndex()) { |
||
11890 | default: |
||
11891 | llvm_unreachable("Unknown attribute spelling!"); |
||
11892 | break; |
||
11893 | case 0 : { |
||
11894 | OS << ":SV_DispatchThreadID"; |
||
11895 | OS << ""; |
||
11896 | break; |
||
11897 | } |
||
11898 | } |
||
11899 | } |
||
11900 | |||
11901 | const char *HLSLSV_DispatchThreadIDAttr::getSpelling() const { |
||
11902 | switch (getAttributeSpellingListIndex()) { |
||
11903 | default: |
||
11904 | llvm_unreachable("Unknown attribute spelling!"); |
||
11905 | return "(No spelling)"; |
||
11906 | case 0: |
||
11907 | return "SV_DispatchThreadID"; |
||
11908 | } |
||
11909 | } |
||
11910 | |||
11911 | |||
11912 | // HLSLSV_GroupIndexAttr implementation |
||
11913 | |||
11914 | HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11915 | auto *A = new (Ctx) HLSLSV_GroupIndexAttr(Ctx, CommonInfo); |
||
11916 | A->setImplicit(true); |
||
11917 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11918 | A->setAttributeSpellingListIndex(0); |
||
11919 | return A; |
||
11920 | } |
||
11921 | |||
11922 | HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
11923 | auto *A = new (Ctx) HLSLSV_GroupIndexAttr(Ctx, CommonInfo); |
||
11924 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11925 | A->setAttributeSpellingListIndex(0); |
||
11926 | return A; |
||
11927 | } |
||
11928 | |||
11929 | HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11930 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11931 | return CreateImplicit(Ctx, I); |
||
11932 | } |
||
11933 | |||
11934 | HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11935 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11936 | return Create(Ctx, I); |
||
11937 | } |
||
11938 | |||
11939 | HLSLSV_GroupIndexAttr::HLSLSV_GroupIndexAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
11940 | ) |
||
11941 | : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLSV_GroupIndex, false, false) |
||
11942 | { |
||
11943 | } |
||
11944 | |||
11945 | HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::clone(ASTContext &C) const { |
||
11946 | auto *A = new (C) HLSLSV_GroupIndexAttr(C, *this); |
||
11947 | A->Inherited = Inherited; |
||
11948 | A->IsPackExpansion = IsPackExpansion; |
||
11949 | A->setImplicit(Implicit); |
||
11950 | return A; |
||
11951 | } |
||
11952 | |||
11953 | void HLSLSV_GroupIndexAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
11954 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
11955 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
11956 | switch (getAttributeSpellingListIndex()) { |
||
11957 | default: |
||
11958 | llvm_unreachable("Unknown attribute spelling!"); |
||
11959 | break; |
||
11960 | case 0 : { |
||
11961 | OS << ":SV_GroupIndex"; |
||
11962 | OS << ""; |
||
11963 | break; |
||
11964 | } |
||
11965 | } |
||
11966 | } |
||
11967 | |||
11968 | const char *HLSLSV_GroupIndexAttr::getSpelling() const { |
||
11969 | switch (getAttributeSpellingListIndex()) { |
||
11970 | default: |
||
11971 | llvm_unreachable("Unknown attribute spelling!"); |
||
11972 | return "(No spelling)"; |
||
11973 | case 0: |
||
11974 | return "SV_GroupIndex"; |
||
11975 | } |
||
11976 | } |
||
11977 | |||
11978 | |||
11979 | // HLSLShaderAttr implementation |
||
11980 | |||
11981 | HLSLShaderAttr *HLSLShaderAttr::CreateImplicit(ASTContext &Ctx, ShaderType Type, const AttributeCommonInfo &CommonInfo) { |
||
11982 | auto *A = new (Ctx) HLSLShaderAttr(Ctx, CommonInfo, Type); |
||
11983 | A->setImplicit(true); |
||
11984 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11985 | A->setAttributeSpellingListIndex(0); |
||
11986 | return A; |
||
11987 | } |
||
11988 | |||
11989 | HLSLShaderAttr *HLSLShaderAttr::Create(ASTContext &Ctx, ShaderType Type, const AttributeCommonInfo &CommonInfo) { |
||
11990 | auto *A = new (Ctx) HLSLShaderAttr(Ctx, CommonInfo, Type); |
||
11991 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
11992 | A->setAttributeSpellingListIndex(0); |
||
11993 | return A; |
||
11994 | } |
||
11995 | |||
11996 | HLSLShaderAttr *HLSLShaderAttr::CreateImplicit(ASTContext &Ctx, ShaderType Type, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
11997 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
11998 | return CreateImplicit(Ctx, Type, I); |
||
11999 | } |
||
12000 | |||
12001 | HLSLShaderAttr *HLSLShaderAttr::Create(ASTContext &Ctx, ShaderType Type, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12002 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12003 | return Create(Ctx, Type, I); |
||
12004 | } |
||
12005 | |||
12006 | HLSLShaderAttr::HLSLShaderAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12007 | , ShaderType Type |
||
12008 | ) |
||
12009 | : InheritableAttr(Ctx, CommonInfo, attr::HLSLShader, false, false) |
||
12010 | , type(Type) |
||
12011 | { |
||
12012 | } |
||
12013 | |||
12014 | |||
12015 | |||
12016 | bool HLSLShaderAttr::ConvertStrToShaderType(StringRef Val, ShaderType &Out) { |
||
12017 | std::optional<ShaderType> R = llvm::StringSwitch<std::optional<ShaderType>>(Val) |
||
12018 | .Case("pixel", HLSLShaderAttr::Pixel) |
||
12019 | .Case("vertex", HLSLShaderAttr::Vertex) |
||
12020 | .Case("geometry", HLSLShaderAttr::Geometry) |
||
12021 | .Case("hull", HLSLShaderAttr::Hull) |
||
12022 | .Case("domain", HLSLShaderAttr::Domain) |
||
12023 | .Case("compute", HLSLShaderAttr::Compute) |
||
12024 | .Case("library", HLSLShaderAttr::Library) |
||
12025 | .Case("raygeneration", HLSLShaderAttr::RayGeneration) |
||
12026 | .Case("intersection", HLSLShaderAttr::Intersection) |
||
12027 | .Case("anyHit", HLSLShaderAttr::AnyHit) |
||
12028 | .Case("closestHit", HLSLShaderAttr::ClosestHit) |
||
12029 | .Case("miss", HLSLShaderAttr::Miss) |
||
12030 | .Case("callable", HLSLShaderAttr::Callable) |
||
12031 | .Case("mesh", HLSLShaderAttr::Mesh) |
||
12032 | .Case("amplification", HLSLShaderAttr::Amplification) |
||
12033 | .Default(std::optional<ShaderType>()); |
||
12034 | if (R) { |
||
12035 | Out = *R; |
||
12036 | return true; |
||
12037 | } |
||
12038 | return false; |
||
12039 | } |
||
12040 | |||
12041 | const char *HLSLShaderAttr::ConvertShaderTypeToStr(ShaderType Val) { |
||
12042 | switch(Val) { |
||
12043 | case HLSLShaderAttr::Pixel: return "pixel"; |
||
12044 | case HLSLShaderAttr::Vertex: return "vertex"; |
||
12045 | case HLSLShaderAttr::Geometry: return "geometry"; |
||
12046 | case HLSLShaderAttr::Hull: return "hull"; |
||
12047 | case HLSLShaderAttr::Domain: return "domain"; |
||
12048 | case HLSLShaderAttr::Compute: return "compute"; |
||
12049 | case HLSLShaderAttr::Library: return "library"; |
||
12050 | case HLSLShaderAttr::RayGeneration: return "raygeneration"; |
||
12051 | case HLSLShaderAttr::Intersection: return "intersection"; |
||
12052 | case HLSLShaderAttr::AnyHit: return "anyHit"; |
||
12053 | case HLSLShaderAttr::ClosestHit: return "closestHit"; |
||
12054 | case HLSLShaderAttr::Miss: return "miss"; |
||
12055 | case HLSLShaderAttr::Callable: return "callable"; |
||
12056 | case HLSLShaderAttr::Mesh: return "mesh"; |
||
12057 | case HLSLShaderAttr::Amplification: return "amplification"; |
||
12058 | } |
||
12059 | llvm_unreachable("No enumerator with that value"); |
||
12060 | } |
||
12061 | HLSLShaderAttr *HLSLShaderAttr::clone(ASTContext &C) const { |
||
12062 | auto *A = new (C) HLSLShaderAttr(C, *this, type); |
||
12063 | A->Inherited = Inherited; |
||
12064 | A->IsPackExpansion = IsPackExpansion; |
||
12065 | A->setImplicit(Implicit); |
||
12066 | return A; |
||
12067 | } |
||
12068 | |||
12069 | void HLSLShaderAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12070 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12071 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12072 | switch (getAttributeSpellingListIndex()) { |
||
12073 | default: |
||
12074 | llvm_unreachable("Unknown attribute spelling!"); |
||
12075 | break; |
||
12076 | case 0 : { |
||
12077 | OS << "[shader"; |
||
12078 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
12079 | OS << "\"" << HLSLShaderAttr::ConvertShaderTypeToStr(getType()) << "\""; |
||
12080 | if (!IsFirstArgument) |
||
12081 | OS << ")"; |
||
12082 | OS << "]"; |
||
12083 | break; |
||
12084 | } |
||
12085 | } |
||
12086 | } |
||
12087 | |||
12088 | const char *HLSLShaderAttr::getSpelling() const { |
||
12089 | switch (getAttributeSpellingListIndex()) { |
||
12090 | default: |
||
12091 | llvm_unreachable("Unknown attribute spelling!"); |
||
12092 | return "(No spelling)"; |
||
12093 | case 0: |
||
12094 | return "shader"; |
||
12095 | } |
||
12096 | } |
||
12097 | |||
12098 | |||
12099 | // HotAttr implementation |
||
12100 | |||
12101 | HotAttr *HotAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12102 | auto *A = new (Ctx) HotAttr(Ctx, CommonInfo); |
||
12103 | A->setImplicit(true); |
||
12104 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12105 | A->setAttributeSpellingListIndex(0); |
||
12106 | return A; |
||
12107 | } |
||
12108 | |||
12109 | HotAttr *HotAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12110 | auto *A = new (Ctx) HotAttr(Ctx, CommonInfo); |
||
12111 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12112 | A->setAttributeSpellingListIndex(0); |
||
12113 | return A; |
||
12114 | } |
||
12115 | |||
12116 | HotAttr *HotAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12117 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12118 | return CreateImplicit(Ctx, I); |
||
12119 | } |
||
12120 | |||
12121 | HotAttr *HotAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12122 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12123 | return Create(Ctx, I); |
||
12124 | } |
||
12125 | |||
12126 | HotAttr::HotAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12127 | ) |
||
12128 | : InheritableAttr(Ctx, CommonInfo, attr::Hot, false, false) |
||
12129 | { |
||
12130 | } |
||
12131 | |||
12132 | HotAttr *HotAttr::clone(ASTContext &C) const { |
||
12133 | auto *A = new (C) HotAttr(C, *this); |
||
12134 | A->Inherited = Inherited; |
||
12135 | A->IsPackExpansion = IsPackExpansion; |
||
12136 | A->setImplicit(Implicit); |
||
12137 | return A; |
||
12138 | } |
||
12139 | |||
12140 | void HotAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12141 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12142 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12143 | switch (getAttributeSpellingListIndex()) { |
||
12144 | default: |
||
12145 | llvm_unreachable("Unknown attribute spelling!"); |
||
12146 | break; |
||
12147 | case 0 : { |
||
12148 | OS << " __attribute__((hot"; |
||
12149 | OS << "))"; |
||
12150 | break; |
||
12151 | } |
||
12152 | case 1 : { |
||
12153 | OS << " [[gnu::hot"; |
||
12154 | OS << "]]"; |
||
12155 | break; |
||
12156 | } |
||
12157 | case 2 : { |
||
12158 | OS << " [[gnu::hot"; |
||
12159 | OS << "]]"; |
||
12160 | break; |
||
12161 | } |
||
12162 | } |
||
12163 | } |
||
12164 | |||
12165 | const char *HotAttr::getSpelling() const { |
||
12166 | switch (getAttributeSpellingListIndex()) { |
||
12167 | default: |
||
12168 | llvm_unreachable("Unknown attribute spelling!"); |
||
12169 | return "(No spelling)"; |
||
12170 | case 0: |
||
12171 | return "hot"; |
||
12172 | case 1: |
||
12173 | return "hot"; |
||
12174 | case 2: |
||
12175 | return "hot"; |
||
12176 | } |
||
12177 | } |
||
12178 | |||
12179 | |||
12180 | // IBActionAttr implementation |
||
12181 | |||
12182 | IBActionAttr *IBActionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12183 | auto *A = new (Ctx) IBActionAttr(Ctx, CommonInfo); |
||
12184 | A->setImplicit(true); |
||
12185 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12186 | A->setAttributeSpellingListIndex(0); |
||
12187 | return A; |
||
12188 | } |
||
12189 | |||
12190 | IBActionAttr *IBActionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12191 | auto *A = new (Ctx) IBActionAttr(Ctx, CommonInfo); |
||
12192 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12193 | A->setAttributeSpellingListIndex(0); |
||
12194 | return A; |
||
12195 | } |
||
12196 | |||
12197 | IBActionAttr *IBActionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12198 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12199 | return CreateImplicit(Ctx, I); |
||
12200 | } |
||
12201 | |||
12202 | IBActionAttr *IBActionAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12203 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12204 | return Create(Ctx, I); |
||
12205 | } |
||
12206 | |||
12207 | IBActionAttr::IBActionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12208 | ) |
||
12209 | : InheritableAttr(Ctx, CommonInfo, attr::IBAction, false, false) |
||
12210 | { |
||
12211 | } |
||
12212 | |||
12213 | IBActionAttr *IBActionAttr::clone(ASTContext &C) const { |
||
12214 | auto *A = new (C) IBActionAttr(C, *this); |
||
12215 | A->Inherited = Inherited; |
||
12216 | A->IsPackExpansion = IsPackExpansion; |
||
12217 | A->setImplicit(Implicit); |
||
12218 | return A; |
||
12219 | } |
||
12220 | |||
12221 | void IBActionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12222 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12223 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12224 | switch (getAttributeSpellingListIndex()) { |
||
12225 | default: |
||
12226 | llvm_unreachable("Unknown attribute spelling!"); |
||
12227 | break; |
||
12228 | case 0 : { |
||
12229 | OS << " __attribute__((ibaction"; |
||
12230 | OS << "))"; |
||
12231 | break; |
||
12232 | } |
||
12233 | case 1 : { |
||
12234 | OS << " [[clang::ibaction"; |
||
12235 | OS << "]]"; |
||
12236 | break; |
||
12237 | } |
||
12238 | case 2 : { |
||
12239 | OS << " [[clang::ibaction"; |
||
12240 | OS << "]]"; |
||
12241 | break; |
||
12242 | } |
||
12243 | } |
||
12244 | } |
||
12245 | |||
12246 | const char *IBActionAttr::getSpelling() const { |
||
12247 | switch (getAttributeSpellingListIndex()) { |
||
12248 | default: |
||
12249 | llvm_unreachable("Unknown attribute spelling!"); |
||
12250 | return "(No spelling)"; |
||
12251 | case 0: |
||
12252 | return "ibaction"; |
||
12253 | case 1: |
||
12254 | return "ibaction"; |
||
12255 | case 2: |
||
12256 | return "ibaction"; |
||
12257 | } |
||
12258 | } |
||
12259 | |||
12260 | |||
12261 | // IBOutletAttr implementation |
||
12262 | |||
12263 | IBOutletAttr *IBOutletAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12264 | auto *A = new (Ctx) IBOutletAttr(Ctx, CommonInfo); |
||
12265 | A->setImplicit(true); |
||
12266 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12267 | A->setAttributeSpellingListIndex(0); |
||
12268 | return A; |
||
12269 | } |
||
12270 | |||
12271 | IBOutletAttr *IBOutletAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12272 | auto *A = new (Ctx) IBOutletAttr(Ctx, CommonInfo); |
||
12273 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12274 | A->setAttributeSpellingListIndex(0); |
||
12275 | return A; |
||
12276 | } |
||
12277 | |||
12278 | IBOutletAttr *IBOutletAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12279 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12280 | return CreateImplicit(Ctx, I); |
||
12281 | } |
||
12282 | |||
12283 | IBOutletAttr *IBOutletAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12284 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12285 | return Create(Ctx, I); |
||
12286 | } |
||
12287 | |||
12288 | IBOutletAttr::IBOutletAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12289 | ) |
||
12290 | : InheritableAttr(Ctx, CommonInfo, attr::IBOutlet, false, false) |
||
12291 | { |
||
12292 | } |
||
12293 | |||
12294 | IBOutletAttr *IBOutletAttr::clone(ASTContext &C) const { |
||
12295 | auto *A = new (C) IBOutletAttr(C, *this); |
||
12296 | A->Inherited = Inherited; |
||
12297 | A->IsPackExpansion = IsPackExpansion; |
||
12298 | A->setImplicit(Implicit); |
||
12299 | return A; |
||
12300 | } |
||
12301 | |||
12302 | void IBOutletAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12303 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12304 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12305 | switch (getAttributeSpellingListIndex()) { |
||
12306 | default: |
||
12307 | llvm_unreachable("Unknown attribute spelling!"); |
||
12308 | break; |
||
12309 | case 0 : { |
||
12310 | OS << " __attribute__((iboutlet"; |
||
12311 | OS << "))"; |
||
12312 | break; |
||
12313 | } |
||
12314 | case 1 : { |
||
12315 | OS << " [[clang::iboutlet"; |
||
12316 | OS << "]]"; |
||
12317 | break; |
||
12318 | } |
||
12319 | case 2 : { |
||
12320 | OS << " [[clang::iboutlet"; |
||
12321 | OS << "]]"; |
||
12322 | break; |
||
12323 | } |
||
12324 | } |
||
12325 | } |
||
12326 | |||
12327 | const char *IBOutletAttr::getSpelling() const { |
||
12328 | switch (getAttributeSpellingListIndex()) { |
||
12329 | default: |
||
12330 | llvm_unreachable("Unknown attribute spelling!"); |
||
12331 | return "(No spelling)"; |
||
12332 | case 0: |
||
12333 | return "iboutlet"; |
||
12334 | case 1: |
||
12335 | return "iboutlet"; |
||
12336 | case 2: |
||
12337 | return "iboutlet"; |
||
12338 | } |
||
12339 | } |
||
12340 | |||
12341 | |||
12342 | // IBOutletCollectionAttr implementation |
||
12343 | |||
12344 | IBOutletCollectionAttr *IBOutletCollectionAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Interface, const AttributeCommonInfo &CommonInfo) { |
||
12345 | auto *A = new (Ctx) IBOutletCollectionAttr(Ctx, CommonInfo, Interface); |
||
12346 | A->setImplicit(true); |
||
12347 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12348 | A->setAttributeSpellingListIndex(0); |
||
12349 | return A; |
||
12350 | } |
||
12351 | |||
12352 | IBOutletCollectionAttr *IBOutletCollectionAttr::Create(ASTContext &Ctx, TypeSourceInfo * Interface, const AttributeCommonInfo &CommonInfo) { |
||
12353 | auto *A = new (Ctx) IBOutletCollectionAttr(Ctx, CommonInfo, Interface); |
||
12354 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12355 | A->setAttributeSpellingListIndex(0); |
||
12356 | return A; |
||
12357 | } |
||
12358 | |||
12359 | IBOutletCollectionAttr *IBOutletCollectionAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Interface, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12360 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12361 | return CreateImplicit(Ctx, Interface, I); |
||
12362 | } |
||
12363 | |||
12364 | IBOutletCollectionAttr *IBOutletCollectionAttr::Create(ASTContext &Ctx, TypeSourceInfo * Interface, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12365 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12366 | return Create(Ctx, Interface, I); |
||
12367 | } |
||
12368 | |||
12369 | IBOutletCollectionAttr::IBOutletCollectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12370 | , TypeSourceInfo * Interface |
||
12371 | ) |
||
12372 | : InheritableAttr(Ctx, CommonInfo, attr::IBOutletCollection, false, false) |
||
12373 | , interface_(Interface) |
||
12374 | { |
||
12375 | } |
||
12376 | |||
12377 | IBOutletCollectionAttr::IBOutletCollectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12378 | ) |
||
12379 | : InheritableAttr(Ctx, CommonInfo, attr::IBOutletCollection, false, false) |
||
12380 | , interface_() |
||
12381 | { |
||
12382 | } |
||
12383 | |||
12384 | |||
12385 | |||
12386 | IBOutletCollectionAttr *IBOutletCollectionAttr::clone(ASTContext &C) const { |
||
12387 | auto *A = new (C) IBOutletCollectionAttr(C, *this, interface_); |
||
12388 | A->Inherited = Inherited; |
||
12389 | A->IsPackExpansion = IsPackExpansion; |
||
12390 | A->setImplicit(Implicit); |
||
12391 | return A; |
||
12392 | } |
||
12393 | |||
12394 | void IBOutletCollectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12395 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12396 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12397 | switch (getAttributeSpellingListIndex()) { |
||
12398 | default: |
||
12399 | llvm_unreachable("Unknown attribute spelling!"); |
||
12400 | break; |
||
12401 | case 0 : { |
||
12402 | OS << " __attribute__((iboutletcollection"; |
||
12403 | if (!getInterfaceLoc()) |
||
12404 | ++TrailingOmittedArgs; |
||
12405 | if (!(!getInterfaceLoc())) { |
||
12406 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
12407 | OS << "" << getInterface().getAsString() << ""; |
||
12408 | } |
||
12409 | if (!IsFirstArgument) |
||
12410 | OS << ")"; |
||
12411 | OS << "))"; |
||
12412 | break; |
||
12413 | } |
||
12414 | case 1 : { |
||
12415 | OS << " [[clang::iboutletcollection"; |
||
12416 | if (!getInterfaceLoc()) |
||
12417 | ++TrailingOmittedArgs; |
||
12418 | if (!(!getInterfaceLoc())) { |
||
12419 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
12420 | OS << "" << getInterface().getAsString() << ""; |
||
12421 | } |
||
12422 | if (!IsFirstArgument) |
||
12423 | OS << ")"; |
||
12424 | OS << "]]"; |
||
12425 | break; |
||
12426 | } |
||
12427 | case 2 : { |
||
12428 | OS << " [[clang::iboutletcollection"; |
||
12429 | if (!getInterfaceLoc()) |
||
12430 | ++TrailingOmittedArgs; |
||
12431 | if (!(!getInterfaceLoc())) { |
||
12432 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
12433 | OS << "" << getInterface().getAsString() << ""; |
||
12434 | } |
||
12435 | if (!IsFirstArgument) |
||
12436 | OS << ")"; |
||
12437 | OS << "]]"; |
||
12438 | break; |
||
12439 | } |
||
12440 | } |
||
12441 | } |
||
12442 | |||
12443 | const char *IBOutletCollectionAttr::getSpelling() const { |
||
12444 | switch (getAttributeSpellingListIndex()) { |
||
12445 | default: |
||
12446 | llvm_unreachable("Unknown attribute spelling!"); |
||
12447 | return "(No spelling)"; |
||
12448 | case 0: |
||
12449 | return "iboutletcollection"; |
||
12450 | case 1: |
||
12451 | return "iboutletcollection"; |
||
12452 | case 2: |
||
12453 | return "iboutletcollection"; |
||
12454 | } |
||
12455 | } |
||
12456 | |||
12457 | |||
12458 | // IFuncAttr implementation |
||
12459 | |||
12460 | IFuncAttr *IFuncAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Resolver, const AttributeCommonInfo &CommonInfo) { |
||
12461 | auto *A = new (Ctx) IFuncAttr(Ctx, CommonInfo, Resolver); |
||
12462 | A->setImplicit(true); |
||
12463 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12464 | A->setAttributeSpellingListIndex(0); |
||
12465 | return A; |
||
12466 | } |
||
12467 | |||
12468 | IFuncAttr *IFuncAttr::Create(ASTContext &Ctx, llvm::StringRef Resolver, const AttributeCommonInfo &CommonInfo) { |
||
12469 | auto *A = new (Ctx) IFuncAttr(Ctx, CommonInfo, Resolver); |
||
12470 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12471 | A->setAttributeSpellingListIndex(0); |
||
12472 | return A; |
||
12473 | } |
||
12474 | |||
12475 | IFuncAttr *IFuncAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Resolver, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12476 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12477 | return CreateImplicit(Ctx, Resolver, I); |
||
12478 | } |
||
12479 | |||
12480 | IFuncAttr *IFuncAttr::Create(ASTContext &Ctx, llvm::StringRef Resolver, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12481 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12482 | return Create(Ctx, Resolver, I); |
||
12483 | } |
||
12484 | |||
12485 | IFuncAttr::IFuncAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12486 | , llvm::StringRef Resolver |
||
12487 | ) |
||
12488 | : Attr(Ctx, CommonInfo, attr::IFunc, false) |
||
12489 | , resolverLength(Resolver.size()),resolver(new (Ctx, 1) char[resolverLength]) |
||
12490 | { |
||
12491 | if (!Resolver.empty()) |
||
12492 | std::memcpy(resolver, Resolver.data(), resolverLength); |
||
12493 | } |
||
12494 | |||
12495 | |||
12496 | |||
12497 | IFuncAttr *IFuncAttr::clone(ASTContext &C) const { |
||
12498 | auto *A = new (C) IFuncAttr(C, *this, getResolver()); |
||
12499 | A->Inherited = Inherited; |
||
12500 | A->IsPackExpansion = IsPackExpansion; |
||
12501 | A->setImplicit(Implicit); |
||
12502 | return A; |
||
12503 | } |
||
12504 | |||
12505 | void IFuncAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12506 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12507 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12508 | switch (getAttributeSpellingListIndex()) { |
||
12509 | default: |
||
12510 | llvm_unreachable("Unknown attribute spelling!"); |
||
12511 | break; |
||
12512 | case 0 : { |
||
12513 | OS << " __attribute__((ifunc"; |
||
12514 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
12515 | OS << "\"" << getResolver() << "\""; |
||
12516 | if (!IsFirstArgument) |
||
12517 | OS << ")"; |
||
12518 | OS << "))"; |
||
12519 | break; |
||
12520 | } |
||
12521 | case 1 : { |
||
12522 | OS << " [[gnu::ifunc"; |
||
12523 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
12524 | OS << "\"" << getResolver() << "\""; |
||
12525 | if (!IsFirstArgument) |
||
12526 | OS << ")"; |
||
12527 | OS << "]]"; |
||
12528 | break; |
||
12529 | } |
||
12530 | case 2 : { |
||
12531 | OS << " [[gnu::ifunc"; |
||
12532 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
12533 | OS << "\"" << getResolver() << "\""; |
||
12534 | if (!IsFirstArgument) |
||
12535 | OS << ")"; |
||
12536 | OS << "]]"; |
||
12537 | break; |
||
12538 | } |
||
12539 | } |
||
12540 | } |
||
12541 | |||
12542 | const char *IFuncAttr::getSpelling() const { |
||
12543 | switch (getAttributeSpellingListIndex()) { |
||
12544 | default: |
||
12545 | llvm_unreachable("Unknown attribute spelling!"); |
||
12546 | return "(No spelling)"; |
||
12547 | case 0: |
||
12548 | return "ifunc"; |
||
12549 | case 1: |
||
12550 | return "ifunc"; |
||
12551 | case 2: |
||
12552 | return "ifunc"; |
||
12553 | } |
||
12554 | } |
||
12555 | |||
12556 | |||
12557 | // InitPriorityAttr implementation |
||
12558 | |||
12559 | InitPriorityAttr *InitPriorityAttr::CreateImplicit(ASTContext &Ctx, unsigned Priority, const AttributeCommonInfo &CommonInfo) { |
||
12560 | auto *A = new (Ctx) InitPriorityAttr(Ctx, CommonInfo, Priority); |
||
12561 | A->setImplicit(true); |
||
12562 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12563 | A->setAttributeSpellingListIndex(0); |
||
12564 | return A; |
||
12565 | } |
||
12566 | |||
12567 | InitPriorityAttr *InitPriorityAttr::Create(ASTContext &Ctx, unsigned Priority, const AttributeCommonInfo &CommonInfo) { |
||
12568 | auto *A = new (Ctx) InitPriorityAttr(Ctx, CommonInfo, Priority); |
||
12569 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12570 | A->setAttributeSpellingListIndex(0); |
||
12571 | return A; |
||
12572 | } |
||
12573 | |||
12574 | InitPriorityAttr *InitPriorityAttr::CreateImplicit(ASTContext &Ctx, unsigned Priority, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12575 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12576 | return CreateImplicit(Ctx, Priority, I); |
||
12577 | } |
||
12578 | |||
12579 | InitPriorityAttr *InitPriorityAttr::Create(ASTContext &Ctx, unsigned Priority, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12580 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12581 | return Create(Ctx, Priority, I); |
||
12582 | } |
||
12583 | |||
12584 | InitPriorityAttr::InitPriorityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12585 | , unsigned Priority |
||
12586 | ) |
||
12587 | : InheritableAttr(Ctx, CommonInfo, attr::InitPriority, false, false) |
||
12588 | , priority(Priority) |
||
12589 | { |
||
12590 | } |
||
12591 | |||
12592 | |||
12593 | |||
12594 | InitPriorityAttr *InitPriorityAttr::clone(ASTContext &C) const { |
||
12595 | auto *A = new (C) InitPriorityAttr(C, *this, priority); |
||
12596 | A->Inherited = Inherited; |
||
12597 | A->IsPackExpansion = IsPackExpansion; |
||
12598 | A->setImplicit(Implicit); |
||
12599 | return A; |
||
12600 | } |
||
12601 | |||
12602 | void InitPriorityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12603 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12604 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12605 | switch (getAttributeSpellingListIndex()) { |
||
12606 | default: |
||
12607 | llvm_unreachable("Unknown attribute spelling!"); |
||
12608 | break; |
||
12609 | case 0 : { |
||
12610 | OS << " __attribute__((init_priority"; |
||
12611 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
12612 | OS << "" << getPriority() << ""; |
||
12613 | if (!IsFirstArgument) |
||
12614 | OS << ")"; |
||
12615 | OS << "))"; |
||
12616 | break; |
||
12617 | } |
||
12618 | case 1 : { |
||
12619 | OS << " [[gnu::init_priority"; |
||
12620 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
12621 | OS << "" << getPriority() << ""; |
||
12622 | if (!IsFirstArgument) |
||
12623 | OS << ")"; |
||
12624 | OS << "]]"; |
||
12625 | break; |
||
12626 | } |
||
12627 | } |
||
12628 | } |
||
12629 | |||
12630 | const char *InitPriorityAttr::getSpelling() const { |
||
12631 | switch (getAttributeSpellingListIndex()) { |
||
12632 | default: |
||
12633 | llvm_unreachable("Unknown attribute spelling!"); |
||
12634 | return "(No spelling)"; |
||
12635 | case 0: |
||
12636 | return "init_priority"; |
||
12637 | case 1: |
||
12638 | return "init_priority"; |
||
12639 | } |
||
12640 | } |
||
12641 | |||
12642 | |||
12643 | // InitSegAttr implementation |
||
12644 | |||
12645 | InitSegAttr *InitSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Section, const AttributeCommonInfo &CommonInfo) { |
||
12646 | auto *A = new (Ctx) InitSegAttr(Ctx, CommonInfo, Section); |
||
12647 | A->setImplicit(true); |
||
12648 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12649 | A->setAttributeSpellingListIndex(0); |
||
12650 | return A; |
||
12651 | } |
||
12652 | |||
12653 | InitSegAttr *InitSegAttr::Create(ASTContext &Ctx, llvm::StringRef Section, const AttributeCommonInfo &CommonInfo) { |
||
12654 | auto *A = new (Ctx) InitSegAttr(Ctx, CommonInfo, Section); |
||
12655 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12656 | A->setAttributeSpellingListIndex(0); |
||
12657 | return A; |
||
12658 | } |
||
12659 | |||
12660 | InitSegAttr *InitSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Section, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12661 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12662 | return CreateImplicit(Ctx, Section, I); |
||
12663 | } |
||
12664 | |||
12665 | InitSegAttr *InitSegAttr::Create(ASTContext &Ctx, llvm::StringRef Section, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12666 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12667 | return Create(Ctx, Section, I); |
||
12668 | } |
||
12669 | |||
12670 | InitSegAttr::InitSegAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12671 | , llvm::StringRef Section |
||
12672 | ) |
||
12673 | : Attr(Ctx, CommonInfo, attr::InitSeg, false) |
||
12674 | , sectionLength(Section.size()),section(new (Ctx, 1) char[sectionLength]) |
||
12675 | { |
||
12676 | if (!Section.empty()) |
||
12677 | std::memcpy(section, Section.data(), sectionLength); |
||
12678 | } |
||
12679 | |||
12680 | |||
12681 | |||
12682 | InitSegAttr *InitSegAttr::clone(ASTContext &C) const { |
||
12683 | auto *A = new (C) InitSegAttr(C, *this, getSection()); |
||
12684 | A->Inherited = Inherited; |
||
12685 | A->IsPackExpansion = IsPackExpansion; |
||
12686 | A->setImplicit(Implicit); |
||
12687 | return A; |
||
12688 | } |
||
12689 | |||
12690 | void InitSegAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12691 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12692 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12693 | switch (getAttributeSpellingListIndex()) { |
||
12694 | default: |
||
12695 | llvm_unreachable("Unknown attribute spelling!"); |
||
12696 | break; |
||
12697 | case 0 : { |
||
12698 | OS << "#pragma init_seg"; |
||
12699 | printPrettyPragma(OS, Policy); |
||
12700 | OS << "\n"; break; |
||
12701 | } |
||
12702 | } |
||
12703 | } |
||
12704 | |||
12705 | const char *InitSegAttr::getSpelling() const { |
||
12706 | switch (getAttributeSpellingListIndex()) { |
||
12707 | default: |
||
12708 | llvm_unreachable("Unknown attribute spelling!"); |
||
12709 | return "(No spelling)"; |
||
12710 | case 0: |
||
12711 | return "init_seg"; |
||
12712 | } |
||
12713 | } |
||
12714 | |||
12715 | |||
12716 | // IntelOclBiccAttr implementation |
||
12717 | |||
12718 | IntelOclBiccAttr *IntelOclBiccAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12719 | auto *A = new (Ctx) IntelOclBiccAttr(Ctx, CommonInfo); |
||
12720 | A->setImplicit(true); |
||
12721 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12722 | A->setAttributeSpellingListIndex(0); |
||
12723 | return A; |
||
12724 | } |
||
12725 | |||
12726 | IntelOclBiccAttr *IntelOclBiccAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12727 | auto *A = new (Ctx) IntelOclBiccAttr(Ctx, CommonInfo); |
||
12728 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12729 | A->setAttributeSpellingListIndex(0); |
||
12730 | return A; |
||
12731 | } |
||
12732 | |||
12733 | IntelOclBiccAttr *IntelOclBiccAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12734 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12735 | return CreateImplicit(Ctx, I); |
||
12736 | } |
||
12737 | |||
12738 | IntelOclBiccAttr *IntelOclBiccAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12739 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12740 | return Create(Ctx, I); |
||
12741 | } |
||
12742 | |||
12743 | IntelOclBiccAttr::IntelOclBiccAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12744 | ) |
||
12745 | : InheritableAttr(Ctx, CommonInfo, attr::IntelOclBicc, false, false) |
||
12746 | { |
||
12747 | } |
||
12748 | |||
12749 | IntelOclBiccAttr *IntelOclBiccAttr::clone(ASTContext &C) const { |
||
12750 | auto *A = new (C) IntelOclBiccAttr(C, *this); |
||
12751 | A->Inherited = Inherited; |
||
12752 | A->IsPackExpansion = IsPackExpansion; |
||
12753 | A->setImplicit(Implicit); |
||
12754 | return A; |
||
12755 | } |
||
12756 | |||
12757 | void IntelOclBiccAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12758 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12759 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12760 | switch (getAttributeSpellingListIndex()) { |
||
12761 | default: |
||
12762 | llvm_unreachable("Unknown attribute spelling!"); |
||
12763 | break; |
||
12764 | case 0 : { |
||
12765 | OS << " __attribute__((intel_ocl_bicc"; |
||
12766 | OS << "))"; |
||
12767 | break; |
||
12768 | } |
||
12769 | case 1 : { |
||
12770 | OS << " [[clang::intel_ocl_bicc"; |
||
12771 | OS << "]]"; |
||
12772 | break; |
||
12773 | } |
||
12774 | } |
||
12775 | } |
||
12776 | |||
12777 | const char *IntelOclBiccAttr::getSpelling() const { |
||
12778 | switch (getAttributeSpellingListIndex()) { |
||
12779 | default: |
||
12780 | llvm_unreachable("Unknown attribute spelling!"); |
||
12781 | return "(No spelling)"; |
||
12782 | case 0: |
||
12783 | return "intel_ocl_bicc"; |
||
12784 | case 1: |
||
12785 | return "intel_ocl_bicc"; |
||
12786 | } |
||
12787 | } |
||
12788 | |||
12789 | |||
12790 | // InternalLinkageAttr implementation |
||
12791 | |||
12792 | InternalLinkageAttr *InternalLinkageAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12793 | auto *A = new (Ctx) InternalLinkageAttr(Ctx, CommonInfo); |
||
12794 | A->setImplicit(true); |
||
12795 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12796 | A->setAttributeSpellingListIndex(0); |
||
12797 | return A; |
||
12798 | } |
||
12799 | |||
12800 | InternalLinkageAttr *InternalLinkageAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12801 | auto *A = new (Ctx) InternalLinkageAttr(Ctx, CommonInfo); |
||
12802 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12803 | A->setAttributeSpellingListIndex(0); |
||
12804 | return A; |
||
12805 | } |
||
12806 | |||
12807 | InternalLinkageAttr *InternalLinkageAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12808 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12809 | return CreateImplicit(Ctx, I); |
||
12810 | } |
||
12811 | |||
12812 | InternalLinkageAttr *InternalLinkageAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12813 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12814 | return Create(Ctx, I); |
||
12815 | } |
||
12816 | |||
12817 | InternalLinkageAttr::InternalLinkageAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12818 | ) |
||
12819 | : InheritableAttr(Ctx, CommonInfo, attr::InternalLinkage, false, false) |
||
12820 | { |
||
12821 | } |
||
12822 | |||
12823 | InternalLinkageAttr *InternalLinkageAttr::clone(ASTContext &C) const { |
||
12824 | auto *A = new (C) InternalLinkageAttr(C, *this); |
||
12825 | A->Inherited = Inherited; |
||
12826 | A->IsPackExpansion = IsPackExpansion; |
||
12827 | A->setImplicit(Implicit); |
||
12828 | return A; |
||
12829 | } |
||
12830 | |||
12831 | void InternalLinkageAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12832 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12833 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12834 | switch (getAttributeSpellingListIndex()) { |
||
12835 | default: |
||
12836 | llvm_unreachable("Unknown attribute spelling!"); |
||
12837 | break; |
||
12838 | case 0 : { |
||
12839 | OS << " __attribute__((internal_linkage"; |
||
12840 | OS << "))"; |
||
12841 | break; |
||
12842 | } |
||
12843 | case 1 : { |
||
12844 | OS << " [[clang::internal_linkage"; |
||
12845 | OS << "]]"; |
||
12846 | break; |
||
12847 | } |
||
12848 | case 2 : { |
||
12849 | OS << " [[clang::internal_linkage"; |
||
12850 | OS << "]]"; |
||
12851 | break; |
||
12852 | } |
||
12853 | } |
||
12854 | } |
||
12855 | |||
12856 | const char *InternalLinkageAttr::getSpelling() const { |
||
12857 | switch (getAttributeSpellingListIndex()) { |
||
12858 | default: |
||
12859 | llvm_unreachable("Unknown attribute spelling!"); |
||
12860 | return "(No spelling)"; |
||
12861 | case 0: |
||
12862 | return "internal_linkage"; |
||
12863 | case 1: |
||
12864 | return "internal_linkage"; |
||
12865 | case 2: |
||
12866 | return "internal_linkage"; |
||
12867 | } |
||
12868 | } |
||
12869 | |||
12870 | |||
12871 | // LTOVisibilityPublicAttr implementation |
||
12872 | |||
12873 | LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12874 | auto *A = new (Ctx) LTOVisibilityPublicAttr(Ctx, CommonInfo); |
||
12875 | A->setImplicit(true); |
||
12876 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12877 | A->setAttributeSpellingListIndex(0); |
||
12878 | return A; |
||
12879 | } |
||
12880 | |||
12881 | LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
12882 | auto *A = new (Ctx) LTOVisibilityPublicAttr(Ctx, CommonInfo); |
||
12883 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12884 | A->setAttributeSpellingListIndex(0); |
||
12885 | return A; |
||
12886 | } |
||
12887 | |||
12888 | LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12889 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12890 | return CreateImplicit(Ctx, I); |
||
12891 | } |
||
12892 | |||
12893 | LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12894 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12895 | return Create(Ctx, I); |
||
12896 | } |
||
12897 | |||
12898 | LTOVisibilityPublicAttr::LTOVisibilityPublicAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12899 | ) |
||
12900 | : InheritableAttr(Ctx, CommonInfo, attr::LTOVisibilityPublic, false, false) |
||
12901 | { |
||
12902 | } |
||
12903 | |||
12904 | LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::clone(ASTContext &C) const { |
||
12905 | auto *A = new (C) LTOVisibilityPublicAttr(C, *this); |
||
12906 | A->Inherited = Inherited; |
||
12907 | A->IsPackExpansion = IsPackExpansion; |
||
12908 | A->setImplicit(Implicit); |
||
12909 | return A; |
||
12910 | } |
||
12911 | |||
12912 | void LTOVisibilityPublicAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12913 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12914 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
12915 | switch (getAttributeSpellingListIndex()) { |
||
12916 | default: |
||
12917 | llvm_unreachable("Unknown attribute spelling!"); |
||
12918 | break; |
||
12919 | case 0 : { |
||
12920 | OS << " __attribute__((lto_visibility_public"; |
||
12921 | OS << "))"; |
||
12922 | break; |
||
12923 | } |
||
12924 | case 1 : { |
||
12925 | OS << " [[clang::lto_visibility_public"; |
||
12926 | OS << "]]"; |
||
12927 | break; |
||
12928 | } |
||
12929 | case 2 : { |
||
12930 | OS << " [[clang::lto_visibility_public"; |
||
12931 | OS << "]]"; |
||
12932 | break; |
||
12933 | } |
||
12934 | } |
||
12935 | } |
||
12936 | |||
12937 | const char *LTOVisibilityPublicAttr::getSpelling() const { |
||
12938 | switch (getAttributeSpellingListIndex()) { |
||
12939 | default: |
||
12940 | llvm_unreachable("Unknown attribute spelling!"); |
||
12941 | return "(No spelling)"; |
||
12942 | case 0: |
||
12943 | return "lto_visibility_public"; |
||
12944 | case 1: |
||
12945 | return "lto_visibility_public"; |
||
12946 | case 2: |
||
12947 | return "lto_visibility_public"; |
||
12948 | } |
||
12949 | } |
||
12950 | |||
12951 | |||
12952 | // LayoutVersionAttr implementation |
||
12953 | |||
12954 | LayoutVersionAttr *LayoutVersionAttr::CreateImplicit(ASTContext &Ctx, unsigned Version, const AttributeCommonInfo &CommonInfo) { |
||
12955 | auto *A = new (Ctx) LayoutVersionAttr(Ctx, CommonInfo, Version); |
||
12956 | A->setImplicit(true); |
||
12957 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12958 | A->setAttributeSpellingListIndex(0); |
||
12959 | return A; |
||
12960 | } |
||
12961 | |||
12962 | LayoutVersionAttr *LayoutVersionAttr::Create(ASTContext &Ctx, unsigned Version, const AttributeCommonInfo &CommonInfo) { |
||
12963 | auto *A = new (Ctx) LayoutVersionAttr(Ctx, CommonInfo, Version); |
||
12964 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
12965 | A->setAttributeSpellingListIndex(0); |
||
12966 | return A; |
||
12967 | } |
||
12968 | |||
12969 | LayoutVersionAttr *LayoutVersionAttr::CreateImplicit(ASTContext &Ctx, unsigned Version, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12970 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12971 | return CreateImplicit(Ctx, Version, I); |
||
12972 | } |
||
12973 | |||
12974 | LayoutVersionAttr *LayoutVersionAttr::Create(ASTContext &Ctx, unsigned Version, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
12975 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
12976 | return Create(Ctx, Version, I); |
||
12977 | } |
||
12978 | |||
12979 | LayoutVersionAttr::LayoutVersionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
12980 | , unsigned Version |
||
12981 | ) |
||
12982 | : InheritableAttr(Ctx, CommonInfo, attr::LayoutVersion, false, false) |
||
12983 | , version(Version) |
||
12984 | { |
||
12985 | } |
||
12986 | |||
12987 | |||
12988 | |||
12989 | LayoutVersionAttr *LayoutVersionAttr::clone(ASTContext &C) const { |
||
12990 | auto *A = new (C) LayoutVersionAttr(C, *this, version); |
||
12991 | A->Inherited = Inherited; |
||
12992 | A->IsPackExpansion = IsPackExpansion; |
||
12993 | A->setImplicit(Implicit); |
||
12994 | return A; |
||
12995 | } |
||
12996 | |||
12997 | void LayoutVersionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
12998 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
12999 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13000 | switch (getAttributeSpellingListIndex()) { |
||
13001 | default: |
||
13002 | llvm_unreachable("Unknown attribute spelling!"); |
||
13003 | break; |
||
13004 | case 0 : { |
||
13005 | OS << " __declspec(layout_version"; |
||
13006 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
13007 | OS << "" << getVersion() << ""; |
||
13008 | if (!IsFirstArgument) |
||
13009 | OS << ")"; |
||
13010 | OS << ")"; |
||
13011 | break; |
||
13012 | } |
||
13013 | } |
||
13014 | } |
||
13015 | |||
13016 | const char *LayoutVersionAttr::getSpelling() const { |
||
13017 | switch (getAttributeSpellingListIndex()) { |
||
13018 | default: |
||
13019 | llvm_unreachable("Unknown attribute spelling!"); |
||
13020 | return "(No spelling)"; |
||
13021 | case 0: |
||
13022 | return "layout_version"; |
||
13023 | } |
||
13024 | } |
||
13025 | |||
13026 | |||
13027 | // LeafAttr implementation |
||
13028 | |||
13029 | LeafAttr *LeafAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13030 | auto *A = new (Ctx) LeafAttr(Ctx, CommonInfo); |
||
13031 | A->setImplicit(true); |
||
13032 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13033 | A->setAttributeSpellingListIndex(0); |
||
13034 | return A; |
||
13035 | } |
||
13036 | |||
13037 | LeafAttr *LeafAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13038 | auto *A = new (Ctx) LeafAttr(Ctx, CommonInfo); |
||
13039 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13040 | A->setAttributeSpellingListIndex(0); |
||
13041 | return A; |
||
13042 | } |
||
13043 | |||
13044 | LeafAttr *LeafAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13045 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13046 | return CreateImplicit(Ctx, I); |
||
13047 | } |
||
13048 | |||
13049 | LeafAttr *LeafAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13050 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13051 | return Create(Ctx, I); |
||
13052 | } |
||
13053 | |||
13054 | LeafAttr::LeafAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13055 | ) |
||
13056 | : InheritableAttr(Ctx, CommonInfo, attr::Leaf, false, false) |
||
13057 | { |
||
13058 | } |
||
13059 | |||
13060 | LeafAttr *LeafAttr::clone(ASTContext &C) const { |
||
13061 | auto *A = new (C) LeafAttr(C, *this); |
||
13062 | A->Inherited = Inherited; |
||
13063 | A->IsPackExpansion = IsPackExpansion; |
||
13064 | A->setImplicit(Implicit); |
||
13065 | return A; |
||
13066 | } |
||
13067 | |||
13068 | void LeafAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13069 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13070 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13071 | switch (getAttributeSpellingListIndex()) { |
||
13072 | default: |
||
13073 | llvm_unreachable("Unknown attribute spelling!"); |
||
13074 | break; |
||
13075 | case 0 : { |
||
13076 | OS << " __attribute__((leaf"; |
||
13077 | OS << "))"; |
||
13078 | break; |
||
13079 | } |
||
13080 | case 1 : { |
||
13081 | OS << " [[gnu::leaf"; |
||
13082 | OS << "]]"; |
||
13083 | break; |
||
13084 | } |
||
13085 | case 2 : { |
||
13086 | OS << " [[gnu::leaf"; |
||
13087 | OS << "]]"; |
||
13088 | break; |
||
13089 | } |
||
13090 | } |
||
13091 | } |
||
13092 | |||
13093 | const char *LeafAttr::getSpelling() const { |
||
13094 | switch (getAttributeSpellingListIndex()) { |
||
13095 | default: |
||
13096 | llvm_unreachable("Unknown attribute spelling!"); |
||
13097 | return "(No spelling)"; |
||
13098 | case 0: |
||
13099 | return "leaf"; |
||
13100 | case 1: |
||
13101 | return "leaf"; |
||
13102 | case 2: |
||
13103 | return "leaf"; |
||
13104 | } |
||
13105 | } |
||
13106 | |||
13107 | |||
13108 | // LifetimeBoundAttr implementation |
||
13109 | |||
13110 | LifetimeBoundAttr *LifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13111 | auto *A = new (Ctx) LifetimeBoundAttr(Ctx, CommonInfo); |
||
13112 | A->setImplicit(true); |
||
13113 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13114 | A->setAttributeSpellingListIndex(0); |
||
13115 | return A; |
||
13116 | } |
||
13117 | |||
13118 | LifetimeBoundAttr *LifetimeBoundAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13119 | auto *A = new (Ctx) LifetimeBoundAttr(Ctx, CommonInfo); |
||
13120 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13121 | A->setAttributeSpellingListIndex(0); |
||
13122 | return A; |
||
13123 | } |
||
13124 | |||
13125 | LifetimeBoundAttr *LifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13126 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13127 | return CreateImplicit(Ctx, I); |
||
13128 | } |
||
13129 | |||
13130 | LifetimeBoundAttr *LifetimeBoundAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13131 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13132 | return Create(Ctx, I); |
||
13133 | } |
||
13134 | |||
13135 | LifetimeBoundAttr::LifetimeBoundAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13136 | ) |
||
13137 | : InheritableAttr(Ctx, CommonInfo, attr::LifetimeBound, false, false) |
||
13138 | { |
||
13139 | } |
||
13140 | |||
13141 | LifetimeBoundAttr *LifetimeBoundAttr::clone(ASTContext &C) const { |
||
13142 | auto *A = new (C) LifetimeBoundAttr(C, *this); |
||
13143 | A->Inherited = Inherited; |
||
13144 | A->IsPackExpansion = IsPackExpansion; |
||
13145 | A->setImplicit(Implicit); |
||
13146 | return A; |
||
13147 | } |
||
13148 | |||
13149 | void LifetimeBoundAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13150 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13151 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13152 | switch (getAttributeSpellingListIndex()) { |
||
13153 | default: |
||
13154 | llvm_unreachable("Unknown attribute spelling!"); |
||
13155 | break; |
||
13156 | case 0 : { |
||
13157 | OS << " __attribute__((lifetimebound"; |
||
13158 | OS << "))"; |
||
13159 | break; |
||
13160 | } |
||
13161 | case 1 : { |
||
13162 | OS << " [[clang::lifetimebound"; |
||
13163 | OS << "]]"; |
||
13164 | break; |
||
13165 | } |
||
13166 | } |
||
13167 | } |
||
13168 | |||
13169 | const char *LifetimeBoundAttr::getSpelling() const { |
||
13170 | switch (getAttributeSpellingListIndex()) { |
||
13171 | default: |
||
13172 | llvm_unreachable("Unknown attribute spelling!"); |
||
13173 | return "(No spelling)"; |
||
13174 | case 0: |
||
13175 | return "lifetimebound"; |
||
13176 | case 1: |
||
13177 | return "lifetimebound"; |
||
13178 | } |
||
13179 | } |
||
13180 | |||
13181 | |||
13182 | // LikelyAttr implementation |
||
13183 | |||
13184 | LikelyAttr *LikelyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13185 | auto *A = new (Ctx) LikelyAttr(Ctx, CommonInfo); |
||
13186 | A->setImplicit(true); |
||
13187 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13188 | A->setAttributeSpellingListIndex(0); |
||
13189 | return A; |
||
13190 | } |
||
13191 | |||
13192 | LikelyAttr *LikelyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13193 | auto *A = new (Ctx) LikelyAttr(Ctx, CommonInfo); |
||
13194 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13195 | A->setAttributeSpellingListIndex(0); |
||
13196 | return A; |
||
13197 | } |
||
13198 | |||
13199 | LikelyAttr *LikelyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13200 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13201 | return CreateImplicit(Ctx, I); |
||
13202 | } |
||
13203 | |||
13204 | LikelyAttr *LikelyAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13205 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13206 | return Create(Ctx, I); |
||
13207 | } |
||
13208 | |||
13209 | LikelyAttr::LikelyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13210 | ) |
||
13211 | : StmtAttr(Ctx, CommonInfo, attr::Likely, false) |
||
13212 | { |
||
13213 | } |
||
13214 | |||
13215 | LikelyAttr *LikelyAttr::clone(ASTContext &C) const { |
||
13216 | auto *A = new (C) LikelyAttr(C, *this); |
||
13217 | A->Inherited = Inherited; |
||
13218 | A->IsPackExpansion = IsPackExpansion; |
||
13219 | A->setImplicit(Implicit); |
||
13220 | return A; |
||
13221 | } |
||
13222 | |||
13223 | void LikelyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13224 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13225 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13226 | switch (getAttributeSpellingListIndex()) { |
||
13227 | default: |
||
13228 | llvm_unreachable("Unknown attribute spelling!"); |
||
13229 | break; |
||
13230 | case 0 : { |
||
13231 | OS << " [[likely"; |
||
13232 | OS << "]]"; |
||
13233 | break; |
||
13234 | } |
||
13235 | case 1 : { |
||
13236 | OS << " [[clang::likely"; |
||
13237 | OS << "]]"; |
||
13238 | break; |
||
13239 | } |
||
13240 | } |
||
13241 | } |
||
13242 | |||
13243 | const char *LikelyAttr::getSpelling() const { |
||
13244 | switch (getAttributeSpellingListIndex()) { |
||
13245 | default: |
||
13246 | llvm_unreachable("Unknown attribute spelling!"); |
||
13247 | return "(No spelling)"; |
||
13248 | case 0: |
||
13249 | return "likely"; |
||
13250 | case 1: |
||
13251 | return "likely"; |
||
13252 | } |
||
13253 | } |
||
13254 | |||
13255 | |||
13256 | // LoaderUninitializedAttr implementation |
||
13257 | |||
13258 | LoaderUninitializedAttr *LoaderUninitializedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13259 | auto *A = new (Ctx) LoaderUninitializedAttr(Ctx, CommonInfo); |
||
13260 | A->setImplicit(true); |
||
13261 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13262 | A->setAttributeSpellingListIndex(0); |
||
13263 | return A; |
||
13264 | } |
||
13265 | |||
13266 | LoaderUninitializedAttr *LoaderUninitializedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13267 | auto *A = new (Ctx) LoaderUninitializedAttr(Ctx, CommonInfo); |
||
13268 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13269 | A->setAttributeSpellingListIndex(0); |
||
13270 | return A; |
||
13271 | } |
||
13272 | |||
13273 | LoaderUninitializedAttr *LoaderUninitializedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13274 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13275 | return CreateImplicit(Ctx, I); |
||
13276 | } |
||
13277 | |||
13278 | LoaderUninitializedAttr *LoaderUninitializedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13279 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13280 | return Create(Ctx, I); |
||
13281 | } |
||
13282 | |||
13283 | LoaderUninitializedAttr::LoaderUninitializedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13284 | ) |
||
13285 | : Attr(Ctx, CommonInfo, attr::LoaderUninitialized, false) |
||
13286 | { |
||
13287 | } |
||
13288 | |||
13289 | LoaderUninitializedAttr *LoaderUninitializedAttr::clone(ASTContext &C) const { |
||
13290 | auto *A = new (C) LoaderUninitializedAttr(C, *this); |
||
13291 | A->Inherited = Inherited; |
||
13292 | A->IsPackExpansion = IsPackExpansion; |
||
13293 | A->setImplicit(Implicit); |
||
13294 | return A; |
||
13295 | } |
||
13296 | |||
13297 | void LoaderUninitializedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13298 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13299 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13300 | switch (getAttributeSpellingListIndex()) { |
||
13301 | default: |
||
13302 | llvm_unreachable("Unknown attribute spelling!"); |
||
13303 | break; |
||
13304 | case 0 : { |
||
13305 | OS << " __attribute__((loader_uninitialized"; |
||
13306 | OS << "))"; |
||
13307 | break; |
||
13308 | } |
||
13309 | case 1 : { |
||
13310 | OS << " [[clang::loader_uninitialized"; |
||
13311 | OS << "]]"; |
||
13312 | break; |
||
13313 | } |
||
13314 | case 2 : { |
||
13315 | OS << " [[clang::loader_uninitialized"; |
||
13316 | OS << "]]"; |
||
13317 | break; |
||
13318 | } |
||
13319 | } |
||
13320 | } |
||
13321 | |||
13322 | const char *LoaderUninitializedAttr::getSpelling() const { |
||
13323 | switch (getAttributeSpellingListIndex()) { |
||
13324 | default: |
||
13325 | llvm_unreachable("Unknown attribute spelling!"); |
||
13326 | return "(No spelling)"; |
||
13327 | case 0: |
||
13328 | return "loader_uninitialized"; |
||
13329 | case 1: |
||
13330 | return "loader_uninitialized"; |
||
13331 | case 2: |
||
13332 | return "loader_uninitialized"; |
||
13333 | } |
||
13334 | } |
||
13335 | |||
13336 | |||
13337 | // LockReturnedAttr implementation |
||
13338 | |||
13339 | LockReturnedAttr *LockReturnedAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { |
||
13340 | auto *A = new (Ctx) LockReturnedAttr(Ctx, CommonInfo, Arg); |
||
13341 | A->setImplicit(true); |
||
13342 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13343 | A->setAttributeSpellingListIndex(0); |
||
13344 | return A; |
||
13345 | } |
||
13346 | |||
13347 | LockReturnedAttr *LockReturnedAttr::Create(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { |
||
13348 | auto *A = new (Ctx) LockReturnedAttr(Ctx, CommonInfo, Arg); |
||
13349 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13350 | A->setAttributeSpellingListIndex(0); |
||
13351 | return A; |
||
13352 | } |
||
13353 | |||
13354 | LockReturnedAttr *LockReturnedAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13355 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13356 | return CreateImplicit(Ctx, Arg, I); |
||
13357 | } |
||
13358 | |||
13359 | LockReturnedAttr *LockReturnedAttr::Create(ASTContext &Ctx, Expr * Arg, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13360 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13361 | return Create(Ctx, Arg, I); |
||
13362 | } |
||
13363 | |||
13364 | LockReturnedAttr::LockReturnedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13365 | , Expr * Arg |
||
13366 | ) |
||
13367 | : InheritableAttr(Ctx, CommonInfo, attr::LockReturned, true, false) |
||
13368 | , arg(Arg) |
||
13369 | { |
||
13370 | } |
||
13371 | |||
13372 | |||
13373 | |||
13374 | LockReturnedAttr *LockReturnedAttr::clone(ASTContext &C) const { |
||
13375 | auto *A = new (C) LockReturnedAttr(C, *this, arg); |
||
13376 | A->Inherited = Inherited; |
||
13377 | A->IsPackExpansion = IsPackExpansion; |
||
13378 | A->setImplicit(Implicit); |
||
13379 | return A; |
||
13380 | } |
||
13381 | |||
13382 | void LockReturnedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13383 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13384 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13385 | switch (getAttributeSpellingListIndex()) { |
||
13386 | default: |
||
13387 | llvm_unreachable("Unknown attribute spelling!"); |
||
13388 | break; |
||
13389 | case 0 : { |
||
13390 | OS << " __attribute__((lock_returned"; |
||
13391 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
13392 | OS << ""; |
||
13393 | getArg()->printPretty(OS, nullptr, Policy); |
||
13394 | OS << ""; |
||
13395 | if (!IsFirstArgument) |
||
13396 | OS << ")"; |
||
13397 | OS << "))"; |
||
13398 | break; |
||
13399 | } |
||
13400 | } |
||
13401 | } |
||
13402 | |||
13403 | const char *LockReturnedAttr::getSpelling() const { |
||
13404 | switch (getAttributeSpellingListIndex()) { |
||
13405 | default: |
||
13406 | llvm_unreachable("Unknown attribute spelling!"); |
||
13407 | return "(No spelling)"; |
||
13408 | case 0: |
||
13409 | return "lock_returned"; |
||
13410 | } |
||
13411 | } |
||
13412 | |||
13413 | |||
13414 | // LocksExcludedAttr implementation |
||
13415 | |||
13416 | LocksExcludedAttr *LocksExcludedAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
13417 | auto *A = new (Ctx) LocksExcludedAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
13418 | A->setImplicit(true); |
||
13419 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13420 | A->setAttributeSpellingListIndex(0); |
||
13421 | return A; |
||
13422 | } |
||
13423 | |||
13424 | LocksExcludedAttr *LocksExcludedAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
13425 | auto *A = new (Ctx) LocksExcludedAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
13426 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13427 | A->setAttributeSpellingListIndex(0); |
||
13428 | return A; |
||
13429 | } |
||
13430 | |||
13431 | LocksExcludedAttr *LocksExcludedAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13432 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13433 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
13434 | } |
||
13435 | |||
13436 | LocksExcludedAttr *LocksExcludedAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13437 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13438 | return Create(Ctx, Args, ArgsSize, I); |
||
13439 | } |
||
13440 | |||
13441 | LocksExcludedAttr::LocksExcludedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13442 | , Expr * *Args, unsigned ArgsSize |
||
13443 | ) |
||
13444 | : InheritableAttr(Ctx, CommonInfo, attr::LocksExcluded, true, true) |
||
13445 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
13446 | { |
||
13447 | std::copy(Args, Args + args_Size, args_); |
||
13448 | } |
||
13449 | |||
13450 | LocksExcludedAttr::LocksExcludedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13451 | ) |
||
13452 | : InheritableAttr(Ctx, CommonInfo, attr::LocksExcluded, true, true) |
||
13453 | , args_Size(0), args_(nullptr) |
||
13454 | { |
||
13455 | } |
||
13456 | |||
13457 | |||
13458 | |||
13459 | LocksExcludedAttr *LocksExcludedAttr::clone(ASTContext &C) const { |
||
13460 | auto *A = new (C) LocksExcludedAttr(C, *this, args_, args_Size); |
||
13461 | A->Inherited = Inherited; |
||
13462 | A->IsPackExpansion = IsPackExpansion; |
||
13463 | A->setImplicit(Implicit); |
||
13464 | return A; |
||
13465 | } |
||
13466 | |||
13467 | void LocksExcludedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13468 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13469 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13470 | switch (getAttributeSpellingListIndex()) { |
||
13471 | default: |
||
13472 | llvm_unreachable("Unknown attribute spelling!"); |
||
13473 | break; |
||
13474 | case 0 : { |
||
13475 | OS << " __attribute__((locks_excluded"; |
||
13476 | OS << ""; |
||
13477 | for (const auto &Val : args()) { |
||
13478 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
13479 | OS << Val; |
||
13480 | } |
||
13481 | OS << ""; |
||
13482 | if (!IsFirstArgument) |
||
13483 | OS << ")"; |
||
13484 | OS << "))"; |
||
13485 | break; |
||
13486 | } |
||
13487 | } |
||
13488 | } |
||
13489 | |||
13490 | const char *LocksExcludedAttr::getSpelling() const { |
||
13491 | switch (getAttributeSpellingListIndex()) { |
||
13492 | default: |
||
13493 | llvm_unreachable("Unknown attribute spelling!"); |
||
13494 | return "(No spelling)"; |
||
13495 | case 0: |
||
13496 | return "locks_excluded"; |
||
13497 | } |
||
13498 | } |
||
13499 | |||
13500 | |||
13501 | // LoopHintAttr implementation |
||
13502 | |||
13503 | LoopHintAttr *LoopHintAttr::CreateImplicit(ASTContext &Ctx, OptionType Option, LoopHintState State, Expr * Value, const AttributeCommonInfo &CommonInfo) { |
||
13504 | auto *A = new (Ctx) LoopHintAttr(Ctx, CommonInfo, Option, State, Value); |
||
13505 | A->setImplicit(true); |
||
13506 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13507 | A->setAttributeSpellingListIndex(0); |
||
13508 | return A; |
||
13509 | } |
||
13510 | |||
13511 | LoopHintAttr *LoopHintAttr::Create(ASTContext &Ctx, OptionType Option, LoopHintState State, Expr * Value, const AttributeCommonInfo &CommonInfo) { |
||
13512 | auto *A = new (Ctx) LoopHintAttr(Ctx, CommonInfo, Option, State, Value); |
||
13513 | return A; |
||
13514 | } |
||
13515 | |||
13516 | LoopHintAttr *LoopHintAttr::CreateImplicit(ASTContext &Ctx, OptionType Option, LoopHintState State, Expr * Value, SourceRange Range, AttributeCommonInfo::Syntax Syntax, LoopHintAttr::Spelling S) { |
||
13517 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
13518 | return CreateImplicit(Ctx, Option, State, Value, I); |
||
13519 | } |
||
13520 | |||
13521 | LoopHintAttr *LoopHintAttr::Create(ASTContext &Ctx, OptionType Option, LoopHintState State, Expr * Value, SourceRange Range, AttributeCommonInfo::Syntax Syntax, LoopHintAttr::Spelling S) { |
||
13522 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
13523 | return Create(Ctx, Option, State, Value, I); |
||
13524 | } |
||
13525 | |||
13526 | LoopHintAttr::LoopHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13527 | , OptionType Option |
||
13528 | , LoopHintState State |
||
13529 | , Expr * Value |
||
13530 | ) |
||
13531 | : Attr(Ctx, CommonInfo, attr::LoopHint, false) |
||
13532 | , option(Option) |
||
13533 | , state(State) |
||
13534 | , value(Value) |
||
13535 | { |
||
13536 | } |
||
13537 | |||
13538 | LoopHintAttr::Spelling LoopHintAttr::getSemanticSpelling() const { |
||
13539 | switch (getAttributeSpellingListIndex()) { |
||
13540 | default: llvm_unreachable("Unknown spelling list index"); |
||
13541 | case 0: return Pragma_clang_loop; |
||
13542 | case 1: return Pragma_unroll; |
||
13543 | case 2: return Pragma_nounroll; |
||
13544 | case 3: return Pragma_unroll_and_jam; |
||
13545 | case 4: return Pragma_nounroll_and_jam; |
||
13546 | } |
||
13547 | } |
||
13548 | |||
13549 | |||
13550 | bool LoopHintAttr::ConvertStrToOptionType(StringRef Val, OptionType &Out) { |
||
13551 | std::optional<OptionType> R = llvm::StringSwitch<std::optional<OptionType>>(Val) |
||
13552 | .Case("vectorize", LoopHintAttr::Vectorize) |
||
13553 | .Case("vectorize_width", LoopHintAttr::VectorizeWidth) |
||
13554 | .Case("interleave", LoopHintAttr::Interleave) |
||
13555 | .Case("interleave_count", LoopHintAttr::InterleaveCount) |
||
13556 | .Case("unroll", LoopHintAttr::Unroll) |
||
13557 | .Case("unroll_count", LoopHintAttr::UnrollCount) |
||
13558 | .Case("unroll_and_jam", LoopHintAttr::UnrollAndJam) |
||
13559 | .Case("unroll_and_jam_count", LoopHintAttr::UnrollAndJamCount) |
||
13560 | .Case("pipeline", LoopHintAttr::PipelineDisabled) |
||
13561 | .Case("pipeline_initiation_interval", LoopHintAttr::PipelineInitiationInterval) |
||
13562 | .Case("distribute", LoopHintAttr::Distribute) |
||
13563 | .Case("vectorize_predicate", LoopHintAttr::VectorizePredicate) |
||
13564 | .Default(std::optional<OptionType>()); |
||
13565 | if (R) { |
||
13566 | Out = *R; |
||
13567 | return true; |
||
13568 | } |
||
13569 | return false; |
||
13570 | } |
||
13571 | |||
13572 | const char *LoopHintAttr::ConvertOptionTypeToStr(OptionType Val) { |
||
13573 | switch(Val) { |
||
13574 | case LoopHintAttr::Vectorize: return "vectorize"; |
||
13575 | case LoopHintAttr::VectorizeWidth: return "vectorize_width"; |
||
13576 | case LoopHintAttr::Interleave: return "interleave"; |
||
13577 | case LoopHintAttr::InterleaveCount: return "interleave_count"; |
||
13578 | case LoopHintAttr::Unroll: return "unroll"; |
||
13579 | case LoopHintAttr::UnrollCount: return "unroll_count"; |
||
13580 | case LoopHintAttr::UnrollAndJam: return "unroll_and_jam"; |
||
13581 | case LoopHintAttr::UnrollAndJamCount: return "unroll_and_jam_count"; |
||
13582 | case LoopHintAttr::PipelineDisabled: return "pipeline"; |
||
13583 | case LoopHintAttr::PipelineInitiationInterval: return "pipeline_initiation_interval"; |
||
13584 | case LoopHintAttr::Distribute: return "distribute"; |
||
13585 | case LoopHintAttr::VectorizePredicate: return "vectorize_predicate"; |
||
13586 | } |
||
13587 | llvm_unreachable("No enumerator with that value"); |
||
13588 | } |
||
13589 | |||
13590 | |||
13591 | bool LoopHintAttr::ConvertStrToLoopHintState(StringRef Val, LoopHintState &Out) { |
||
13592 | std::optional<LoopHintState> R = llvm::StringSwitch<std::optional<LoopHintState>>(Val) |
||
13593 | .Case("enable", LoopHintAttr::Enable) |
||
13594 | .Case("disable", LoopHintAttr::Disable) |
||
13595 | .Case("numeric", LoopHintAttr::Numeric) |
||
13596 | .Case("fixed_width", LoopHintAttr::FixedWidth) |
||
13597 | .Case("scalable_width", LoopHintAttr::ScalableWidth) |
||
13598 | .Case("assume_safety", LoopHintAttr::AssumeSafety) |
||
13599 | .Case("full", LoopHintAttr::Full) |
||
13600 | .Default(std::optional<LoopHintState>()); |
||
13601 | if (R) { |
||
13602 | Out = *R; |
||
13603 | return true; |
||
13604 | } |
||
13605 | return false; |
||
13606 | } |
||
13607 | |||
13608 | const char *LoopHintAttr::ConvertLoopHintStateToStr(LoopHintState Val) { |
||
13609 | switch(Val) { |
||
13610 | case LoopHintAttr::Enable: return "enable"; |
||
13611 | case LoopHintAttr::Disable: return "disable"; |
||
13612 | case LoopHintAttr::Numeric: return "numeric"; |
||
13613 | case LoopHintAttr::FixedWidth: return "fixed_width"; |
||
13614 | case LoopHintAttr::ScalableWidth: return "scalable_width"; |
||
13615 | case LoopHintAttr::AssumeSafety: return "assume_safety"; |
||
13616 | case LoopHintAttr::Full: return "full"; |
||
13617 | } |
||
13618 | llvm_unreachable("No enumerator with that value"); |
||
13619 | } |
||
13620 | |||
13621 | |||
13622 | LoopHintAttr *LoopHintAttr::clone(ASTContext &C) const { |
||
13623 | auto *A = new (C) LoopHintAttr(C, *this, option, state, value); |
||
13624 | A->Inherited = Inherited; |
||
13625 | A->IsPackExpansion = IsPackExpansion; |
||
13626 | A->setImplicit(Implicit); |
||
13627 | return A; |
||
13628 | } |
||
13629 | |||
13630 | void LoopHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13631 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13632 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13633 | switch (getAttributeSpellingListIndex()) { |
||
13634 | default: |
||
13635 | llvm_unreachable("Unknown attribute spelling!"); |
||
13636 | break; |
||
13637 | case 0 : { |
||
13638 | OS << "#pragma clang loop"; |
||
13639 | printPrettyPragma(OS, Policy); |
||
13640 | OS << "\n"; break; |
||
13641 | } |
||
13642 | case 1 : { |
||
13643 | OS << "#pragma unroll"; |
||
13644 | printPrettyPragma(OS, Policy); |
||
13645 | OS << "\n"; break; |
||
13646 | } |
||
13647 | case 2 : { |
||
13648 | OS << "#pragma nounroll"; |
||
13649 | printPrettyPragma(OS, Policy); |
||
13650 | OS << "\n"; break; |
||
13651 | } |
||
13652 | case 3 : { |
||
13653 | OS << "#pragma unroll_and_jam"; |
||
13654 | printPrettyPragma(OS, Policy); |
||
13655 | OS << "\n"; break; |
||
13656 | } |
||
13657 | case 4 : { |
||
13658 | OS << "#pragma nounroll_and_jam"; |
||
13659 | printPrettyPragma(OS, Policy); |
||
13660 | OS << "\n"; break; |
||
13661 | } |
||
13662 | } |
||
13663 | } |
||
13664 | |||
13665 | const char *LoopHintAttr::getSpelling() const { |
||
13666 | switch (getAttributeSpellingListIndex()) { |
||
13667 | default: |
||
13668 | llvm_unreachable("Unknown attribute spelling!"); |
||
13669 | return "(No spelling)"; |
||
13670 | case 0: |
||
13671 | return "loop"; |
||
13672 | case 1: |
||
13673 | return "unroll"; |
||
13674 | case 2: |
||
13675 | return "nounroll"; |
||
13676 | case 3: |
||
13677 | return "unroll_and_jam"; |
||
13678 | case 4: |
||
13679 | return "nounroll_and_jam"; |
||
13680 | } |
||
13681 | } |
||
13682 | |||
13683 | |||
13684 | // M68kInterruptAttr implementation |
||
13685 | |||
13686 | M68kInterruptAttr *M68kInterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) { |
||
13687 | auto *A = new (Ctx) M68kInterruptAttr(Ctx, CommonInfo, Number); |
||
13688 | A->setImplicit(true); |
||
13689 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13690 | A->setAttributeSpellingListIndex(0); |
||
13691 | return A; |
||
13692 | } |
||
13693 | |||
13694 | M68kInterruptAttr *M68kInterruptAttr::Create(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) { |
||
13695 | auto *A = new (Ctx) M68kInterruptAttr(Ctx, CommonInfo, Number); |
||
13696 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13697 | A->setAttributeSpellingListIndex(0); |
||
13698 | return A; |
||
13699 | } |
||
13700 | |||
13701 | M68kInterruptAttr *M68kInterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13702 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13703 | return CreateImplicit(Ctx, Number, I); |
||
13704 | } |
||
13705 | |||
13706 | M68kInterruptAttr *M68kInterruptAttr::Create(ASTContext &Ctx, unsigned Number, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13707 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13708 | return Create(Ctx, Number, I); |
||
13709 | } |
||
13710 | |||
13711 | M68kInterruptAttr::M68kInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13712 | , unsigned Number |
||
13713 | ) |
||
13714 | : InheritableAttr(Ctx, CommonInfo, attr::M68kInterrupt, false, false) |
||
13715 | , number(Number) |
||
13716 | { |
||
13717 | } |
||
13718 | |||
13719 | |||
13720 | |||
13721 | M68kInterruptAttr *M68kInterruptAttr::clone(ASTContext &C) const { |
||
13722 | auto *A = new (C) M68kInterruptAttr(C, *this, number); |
||
13723 | A->Inherited = Inherited; |
||
13724 | A->IsPackExpansion = IsPackExpansion; |
||
13725 | A->setImplicit(Implicit); |
||
13726 | return A; |
||
13727 | } |
||
13728 | |||
13729 | void M68kInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13730 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13731 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13732 | switch (getAttributeSpellingListIndex()) { |
||
13733 | default: |
||
13734 | llvm_unreachable("Unknown attribute spelling!"); |
||
13735 | break; |
||
13736 | case 0 : { |
||
13737 | OS << " __attribute__((interrupt"; |
||
13738 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
13739 | OS << "" << getNumber() << ""; |
||
13740 | if (!IsFirstArgument) |
||
13741 | OS << ")"; |
||
13742 | OS << "))"; |
||
13743 | break; |
||
13744 | } |
||
13745 | } |
||
13746 | } |
||
13747 | |||
13748 | const char *M68kInterruptAttr::getSpelling() const { |
||
13749 | switch (getAttributeSpellingListIndex()) { |
||
13750 | default: |
||
13751 | llvm_unreachable("Unknown attribute spelling!"); |
||
13752 | return "(No spelling)"; |
||
13753 | case 0: |
||
13754 | return "interrupt"; |
||
13755 | } |
||
13756 | } |
||
13757 | |||
13758 | |||
13759 | // MIGServerRoutineAttr implementation |
||
13760 | |||
13761 | MIGServerRoutineAttr *MIGServerRoutineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13762 | auto *A = new (Ctx) MIGServerRoutineAttr(Ctx, CommonInfo); |
||
13763 | A->setImplicit(true); |
||
13764 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13765 | A->setAttributeSpellingListIndex(0); |
||
13766 | return A; |
||
13767 | } |
||
13768 | |||
13769 | MIGServerRoutineAttr *MIGServerRoutineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13770 | auto *A = new (Ctx) MIGServerRoutineAttr(Ctx, CommonInfo); |
||
13771 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13772 | A->setAttributeSpellingListIndex(0); |
||
13773 | return A; |
||
13774 | } |
||
13775 | |||
13776 | MIGServerRoutineAttr *MIGServerRoutineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13777 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13778 | return CreateImplicit(Ctx, I); |
||
13779 | } |
||
13780 | |||
13781 | MIGServerRoutineAttr *MIGServerRoutineAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13782 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13783 | return Create(Ctx, I); |
||
13784 | } |
||
13785 | |||
13786 | MIGServerRoutineAttr::MIGServerRoutineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13787 | ) |
||
13788 | : InheritableAttr(Ctx, CommonInfo, attr::MIGServerRoutine, false, false) |
||
13789 | { |
||
13790 | } |
||
13791 | |||
13792 | MIGServerRoutineAttr *MIGServerRoutineAttr::clone(ASTContext &C) const { |
||
13793 | auto *A = new (C) MIGServerRoutineAttr(C, *this); |
||
13794 | A->Inherited = Inherited; |
||
13795 | A->IsPackExpansion = IsPackExpansion; |
||
13796 | A->setImplicit(Implicit); |
||
13797 | return A; |
||
13798 | } |
||
13799 | |||
13800 | void MIGServerRoutineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13801 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13802 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13803 | switch (getAttributeSpellingListIndex()) { |
||
13804 | default: |
||
13805 | llvm_unreachable("Unknown attribute spelling!"); |
||
13806 | break; |
||
13807 | case 0 : { |
||
13808 | OS << " __attribute__((mig_server_routine"; |
||
13809 | OS << "))"; |
||
13810 | break; |
||
13811 | } |
||
13812 | case 1 : { |
||
13813 | OS << " [[clang::mig_server_routine"; |
||
13814 | OS << "]]"; |
||
13815 | break; |
||
13816 | } |
||
13817 | case 2 : { |
||
13818 | OS << " [[clang::mig_server_routine"; |
||
13819 | OS << "]]"; |
||
13820 | break; |
||
13821 | } |
||
13822 | } |
||
13823 | } |
||
13824 | |||
13825 | const char *MIGServerRoutineAttr::getSpelling() const { |
||
13826 | switch (getAttributeSpellingListIndex()) { |
||
13827 | default: |
||
13828 | llvm_unreachable("Unknown attribute spelling!"); |
||
13829 | return "(No spelling)"; |
||
13830 | case 0: |
||
13831 | return "mig_server_routine"; |
||
13832 | case 1: |
||
13833 | return "mig_server_routine"; |
||
13834 | case 2: |
||
13835 | return "mig_server_routine"; |
||
13836 | } |
||
13837 | } |
||
13838 | |||
13839 | |||
13840 | // MSABIAttr implementation |
||
13841 | |||
13842 | MSABIAttr *MSABIAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13843 | auto *A = new (Ctx) MSABIAttr(Ctx, CommonInfo); |
||
13844 | A->setImplicit(true); |
||
13845 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13846 | A->setAttributeSpellingListIndex(0); |
||
13847 | return A; |
||
13848 | } |
||
13849 | |||
13850 | MSABIAttr *MSABIAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13851 | auto *A = new (Ctx) MSABIAttr(Ctx, CommonInfo); |
||
13852 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13853 | A->setAttributeSpellingListIndex(0); |
||
13854 | return A; |
||
13855 | } |
||
13856 | |||
13857 | MSABIAttr *MSABIAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13858 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13859 | return CreateImplicit(Ctx, I); |
||
13860 | } |
||
13861 | |||
13862 | MSABIAttr *MSABIAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13863 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13864 | return Create(Ctx, I); |
||
13865 | } |
||
13866 | |||
13867 | MSABIAttr::MSABIAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13868 | ) |
||
13869 | : InheritableAttr(Ctx, CommonInfo, attr::MSABI, false, false) |
||
13870 | { |
||
13871 | } |
||
13872 | |||
13873 | MSABIAttr *MSABIAttr::clone(ASTContext &C) const { |
||
13874 | auto *A = new (C) MSABIAttr(C, *this); |
||
13875 | A->Inherited = Inherited; |
||
13876 | A->IsPackExpansion = IsPackExpansion; |
||
13877 | A->setImplicit(Implicit); |
||
13878 | return A; |
||
13879 | } |
||
13880 | |||
13881 | void MSABIAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13882 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13883 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13884 | switch (getAttributeSpellingListIndex()) { |
||
13885 | default: |
||
13886 | llvm_unreachable("Unknown attribute spelling!"); |
||
13887 | break; |
||
13888 | case 0 : { |
||
13889 | OS << " __attribute__((ms_abi"; |
||
13890 | OS << "))"; |
||
13891 | break; |
||
13892 | } |
||
13893 | case 1 : { |
||
13894 | OS << " [[gnu::ms_abi"; |
||
13895 | OS << "]]"; |
||
13896 | break; |
||
13897 | } |
||
13898 | case 2 : { |
||
13899 | OS << " [[gnu::ms_abi"; |
||
13900 | OS << "]]"; |
||
13901 | break; |
||
13902 | } |
||
13903 | } |
||
13904 | } |
||
13905 | |||
13906 | const char *MSABIAttr::getSpelling() const { |
||
13907 | switch (getAttributeSpellingListIndex()) { |
||
13908 | default: |
||
13909 | llvm_unreachable("Unknown attribute spelling!"); |
||
13910 | return "(No spelling)"; |
||
13911 | case 0: |
||
13912 | return "ms_abi"; |
||
13913 | case 1: |
||
13914 | return "ms_abi"; |
||
13915 | case 2: |
||
13916 | return "ms_abi"; |
||
13917 | } |
||
13918 | } |
||
13919 | |||
13920 | |||
13921 | // MSAllocatorAttr implementation |
||
13922 | |||
13923 | MSAllocatorAttr *MSAllocatorAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13924 | auto *A = new (Ctx) MSAllocatorAttr(Ctx, CommonInfo); |
||
13925 | A->setImplicit(true); |
||
13926 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13927 | A->setAttributeSpellingListIndex(0); |
||
13928 | return A; |
||
13929 | } |
||
13930 | |||
13931 | MSAllocatorAttr *MSAllocatorAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
13932 | auto *A = new (Ctx) MSAllocatorAttr(Ctx, CommonInfo); |
||
13933 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13934 | A->setAttributeSpellingListIndex(0); |
||
13935 | return A; |
||
13936 | } |
||
13937 | |||
13938 | MSAllocatorAttr *MSAllocatorAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13939 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13940 | return CreateImplicit(Ctx, I); |
||
13941 | } |
||
13942 | |||
13943 | MSAllocatorAttr *MSAllocatorAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
13944 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
13945 | return Create(Ctx, I); |
||
13946 | } |
||
13947 | |||
13948 | MSAllocatorAttr::MSAllocatorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
13949 | ) |
||
13950 | : InheritableAttr(Ctx, CommonInfo, attr::MSAllocator, false, false) |
||
13951 | { |
||
13952 | } |
||
13953 | |||
13954 | MSAllocatorAttr *MSAllocatorAttr::clone(ASTContext &C) const { |
||
13955 | auto *A = new (C) MSAllocatorAttr(C, *this); |
||
13956 | A->Inherited = Inherited; |
||
13957 | A->IsPackExpansion = IsPackExpansion; |
||
13958 | A->setImplicit(Implicit); |
||
13959 | return A; |
||
13960 | } |
||
13961 | |||
13962 | void MSAllocatorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
13963 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
13964 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
13965 | switch (getAttributeSpellingListIndex()) { |
||
13966 | default: |
||
13967 | llvm_unreachable("Unknown attribute spelling!"); |
||
13968 | break; |
||
13969 | case 0 : { |
||
13970 | OS << " __declspec(allocator"; |
||
13971 | OS << ")"; |
||
13972 | break; |
||
13973 | } |
||
13974 | } |
||
13975 | } |
||
13976 | |||
13977 | const char *MSAllocatorAttr::getSpelling() const { |
||
13978 | switch (getAttributeSpellingListIndex()) { |
||
13979 | default: |
||
13980 | llvm_unreachable("Unknown attribute spelling!"); |
||
13981 | return "(No spelling)"; |
||
13982 | case 0: |
||
13983 | return "allocator"; |
||
13984 | } |
||
13985 | } |
||
13986 | |||
13987 | |||
13988 | // MSInheritanceAttr implementation |
||
13989 | |||
13990 | MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, bool BestCase, const AttributeCommonInfo &CommonInfo) { |
||
13991 | auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo, BestCase); |
||
13992 | A->setImplicit(true); |
||
13993 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
13994 | A->setAttributeSpellingListIndex(0); |
||
13995 | return A; |
||
13996 | } |
||
13997 | |||
13998 | MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, bool BestCase, const AttributeCommonInfo &CommonInfo) { |
||
13999 | auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo, BestCase); |
||
14000 | return A; |
||
14001 | } |
||
14002 | |||
14003 | MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, bool BestCase, SourceRange Range, AttributeCommonInfo::Syntax Syntax, MSInheritanceAttr::Spelling S) { |
||
14004 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
14005 | return CreateImplicit(Ctx, BestCase, I); |
||
14006 | } |
||
14007 | |||
14008 | MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, bool BestCase, SourceRange Range, AttributeCommonInfo::Syntax Syntax, MSInheritanceAttr::Spelling S) { |
||
14009 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
14010 | return Create(Ctx, BestCase, I); |
||
14011 | } |
||
14012 | |||
14013 | MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14014 | auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo); |
||
14015 | A->setImplicit(true); |
||
14016 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14017 | A->setAttributeSpellingListIndex(0); |
||
14018 | return A; |
||
14019 | } |
||
14020 | |||
14021 | MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14022 | auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo); |
||
14023 | return A; |
||
14024 | } |
||
14025 | |||
14026 | MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, MSInheritanceAttr::Spelling S) { |
||
14027 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
14028 | return CreateImplicit(Ctx, I); |
||
14029 | } |
||
14030 | |||
14031 | MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, MSInheritanceAttr::Spelling S) { |
||
14032 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
14033 | return Create(Ctx, I); |
||
14034 | } |
||
14035 | |||
14036 | MSInheritanceAttr::MSInheritanceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14037 | , bool BestCase |
||
14038 | ) |
||
14039 | : InheritableAttr(Ctx, CommonInfo, attr::MSInheritance, false, false) |
||
14040 | , bestCase(BestCase) |
||
14041 | { |
||
14042 | } |
||
14043 | |||
14044 | MSInheritanceAttr::MSInheritanceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14045 | ) |
||
14046 | : InheritableAttr(Ctx, CommonInfo, attr::MSInheritance, false, false) |
||
14047 | , bestCase() |
||
14048 | { |
||
14049 | } |
||
14050 | |||
14051 | MSInheritanceAttr::Spelling MSInheritanceAttr::getSemanticSpelling() const { |
||
14052 | switch (getAttributeSpellingListIndex()) { |
||
14053 | default: llvm_unreachable("Unknown spelling list index"); |
||
14054 | case 0: return Keyword_single_inheritance; |
||
14055 | case 1: return Keyword_multiple_inheritance; |
||
14056 | case 2: return Keyword_virtual_inheritance; |
||
14057 | case 3: return Keyword_unspecified_inheritance; |
||
14058 | } |
||
14059 | } |
||
14060 | |||
14061 | |||
14062 | MSInheritanceAttr *MSInheritanceAttr::clone(ASTContext &C) const { |
||
14063 | auto *A = new (C) MSInheritanceAttr(C, *this, bestCase); |
||
14064 | A->Inherited = Inherited; |
||
14065 | A->IsPackExpansion = IsPackExpansion; |
||
14066 | A->setImplicit(Implicit); |
||
14067 | return A; |
||
14068 | } |
||
14069 | |||
14070 | void MSInheritanceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14071 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14072 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14073 | switch (getAttributeSpellingListIndex()) { |
||
14074 | default: |
||
14075 | llvm_unreachable("Unknown attribute spelling!"); |
||
14076 | break; |
||
14077 | case 0 : { |
||
14078 | OS << " __single_inheritance"; |
||
14079 | OS << ""; |
||
14080 | break; |
||
14081 | } |
||
14082 | case 1 : { |
||
14083 | OS << " __multiple_inheritance"; |
||
14084 | OS << ""; |
||
14085 | break; |
||
14086 | } |
||
14087 | case 2 : { |
||
14088 | OS << " __virtual_inheritance"; |
||
14089 | OS << ""; |
||
14090 | break; |
||
14091 | } |
||
14092 | case 3 : { |
||
14093 | OS << " __unspecified_inheritance"; |
||
14094 | OS << ""; |
||
14095 | break; |
||
14096 | } |
||
14097 | } |
||
14098 | } |
||
14099 | |||
14100 | const char *MSInheritanceAttr::getSpelling() const { |
||
14101 | switch (getAttributeSpellingListIndex()) { |
||
14102 | default: |
||
14103 | llvm_unreachable("Unknown attribute spelling!"); |
||
14104 | return "(No spelling)"; |
||
14105 | case 0: |
||
14106 | return "__single_inheritance"; |
||
14107 | case 1: |
||
14108 | return "__multiple_inheritance"; |
||
14109 | case 2: |
||
14110 | return "__virtual_inheritance"; |
||
14111 | case 3: |
||
14112 | return "__unspecified_inheritance"; |
||
14113 | } |
||
14114 | } |
||
14115 | |||
14116 | |||
14117 | // MSNoVTableAttr implementation |
||
14118 | |||
14119 | MSNoVTableAttr *MSNoVTableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14120 | auto *A = new (Ctx) MSNoVTableAttr(Ctx, CommonInfo); |
||
14121 | A->setImplicit(true); |
||
14122 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14123 | A->setAttributeSpellingListIndex(0); |
||
14124 | return A; |
||
14125 | } |
||
14126 | |||
14127 | MSNoVTableAttr *MSNoVTableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14128 | auto *A = new (Ctx) MSNoVTableAttr(Ctx, CommonInfo); |
||
14129 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14130 | A->setAttributeSpellingListIndex(0); |
||
14131 | return A; |
||
14132 | } |
||
14133 | |||
14134 | MSNoVTableAttr *MSNoVTableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14135 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14136 | return CreateImplicit(Ctx, I); |
||
14137 | } |
||
14138 | |||
14139 | MSNoVTableAttr *MSNoVTableAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14140 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14141 | return Create(Ctx, I); |
||
14142 | } |
||
14143 | |||
14144 | MSNoVTableAttr::MSNoVTableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14145 | ) |
||
14146 | : InheritableAttr(Ctx, CommonInfo, attr::MSNoVTable, false, false) |
||
14147 | { |
||
14148 | } |
||
14149 | |||
14150 | MSNoVTableAttr *MSNoVTableAttr::clone(ASTContext &C) const { |
||
14151 | auto *A = new (C) MSNoVTableAttr(C, *this); |
||
14152 | A->Inherited = Inherited; |
||
14153 | A->IsPackExpansion = IsPackExpansion; |
||
14154 | A->setImplicit(Implicit); |
||
14155 | return A; |
||
14156 | } |
||
14157 | |||
14158 | void MSNoVTableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14159 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14160 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14161 | switch (getAttributeSpellingListIndex()) { |
||
14162 | default: |
||
14163 | llvm_unreachable("Unknown attribute spelling!"); |
||
14164 | break; |
||
14165 | case 0 : { |
||
14166 | OS << " __declspec(novtable"; |
||
14167 | OS << ")"; |
||
14168 | break; |
||
14169 | } |
||
14170 | } |
||
14171 | } |
||
14172 | |||
14173 | const char *MSNoVTableAttr::getSpelling() const { |
||
14174 | switch (getAttributeSpellingListIndex()) { |
||
14175 | default: |
||
14176 | llvm_unreachable("Unknown attribute spelling!"); |
||
14177 | return "(No spelling)"; |
||
14178 | case 0: |
||
14179 | return "novtable"; |
||
14180 | } |
||
14181 | } |
||
14182 | |||
14183 | |||
14184 | // MSP430InterruptAttr implementation |
||
14185 | |||
14186 | MSP430InterruptAttr *MSP430InterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) { |
||
14187 | auto *A = new (Ctx) MSP430InterruptAttr(Ctx, CommonInfo, Number); |
||
14188 | A->setImplicit(true); |
||
14189 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14190 | A->setAttributeSpellingListIndex(0); |
||
14191 | return A; |
||
14192 | } |
||
14193 | |||
14194 | MSP430InterruptAttr *MSP430InterruptAttr::Create(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) { |
||
14195 | auto *A = new (Ctx) MSP430InterruptAttr(Ctx, CommonInfo, Number); |
||
14196 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14197 | A->setAttributeSpellingListIndex(0); |
||
14198 | return A; |
||
14199 | } |
||
14200 | |||
14201 | MSP430InterruptAttr *MSP430InterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14202 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14203 | return CreateImplicit(Ctx, Number, I); |
||
14204 | } |
||
14205 | |||
14206 | MSP430InterruptAttr *MSP430InterruptAttr::Create(ASTContext &Ctx, unsigned Number, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14207 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14208 | return Create(Ctx, Number, I); |
||
14209 | } |
||
14210 | |||
14211 | MSP430InterruptAttr::MSP430InterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14212 | , unsigned Number |
||
14213 | ) |
||
14214 | : InheritableAttr(Ctx, CommonInfo, attr::MSP430Interrupt, false, false) |
||
14215 | , number(Number) |
||
14216 | { |
||
14217 | } |
||
14218 | |||
14219 | |||
14220 | |||
14221 | MSP430InterruptAttr *MSP430InterruptAttr::clone(ASTContext &C) const { |
||
14222 | auto *A = new (C) MSP430InterruptAttr(C, *this, number); |
||
14223 | A->Inherited = Inherited; |
||
14224 | A->IsPackExpansion = IsPackExpansion; |
||
14225 | A->setImplicit(Implicit); |
||
14226 | return A; |
||
14227 | } |
||
14228 | |||
14229 | void MSP430InterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14230 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14231 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14232 | switch (getAttributeSpellingListIndex()) { |
||
14233 | default: |
||
14234 | llvm_unreachable("Unknown attribute spelling!"); |
||
14235 | break; |
||
14236 | case 0 : { |
||
14237 | OS << " __attribute__((interrupt"; |
||
14238 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
14239 | OS << "" << getNumber() << ""; |
||
14240 | if (!IsFirstArgument) |
||
14241 | OS << ")"; |
||
14242 | OS << "))"; |
||
14243 | break; |
||
14244 | } |
||
14245 | case 1 : { |
||
14246 | OS << " [[gnu::interrupt"; |
||
14247 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
14248 | OS << "" << getNumber() << ""; |
||
14249 | if (!IsFirstArgument) |
||
14250 | OS << ")"; |
||
14251 | OS << "]]"; |
||
14252 | break; |
||
14253 | } |
||
14254 | case 2 : { |
||
14255 | OS << " [[gnu::interrupt"; |
||
14256 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
14257 | OS << "" << getNumber() << ""; |
||
14258 | if (!IsFirstArgument) |
||
14259 | OS << ")"; |
||
14260 | OS << "]]"; |
||
14261 | break; |
||
14262 | } |
||
14263 | } |
||
14264 | } |
||
14265 | |||
14266 | const char *MSP430InterruptAttr::getSpelling() const { |
||
14267 | switch (getAttributeSpellingListIndex()) { |
||
14268 | default: |
||
14269 | llvm_unreachable("Unknown attribute spelling!"); |
||
14270 | return "(No spelling)"; |
||
14271 | case 0: |
||
14272 | return "interrupt"; |
||
14273 | case 1: |
||
14274 | return "interrupt"; |
||
14275 | case 2: |
||
14276 | return "interrupt"; |
||
14277 | } |
||
14278 | } |
||
14279 | |||
14280 | |||
14281 | // MSStructAttr implementation |
||
14282 | |||
14283 | MSStructAttr *MSStructAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14284 | auto *A = new (Ctx) MSStructAttr(Ctx, CommonInfo); |
||
14285 | A->setImplicit(true); |
||
14286 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14287 | A->setAttributeSpellingListIndex(0); |
||
14288 | return A; |
||
14289 | } |
||
14290 | |||
14291 | MSStructAttr *MSStructAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14292 | auto *A = new (Ctx) MSStructAttr(Ctx, CommonInfo); |
||
14293 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14294 | A->setAttributeSpellingListIndex(0); |
||
14295 | return A; |
||
14296 | } |
||
14297 | |||
14298 | MSStructAttr *MSStructAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14299 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14300 | return CreateImplicit(Ctx, I); |
||
14301 | } |
||
14302 | |||
14303 | MSStructAttr *MSStructAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14304 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14305 | return Create(Ctx, I); |
||
14306 | } |
||
14307 | |||
14308 | MSStructAttr::MSStructAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14309 | ) |
||
14310 | : InheritableAttr(Ctx, CommonInfo, attr::MSStruct, false, false) |
||
14311 | { |
||
14312 | } |
||
14313 | |||
14314 | MSStructAttr *MSStructAttr::clone(ASTContext &C) const { |
||
14315 | auto *A = new (C) MSStructAttr(C, *this); |
||
14316 | A->Inherited = Inherited; |
||
14317 | A->IsPackExpansion = IsPackExpansion; |
||
14318 | A->setImplicit(Implicit); |
||
14319 | return A; |
||
14320 | } |
||
14321 | |||
14322 | void MSStructAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14323 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14324 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14325 | switch (getAttributeSpellingListIndex()) { |
||
14326 | default: |
||
14327 | llvm_unreachable("Unknown attribute spelling!"); |
||
14328 | break; |
||
14329 | case 0 : { |
||
14330 | OS << " __attribute__((ms_struct"; |
||
14331 | OS << "))"; |
||
14332 | break; |
||
14333 | } |
||
14334 | case 1 : { |
||
14335 | OS << " [[gnu::ms_struct"; |
||
14336 | OS << "]]"; |
||
14337 | break; |
||
14338 | } |
||
14339 | case 2 : { |
||
14340 | OS << " [[gnu::ms_struct"; |
||
14341 | OS << "]]"; |
||
14342 | break; |
||
14343 | } |
||
14344 | } |
||
14345 | } |
||
14346 | |||
14347 | const char *MSStructAttr::getSpelling() const { |
||
14348 | switch (getAttributeSpellingListIndex()) { |
||
14349 | default: |
||
14350 | llvm_unreachable("Unknown attribute spelling!"); |
||
14351 | return "(No spelling)"; |
||
14352 | case 0: |
||
14353 | return "ms_struct"; |
||
14354 | case 1: |
||
14355 | return "ms_struct"; |
||
14356 | case 2: |
||
14357 | return "ms_struct"; |
||
14358 | } |
||
14359 | } |
||
14360 | |||
14361 | |||
14362 | // MSVtorDispAttr implementation |
||
14363 | |||
14364 | MSVtorDispAttr *MSVtorDispAttr::CreateImplicit(ASTContext &Ctx, unsigned Vdm, const AttributeCommonInfo &CommonInfo) { |
||
14365 | auto *A = new (Ctx) MSVtorDispAttr(Ctx, CommonInfo, Vdm); |
||
14366 | A->setImplicit(true); |
||
14367 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14368 | A->setAttributeSpellingListIndex(0); |
||
14369 | return A; |
||
14370 | } |
||
14371 | |||
14372 | MSVtorDispAttr *MSVtorDispAttr::Create(ASTContext &Ctx, unsigned Vdm, const AttributeCommonInfo &CommonInfo) { |
||
14373 | auto *A = new (Ctx) MSVtorDispAttr(Ctx, CommonInfo, Vdm); |
||
14374 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14375 | A->setAttributeSpellingListIndex(0); |
||
14376 | return A; |
||
14377 | } |
||
14378 | |||
14379 | MSVtorDispAttr *MSVtorDispAttr::CreateImplicit(ASTContext &Ctx, unsigned Vdm, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14380 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14381 | return CreateImplicit(Ctx, Vdm, I); |
||
14382 | } |
||
14383 | |||
14384 | MSVtorDispAttr *MSVtorDispAttr::Create(ASTContext &Ctx, unsigned Vdm, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14385 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14386 | return Create(Ctx, Vdm, I); |
||
14387 | } |
||
14388 | |||
14389 | MSVtorDispAttr::MSVtorDispAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14390 | , unsigned Vdm |
||
14391 | ) |
||
14392 | : InheritableAttr(Ctx, CommonInfo, attr::MSVtorDisp, false, false) |
||
14393 | , vdm(Vdm) |
||
14394 | { |
||
14395 | } |
||
14396 | |||
14397 | |||
14398 | |||
14399 | MSVtorDispAttr *MSVtorDispAttr::clone(ASTContext &C) const { |
||
14400 | auto *A = new (C) MSVtorDispAttr(C, *this, vdm); |
||
14401 | A->Inherited = Inherited; |
||
14402 | A->IsPackExpansion = IsPackExpansion; |
||
14403 | A->setImplicit(Implicit); |
||
14404 | return A; |
||
14405 | } |
||
14406 | |||
14407 | void MSVtorDispAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14408 | } |
||
14409 | |||
14410 | const char *MSVtorDispAttr::getSpelling() const { |
||
14411 | return "(No spelling)"; |
||
14412 | } |
||
14413 | |||
14414 | |||
14415 | // MaxFieldAlignmentAttr implementation |
||
14416 | |||
14417 | MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::CreateImplicit(ASTContext &Ctx, unsigned Alignment, const AttributeCommonInfo &CommonInfo) { |
||
14418 | auto *A = new (Ctx) MaxFieldAlignmentAttr(Ctx, CommonInfo, Alignment); |
||
14419 | A->setImplicit(true); |
||
14420 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14421 | A->setAttributeSpellingListIndex(0); |
||
14422 | return A; |
||
14423 | } |
||
14424 | |||
14425 | MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::Create(ASTContext &Ctx, unsigned Alignment, const AttributeCommonInfo &CommonInfo) { |
||
14426 | auto *A = new (Ctx) MaxFieldAlignmentAttr(Ctx, CommonInfo, Alignment); |
||
14427 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14428 | A->setAttributeSpellingListIndex(0); |
||
14429 | return A; |
||
14430 | } |
||
14431 | |||
14432 | MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::CreateImplicit(ASTContext &Ctx, unsigned Alignment, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14433 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14434 | return CreateImplicit(Ctx, Alignment, I); |
||
14435 | } |
||
14436 | |||
14437 | MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::Create(ASTContext &Ctx, unsigned Alignment, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14438 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14439 | return Create(Ctx, Alignment, I); |
||
14440 | } |
||
14441 | |||
14442 | MaxFieldAlignmentAttr::MaxFieldAlignmentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14443 | , unsigned Alignment |
||
14444 | ) |
||
14445 | : InheritableAttr(Ctx, CommonInfo, attr::MaxFieldAlignment, false, false) |
||
14446 | , alignment(Alignment) |
||
14447 | { |
||
14448 | } |
||
14449 | |||
14450 | |||
14451 | |||
14452 | MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::clone(ASTContext &C) const { |
||
14453 | auto *A = new (C) MaxFieldAlignmentAttr(C, *this, alignment); |
||
14454 | A->Inherited = Inherited; |
||
14455 | A->IsPackExpansion = IsPackExpansion; |
||
14456 | A->setImplicit(Implicit); |
||
14457 | return A; |
||
14458 | } |
||
14459 | |||
14460 | void MaxFieldAlignmentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14461 | } |
||
14462 | |||
14463 | const char *MaxFieldAlignmentAttr::getSpelling() const { |
||
14464 | return "(No spelling)"; |
||
14465 | } |
||
14466 | |||
14467 | |||
14468 | // MayAliasAttr implementation |
||
14469 | |||
14470 | MayAliasAttr *MayAliasAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14471 | auto *A = new (Ctx) MayAliasAttr(Ctx, CommonInfo); |
||
14472 | A->setImplicit(true); |
||
14473 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14474 | A->setAttributeSpellingListIndex(0); |
||
14475 | return A; |
||
14476 | } |
||
14477 | |||
14478 | MayAliasAttr *MayAliasAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14479 | auto *A = new (Ctx) MayAliasAttr(Ctx, CommonInfo); |
||
14480 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14481 | A->setAttributeSpellingListIndex(0); |
||
14482 | return A; |
||
14483 | } |
||
14484 | |||
14485 | MayAliasAttr *MayAliasAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14486 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14487 | return CreateImplicit(Ctx, I); |
||
14488 | } |
||
14489 | |||
14490 | MayAliasAttr *MayAliasAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14491 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14492 | return Create(Ctx, I); |
||
14493 | } |
||
14494 | |||
14495 | MayAliasAttr::MayAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14496 | ) |
||
14497 | : InheritableAttr(Ctx, CommonInfo, attr::MayAlias, false, false) |
||
14498 | { |
||
14499 | } |
||
14500 | |||
14501 | MayAliasAttr *MayAliasAttr::clone(ASTContext &C) const { |
||
14502 | auto *A = new (C) MayAliasAttr(C, *this); |
||
14503 | A->Inherited = Inherited; |
||
14504 | A->IsPackExpansion = IsPackExpansion; |
||
14505 | A->setImplicit(Implicit); |
||
14506 | return A; |
||
14507 | } |
||
14508 | |||
14509 | void MayAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14510 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14511 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14512 | switch (getAttributeSpellingListIndex()) { |
||
14513 | default: |
||
14514 | llvm_unreachable("Unknown attribute spelling!"); |
||
14515 | break; |
||
14516 | case 0 : { |
||
14517 | OS << " __attribute__((may_alias"; |
||
14518 | OS << "))"; |
||
14519 | break; |
||
14520 | } |
||
14521 | case 1 : { |
||
14522 | OS << " [[gnu::may_alias"; |
||
14523 | OS << "]]"; |
||
14524 | break; |
||
14525 | } |
||
14526 | case 2 : { |
||
14527 | OS << " [[gnu::may_alias"; |
||
14528 | OS << "]]"; |
||
14529 | break; |
||
14530 | } |
||
14531 | } |
||
14532 | } |
||
14533 | |||
14534 | const char *MayAliasAttr::getSpelling() const { |
||
14535 | switch (getAttributeSpellingListIndex()) { |
||
14536 | default: |
||
14537 | llvm_unreachable("Unknown attribute spelling!"); |
||
14538 | return "(No spelling)"; |
||
14539 | case 0: |
||
14540 | return "may_alias"; |
||
14541 | case 1: |
||
14542 | return "may_alias"; |
||
14543 | case 2: |
||
14544 | return "may_alias"; |
||
14545 | } |
||
14546 | } |
||
14547 | |||
14548 | |||
14549 | // MaybeUndefAttr implementation |
||
14550 | |||
14551 | MaybeUndefAttr *MaybeUndefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14552 | auto *A = new (Ctx) MaybeUndefAttr(Ctx, CommonInfo); |
||
14553 | A->setImplicit(true); |
||
14554 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14555 | A->setAttributeSpellingListIndex(0); |
||
14556 | return A; |
||
14557 | } |
||
14558 | |||
14559 | MaybeUndefAttr *MaybeUndefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14560 | auto *A = new (Ctx) MaybeUndefAttr(Ctx, CommonInfo); |
||
14561 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14562 | A->setAttributeSpellingListIndex(0); |
||
14563 | return A; |
||
14564 | } |
||
14565 | |||
14566 | MaybeUndefAttr *MaybeUndefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14567 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14568 | return CreateImplicit(Ctx, I); |
||
14569 | } |
||
14570 | |||
14571 | MaybeUndefAttr *MaybeUndefAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14572 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14573 | return Create(Ctx, I); |
||
14574 | } |
||
14575 | |||
14576 | MaybeUndefAttr::MaybeUndefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14577 | ) |
||
14578 | : InheritableAttr(Ctx, CommonInfo, attr::MaybeUndef, false, false) |
||
14579 | { |
||
14580 | } |
||
14581 | |||
14582 | MaybeUndefAttr *MaybeUndefAttr::clone(ASTContext &C) const { |
||
14583 | auto *A = new (C) MaybeUndefAttr(C, *this); |
||
14584 | A->Inherited = Inherited; |
||
14585 | A->IsPackExpansion = IsPackExpansion; |
||
14586 | A->setImplicit(Implicit); |
||
14587 | return A; |
||
14588 | } |
||
14589 | |||
14590 | void MaybeUndefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14591 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14592 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14593 | switch (getAttributeSpellingListIndex()) { |
||
14594 | default: |
||
14595 | llvm_unreachable("Unknown attribute spelling!"); |
||
14596 | break; |
||
14597 | case 0 : { |
||
14598 | OS << " __attribute__((maybe_undef"; |
||
14599 | OS << "))"; |
||
14600 | break; |
||
14601 | } |
||
14602 | case 1 : { |
||
14603 | OS << " [[clang::maybe_undef"; |
||
14604 | OS << "]]"; |
||
14605 | break; |
||
14606 | } |
||
14607 | case 2 : { |
||
14608 | OS << " [[clang::maybe_undef"; |
||
14609 | OS << "]]"; |
||
14610 | break; |
||
14611 | } |
||
14612 | } |
||
14613 | } |
||
14614 | |||
14615 | const char *MaybeUndefAttr::getSpelling() const { |
||
14616 | switch (getAttributeSpellingListIndex()) { |
||
14617 | default: |
||
14618 | llvm_unreachable("Unknown attribute spelling!"); |
||
14619 | return "(No spelling)"; |
||
14620 | case 0: |
||
14621 | return "maybe_undef"; |
||
14622 | case 1: |
||
14623 | return "maybe_undef"; |
||
14624 | case 2: |
||
14625 | return "maybe_undef"; |
||
14626 | } |
||
14627 | } |
||
14628 | |||
14629 | |||
14630 | // MicroMipsAttr implementation |
||
14631 | |||
14632 | MicroMipsAttr *MicroMipsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14633 | auto *A = new (Ctx) MicroMipsAttr(Ctx, CommonInfo); |
||
14634 | A->setImplicit(true); |
||
14635 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14636 | A->setAttributeSpellingListIndex(0); |
||
14637 | return A; |
||
14638 | } |
||
14639 | |||
14640 | MicroMipsAttr *MicroMipsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14641 | auto *A = new (Ctx) MicroMipsAttr(Ctx, CommonInfo); |
||
14642 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14643 | A->setAttributeSpellingListIndex(0); |
||
14644 | return A; |
||
14645 | } |
||
14646 | |||
14647 | MicroMipsAttr *MicroMipsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14648 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14649 | return CreateImplicit(Ctx, I); |
||
14650 | } |
||
14651 | |||
14652 | MicroMipsAttr *MicroMipsAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14653 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14654 | return Create(Ctx, I); |
||
14655 | } |
||
14656 | |||
14657 | MicroMipsAttr::MicroMipsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14658 | ) |
||
14659 | : InheritableAttr(Ctx, CommonInfo, attr::MicroMips, false, false) |
||
14660 | { |
||
14661 | } |
||
14662 | |||
14663 | MicroMipsAttr *MicroMipsAttr::clone(ASTContext &C) const { |
||
14664 | auto *A = new (C) MicroMipsAttr(C, *this); |
||
14665 | A->Inherited = Inherited; |
||
14666 | A->IsPackExpansion = IsPackExpansion; |
||
14667 | A->setImplicit(Implicit); |
||
14668 | return A; |
||
14669 | } |
||
14670 | |||
14671 | void MicroMipsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14672 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14673 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14674 | switch (getAttributeSpellingListIndex()) { |
||
14675 | default: |
||
14676 | llvm_unreachable("Unknown attribute spelling!"); |
||
14677 | break; |
||
14678 | case 0 : { |
||
14679 | OS << " __attribute__((micromips"; |
||
14680 | OS << "))"; |
||
14681 | break; |
||
14682 | } |
||
14683 | case 1 : { |
||
14684 | OS << " [[gnu::micromips"; |
||
14685 | OS << "]]"; |
||
14686 | break; |
||
14687 | } |
||
14688 | case 2 : { |
||
14689 | OS << " [[gnu::micromips"; |
||
14690 | OS << "]]"; |
||
14691 | break; |
||
14692 | } |
||
14693 | } |
||
14694 | } |
||
14695 | |||
14696 | const char *MicroMipsAttr::getSpelling() const { |
||
14697 | switch (getAttributeSpellingListIndex()) { |
||
14698 | default: |
||
14699 | llvm_unreachable("Unknown attribute spelling!"); |
||
14700 | return "(No spelling)"; |
||
14701 | case 0: |
||
14702 | return "micromips"; |
||
14703 | case 1: |
||
14704 | return "micromips"; |
||
14705 | case 2: |
||
14706 | return "micromips"; |
||
14707 | } |
||
14708 | } |
||
14709 | |||
14710 | |||
14711 | // MinSizeAttr implementation |
||
14712 | |||
14713 | MinSizeAttr *MinSizeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14714 | auto *A = new (Ctx) MinSizeAttr(Ctx, CommonInfo); |
||
14715 | A->setImplicit(true); |
||
14716 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14717 | A->setAttributeSpellingListIndex(0); |
||
14718 | return A; |
||
14719 | } |
||
14720 | |||
14721 | MinSizeAttr *MinSizeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14722 | auto *A = new (Ctx) MinSizeAttr(Ctx, CommonInfo); |
||
14723 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14724 | A->setAttributeSpellingListIndex(0); |
||
14725 | return A; |
||
14726 | } |
||
14727 | |||
14728 | MinSizeAttr *MinSizeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14729 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14730 | return CreateImplicit(Ctx, I); |
||
14731 | } |
||
14732 | |||
14733 | MinSizeAttr *MinSizeAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14734 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14735 | return Create(Ctx, I); |
||
14736 | } |
||
14737 | |||
14738 | MinSizeAttr::MinSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14739 | ) |
||
14740 | : InheritableAttr(Ctx, CommonInfo, attr::MinSize, false, false) |
||
14741 | { |
||
14742 | } |
||
14743 | |||
14744 | MinSizeAttr *MinSizeAttr::clone(ASTContext &C) const { |
||
14745 | auto *A = new (C) MinSizeAttr(C, *this); |
||
14746 | A->Inherited = Inherited; |
||
14747 | A->IsPackExpansion = IsPackExpansion; |
||
14748 | A->setImplicit(Implicit); |
||
14749 | return A; |
||
14750 | } |
||
14751 | |||
14752 | void MinSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14753 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14754 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14755 | switch (getAttributeSpellingListIndex()) { |
||
14756 | default: |
||
14757 | llvm_unreachable("Unknown attribute spelling!"); |
||
14758 | break; |
||
14759 | case 0 : { |
||
14760 | OS << " __attribute__((minsize"; |
||
14761 | OS << "))"; |
||
14762 | break; |
||
14763 | } |
||
14764 | case 1 : { |
||
14765 | OS << " [[clang::minsize"; |
||
14766 | OS << "]]"; |
||
14767 | break; |
||
14768 | } |
||
14769 | case 2 : { |
||
14770 | OS << " [[clang::minsize"; |
||
14771 | OS << "]]"; |
||
14772 | break; |
||
14773 | } |
||
14774 | } |
||
14775 | } |
||
14776 | |||
14777 | const char *MinSizeAttr::getSpelling() const { |
||
14778 | switch (getAttributeSpellingListIndex()) { |
||
14779 | default: |
||
14780 | llvm_unreachable("Unknown attribute spelling!"); |
||
14781 | return "(No spelling)"; |
||
14782 | case 0: |
||
14783 | return "minsize"; |
||
14784 | case 1: |
||
14785 | return "minsize"; |
||
14786 | case 2: |
||
14787 | return "minsize"; |
||
14788 | } |
||
14789 | } |
||
14790 | |||
14791 | |||
14792 | // MinVectorWidthAttr implementation |
||
14793 | |||
14794 | MinVectorWidthAttr *MinVectorWidthAttr::CreateImplicit(ASTContext &Ctx, unsigned VectorWidth, const AttributeCommonInfo &CommonInfo) { |
||
14795 | auto *A = new (Ctx) MinVectorWidthAttr(Ctx, CommonInfo, VectorWidth); |
||
14796 | A->setImplicit(true); |
||
14797 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14798 | A->setAttributeSpellingListIndex(0); |
||
14799 | return A; |
||
14800 | } |
||
14801 | |||
14802 | MinVectorWidthAttr *MinVectorWidthAttr::Create(ASTContext &Ctx, unsigned VectorWidth, const AttributeCommonInfo &CommonInfo) { |
||
14803 | auto *A = new (Ctx) MinVectorWidthAttr(Ctx, CommonInfo, VectorWidth); |
||
14804 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14805 | A->setAttributeSpellingListIndex(0); |
||
14806 | return A; |
||
14807 | } |
||
14808 | |||
14809 | MinVectorWidthAttr *MinVectorWidthAttr::CreateImplicit(ASTContext &Ctx, unsigned VectorWidth, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14810 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14811 | return CreateImplicit(Ctx, VectorWidth, I); |
||
14812 | } |
||
14813 | |||
14814 | MinVectorWidthAttr *MinVectorWidthAttr::Create(ASTContext &Ctx, unsigned VectorWidth, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14815 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14816 | return Create(Ctx, VectorWidth, I); |
||
14817 | } |
||
14818 | |||
14819 | MinVectorWidthAttr::MinVectorWidthAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14820 | , unsigned VectorWidth |
||
14821 | ) |
||
14822 | : InheritableAttr(Ctx, CommonInfo, attr::MinVectorWidth, false, false) |
||
14823 | , vectorWidth(VectorWidth) |
||
14824 | { |
||
14825 | } |
||
14826 | |||
14827 | |||
14828 | |||
14829 | MinVectorWidthAttr *MinVectorWidthAttr::clone(ASTContext &C) const { |
||
14830 | auto *A = new (C) MinVectorWidthAttr(C, *this, vectorWidth); |
||
14831 | A->Inherited = Inherited; |
||
14832 | A->IsPackExpansion = IsPackExpansion; |
||
14833 | A->setImplicit(Implicit); |
||
14834 | return A; |
||
14835 | } |
||
14836 | |||
14837 | void MinVectorWidthAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14838 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14839 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14840 | switch (getAttributeSpellingListIndex()) { |
||
14841 | default: |
||
14842 | llvm_unreachable("Unknown attribute spelling!"); |
||
14843 | break; |
||
14844 | case 0 : { |
||
14845 | OS << " __attribute__((min_vector_width"; |
||
14846 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
14847 | OS << "" << getVectorWidth() << ""; |
||
14848 | if (!IsFirstArgument) |
||
14849 | OS << ")"; |
||
14850 | OS << "))"; |
||
14851 | break; |
||
14852 | } |
||
14853 | case 1 : { |
||
14854 | OS << " [[clang::min_vector_width"; |
||
14855 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
14856 | OS << "" << getVectorWidth() << ""; |
||
14857 | if (!IsFirstArgument) |
||
14858 | OS << ")"; |
||
14859 | OS << "]]"; |
||
14860 | break; |
||
14861 | } |
||
14862 | case 2 : { |
||
14863 | OS << " [[clang::min_vector_width"; |
||
14864 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
14865 | OS << "" << getVectorWidth() << ""; |
||
14866 | if (!IsFirstArgument) |
||
14867 | OS << ")"; |
||
14868 | OS << "]]"; |
||
14869 | break; |
||
14870 | } |
||
14871 | } |
||
14872 | } |
||
14873 | |||
14874 | const char *MinVectorWidthAttr::getSpelling() const { |
||
14875 | switch (getAttributeSpellingListIndex()) { |
||
14876 | default: |
||
14877 | llvm_unreachable("Unknown attribute spelling!"); |
||
14878 | return "(No spelling)"; |
||
14879 | case 0: |
||
14880 | return "min_vector_width"; |
||
14881 | case 1: |
||
14882 | return "min_vector_width"; |
||
14883 | case 2: |
||
14884 | return "min_vector_width"; |
||
14885 | } |
||
14886 | } |
||
14887 | |||
14888 | |||
14889 | // Mips16Attr implementation |
||
14890 | |||
14891 | Mips16Attr *Mips16Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14892 | auto *A = new (Ctx) Mips16Attr(Ctx, CommonInfo); |
||
14893 | A->setImplicit(true); |
||
14894 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14895 | A->setAttributeSpellingListIndex(0); |
||
14896 | return A; |
||
14897 | } |
||
14898 | |||
14899 | Mips16Attr *Mips16Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
14900 | auto *A = new (Ctx) Mips16Attr(Ctx, CommonInfo); |
||
14901 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14902 | A->setAttributeSpellingListIndex(0); |
||
14903 | return A; |
||
14904 | } |
||
14905 | |||
14906 | Mips16Attr *Mips16Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14907 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14908 | return CreateImplicit(Ctx, I); |
||
14909 | } |
||
14910 | |||
14911 | Mips16Attr *Mips16Attr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14912 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14913 | return Create(Ctx, I); |
||
14914 | } |
||
14915 | |||
14916 | Mips16Attr::Mips16Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14917 | ) |
||
14918 | : InheritableAttr(Ctx, CommonInfo, attr::Mips16, false, false) |
||
14919 | { |
||
14920 | } |
||
14921 | |||
14922 | Mips16Attr *Mips16Attr::clone(ASTContext &C) const { |
||
14923 | auto *A = new (C) Mips16Attr(C, *this); |
||
14924 | A->Inherited = Inherited; |
||
14925 | A->IsPackExpansion = IsPackExpansion; |
||
14926 | A->setImplicit(Implicit); |
||
14927 | return A; |
||
14928 | } |
||
14929 | |||
14930 | void Mips16Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
14931 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
14932 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
14933 | switch (getAttributeSpellingListIndex()) { |
||
14934 | default: |
||
14935 | llvm_unreachable("Unknown attribute spelling!"); |
||
14936 | break; |
||
14937 | case 0 : { |
||
14938 | OS << " __attribute__((mips16"; |
||
14939 | OS << "))"; |
||
14940 | break; |
||
14941 | } |
||
14942 | case 1 : { |
||
14943 | OS << " [[gnu::mips16"; |
||
14944 | OS << "]]"; |
||
14945 | break; |
||
14946 | } |
||
14947 | case 2 : { |
||
14948 | OS << " [[gnu::mips16"; |
||
14949 | OS << "]]"; |
||
14950 | break; |
||
14951 | } |
||
14952 | } |
||
14953 | } |
||
14954 | |||
14955 | const char *Mips16Attr::getSpelling() const { |
||
14956 | switch (getAttributeSpellingListIndex()) { |
||
14957 | default: |
||
14958 | llvm_unreachable("Unknown attribute spelling!"); |
||
14959 | return "(No spelling)"; |
||
14960 | case 0: |
||
14961 | return "mips16"; |
||
14962 | case 1: |
||
14963 | return "mips16"; |
||
14964 | case 2: |
||
14965 | return "mips16"; |
||
14966 | } |
||
14967 | } |
||
14968 | |||
14969 | |||
14970 | // MipsInterruptAttr implementation |
||
14971 | |||
14972 | MipsInterruptAttr *MipsInterruptAttr::CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { |
||
14973 | auto *A = new (Ctx) MipsInterruptAttr(Ctx, CommonInfo, Interrupt); |
||
14974 | A->setImplicit(true); |
||
14975 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14976 | A->setAttributeSpellingListIndex(0); |
||
14977 | return A; |
||
14978 | } |
||
14979 | |||
14980 | MipsInterruptAttr *MipsInterruptAttr::Create(ASTContext &Ctx, InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { |
||
14981 | auto *A = new (Ctx) MipsInterruptAttr(Ctx, CommonInfo, Interrupt); |
||
14982 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
14983 | A->setAttributeSpellingListIndex(0); |
||
14984 | return A; |
||
14985 | } |
||
14986 | |||
14987 | MipsInterruptAttr *MipsInterruptAttr::CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14988 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14989 | return CreateImplicit(Ctx, Interrupt, I); |
||
14990 | } |
||
14991 | |||
14992 | MipsInterruptAttr *MipsInterruptAttr::Create(ASTContext &Ctx, InterruptType Interrupt, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
14993 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
14994 | return Create(Ctx, Interrupt, I); |
||
14995 | } |
||
14996 | |||
14997 | MipsInterruptAttr::MipsInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
14998 | , InterruptType Interrupt |
||
14999 | ) |
||
15000 | : InheritableAttr(Ctx, CommonInfo, attr::MipsInterrupt, false, false) |
||
15001 | , interrupt(Interrupt) |
||
15002 | { |
||
15003 | } |
||
15004 | |||
15005 | |||
15006 | |||
15007 | bool MipsInterruptAttr::ConvertStrToInterruptType(StringRef Val, InterruptType &Out) { |
||
15008 | std::optional<InterruptType> R = llvm::StringSwitch<std::optional<InterruptType>>(Val) |
||
15009 | .Case("vector=sw0", MipsInterruptAttr::sw0) |
||
15010 | .Case("vector=sw1", MipsInterruptAttr::sw1) |
||
15011 | .Case("vector=hw0", MipsInterruptAttr::hw0) |
||
15012 | .Case("vector=hw1", MipsInterruptAttr::hw1) |
||
15013 | .Case("vector=hw2", MipsInterruptAttr::hw2) |
||
15014 | .Case("vector=hw3", MipsInterruptAttr::hw3) |
||
15015 | .Case("vector=hw4", MipsInterruptAttr::hw4) |
||
15016 | .Case("vector=hw5", MipsInterruptAttr::hw5) |
||
15017 | .Case("eic", MipsInterruptAttr::eic) |
||
15018 | .Case("", MipsInterruptAttr::eic) |
||
15019 | .Default(std::optional<InterruptType>()); |
||
15020 | if (R) { |
||
15021 | Out = *R; |
||
15022 | return true; |
||
15023 | } |
||
15024 | return false; |
||
15025 | } |
||
15026 | |||
15027 | const char *MipsInterruptAttr::ConvertInterruptTypeToStr(InterruptType Val) { |
||
15028 | switch(Val) { |
||
15029 | case MipsInterruptAttr::sw0: return "vector=sw0"; |
||
15030 | case MipsInterruptAttr::sw1: return "vector=sw1"; |
||
15031 | case MipsInterruptAttr::hw0: return "vector=hw0"; |
||
15032 | case MipsInterruptAttr::hw1: return "vector=hw1"; |
||
15033 | case MipsInterruptAttr::hw2: return "vector=hw2"; |
||
15034 | case MipsInterruptAttr::hw3: return "vector=hw3"; |
||
15035 | case MipsInterruptAttr::hw4: return "vector=hw4"; |
||
15036 | case MipsInterruptAttr::hw5: return "vector=hw5"; |
||
15037 | case MipsInterruptAttr::eic: return "eic"; |
||
15038 | } |
||
15039 | llvm_unreachable("No enumerator with that value"); |
||
15040 | } |
||
15041 | MipsInterruptAttr *MipsInterruptAttr::clone(ASTContext &C) const { |
||
15042 | auto *A = new (C) MipsInterruptAttr(C, *this, interrupt); |
||
15043 | A->Inherited = Inherited; |
||
15044 | A->IsPackExpansion = IsPackExpansion; |
||
15045 | A->setImplicit(Implicit); |
||
15046 | return A; |
||
15047 | } |
||
15048 | |||
15049 | void MipsInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15050 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15051 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15052 | switch (getAttributeSpellingListIndex()) { |
||
15053 | default: |
||
15054 | llvm_unreachable("Unknown attribute spelling!"); |
||
15055 | break; |
||
15056 | case 0 : { |
||
15057 | OS << " __attribute__((interrupt"; |
||
15058 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
15059 | OS << "\"" << MipsInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; |
||
15060 | if (!IsFirstArgument) |
||
15061 | OS << ")"; |
||
15062 | OS << "))"; |
||
15063 | break; |
||
15064 | } |
||
15065 | case 1 : { |
||
15066 | OS << " [[gnu::interrupt"; |
||
15067 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
15068 | OS << "\"" << MipsInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; |
||
15069 | if (!IsFirstArgument) |
||
15070 | OS << ")"; |
||
15071 | OS << "]]"; |
||
15072 | break; |
||
15073 | } |
||
15074 | case 2 : { |
||
15075 | OS << " [[gnu::interrupt"; |
||
15076 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
15077 | OS << "\"" << MipsInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; |
||
15078 | if (!IsFirstArgument) |
||
15079 | OS << ")"; |
||
15080 | OS << "]]"; |
||
15081 | break; |
||
15082 | } |
||
15083 | } |
||
15084 | } |
||
15085 | |||
15086 | const char *MipsInterruptAttr::getSpelling() const { |
||
15087 | switch (getAttributeSpellingListIndex()) { |
||
15088 | default: |
||
15089 | llvm_unreachable("Unknown attribute spelling!"); |
||
15090 | return "(No spelling)"; |
||
15091 | case 0: |
||
15092 | return "interrupt"; |
||
15093 | case 1: |
||
15094 | return "interrupt"; |
||
15095 | case 2: |
||
15096 | return "interrupt"; |
||
15097 | } |
||
15098 | } |
||
15099 | |||
15100 | |||
15101 | // MipsLongCallAttr implementation |
||
15102 | |||
15103 | MipsLongCallAttr *MipsLongCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15104 | auto *A = new (Ctx) MipsLongCallAttr(Ctx, CommonInfo); |
||
15105 | A->setImplicit(true); |
||
15106 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15107 | A->setAttributeSpellingListIndex(0); |
||
15108 | return A; |
||
15109 | } |
||
15110 | |||
15111 | MipsLongCallAttr *MipsLongCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15112 | auto *A = new (Ctx) MipsLongCallAttr(Ctx, CommonInfo); |
||
15113 | return A; |
||
15114 | } |
||
15115 | |||
15116 | MipsLongCallAttr *MipsLongCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, MipsLongCallAttr::Spelling S) { |
||
15117 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
15118 | return CreateImplicit(Ctx, I); |
||
15119 | } |
||
15120 | |||
15121 | MipsLongCallAttr *MipsLongCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, MipsLongCallAttr::Spelling S) { |
||
15122 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
15123 | return Create(Ctx, I); |
||
15124 | } |
||
15125 | |||
15126 | MipsLongCallAttr::MipsLongCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15127 | ) |
||
15128 | : InheritableAttr(Ctx, CommonInfo, attr::MipsLongCall, false, false) |
||
15129 | { |
||
15130 | } |
||
15131 | |||
15132 | MipsLongCallAttr::Spelling MipsLongCallAttr::getSemanticSpelling() const { |
||
15133 | switch (getAttributeSpellingListIndex()) { |
||
15134 | default: llvm_unreachable("Unknown spelling list index"); |
||
15135 | case 0: return GNU_long_call; |
||
15136 | case 1: return CXX11_gnu_long_call; |
||
15137 | case 2: return C2x_gnu_long_call; |
||
15138 | case 3: return GNU_far; |
||
15139 | case 4: return CXX11_gnu_far; |
||
15140 | case 5: return C2x_gnu_far; |
||
15141 | } |
||
15142 | } |
||
15143 | MipsLongCallAttr *MipsLongCallAttr::clone(ASTContext &C) const { |
||
15144 | auto *A = new (C) MipsLongCallAttr(C, *this); |
||
15145 | A->Inherited = Inherited; |
||
15146 | A->IsPackExpansion = IsPackExpansion; |
||
15147 | A->setImplicit(Implicit); |
||
15148 | return A; |
||
15149 | } |
||
15150 | |||
15151 | void MipsLongCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15152 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15153 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15154 | switch (getAttributeSpellingListIndex()) { |
||
15155 | default: |
||
15156 | llvm_unreachable("Unknown attribute spelling!"); |
||
15157 | break; |
||
15158 | case 0 : { |
||
15159 | OS << " __attribute__((long_call"; |
||
15160 | OS << "))"; |
||
15161 | break; |
||
15162 | } |
||
15163 | case 1 : { |
||
15164 | OS << " [[gnu::long_call"; |
||
15165 | OS << "]]"; |
||
15166 | break; |
||
15167 | } |
||
15168 | case 2 : { |
||
15169 | OS << " [[gnu::long_call"; |
||
15170 | OS << "]]"; |
||
15171 | break; |
||
15172 | } |
||
15173 | case 3 : { |
||
15174 | OS << " __attribute__((far"; |
||
15175 | OS << "))"; |
||
15176 | break; |
||
15177 | } |
||
15178 | case 4 : { |
||
15179 | OS << " [[gnu::far"; |
||
15180 | OS << "]]"; |
||
15181 | break; |
||
15182 | } |
||
15183 | case 5 : { |
||
15184 | OS << " [[gnu::far"; |
||
15185 | OS << "]]"; |
||
15186 | break; |
||
15187 | } |
||
15188 | } |
||
15189 | } |
||
15190 | |||
15191 | const char *MipsLongCallAttr::getSpelling() const { |
||
15192 | switch (getAttributeSpellingListIndex()) { |
||
15193 | default: |
||
15194 | llvm_unreachable("Unknown attribute spelling!"); |
||
15195 | return "(No spelling)"; |
||
15196 | case 0: |
||
15197 | return "long_call"; |
||
15198 | case 1: |
||
15199 | return "long_call"; |
||
15200 | case 2: |
||
15201 | return "long_call"; |
||
15202 | case 3: |
||
15203 | return "far"; |
||
15204 | case 4: |
||
15205 | return "far"; |
||
15206 | case 5: |
||
15207 | return "far"; |
||
15208 | } |
||
15209 | } |
||
15210 | |||
15211 | |||
15212 | // MipsShortCallAttr implementation |
||
15213 | |||
15214 | MipsShortCallAttr *MipsShortCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15215 | auto *A = new (Ctx) MipsShortCallAttr(Ctx, CommonInfo); |
||
15216 | A->setImplicit(true); |
||
15217 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15218 | A->setAttributeSpellingListIndex(0); |
||
15219 | return A; |
||
15220 | } |
||
15221 | |||
15222 | MipsShortCallAttr *MipsShortCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15223 | auto *A = new (Ctx) MipsShortCallAttr(Ctx, CommonInfo); |
||
15224 | return A; |
||
15225 | } |
||
15226 | |||
15227 | MipsShortCallAttr *MipsShortCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, MipsShortCallAttr::Spelling S) { |
||
15228 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
15229 | return CreateImplicit(Ctx, I); |
||
15230 | } |
||
15231 | |||
15232 | MipsShortCallAttr *MipsShortCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, MipsShortCallAttr::Spelling S) { |
||
15233 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
15234 | return Create(Ctx, I); |
||
15235 | } |
||
15236 | |||
15237 | MipsShortCallAttr::MipsShortCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15238 | ) |
||
15239 | : InheritableAttr(Ctx, CommonInfo, attr::MipsShortCall, false, false) |
||
15240 | { |
||
15241 | } |
||
15242 | |||
15243 | MipsShortCallAttr::Spelling MipsShortCallAttr::getSemanticSpelling() const { |
||
15244 | switch (getAttributeSpellingListIndex()) { |
||
15245 | default: llvm_unreachable("Unknown spelling list index"); |
||
15246 | case 0: return GNU_short_call; |
||
15247 | case 1: return CXX11_gnu_short_call; |
||
15248 | case 2: return C2x_gnu_short_call; |
||
15249 | case 3: return GNU_near; |
||
15250 | case 4: return CXX11_gnu_near; |
||
15251 | case 5: return C2x_gnu_near; |
||
15252 | } |
||
15253 | } |
||
15254 | MipsShortCallAttr *MipsShortCallAttr::clone(ASTContext &C) const { |
||
15255 | auto *A = new (C) MipsShortCallAttr(C, *this); |
||
15256 | A->Inherited = Inherited; |
||
15257 | A->IsPackExpansion = IsPackExpansion; |
||
15258 | A->setImplicit(Implicit); |
||
15259 | return A; |
||
15260 | } |
||
15261 | |||
15262 | void MipsShortCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15263 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15264 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15265 | switch (getAttributeSpellingListIndex()) { |
||
15266 | default: |
||
15267 | llvm_unreachable("Unknown attribute spelling!"); |
||
15268 | break; |
||
15269 | case 0 : { |
||
15270 | OS << " __attribute__((short_call"; |
||
15271 | OS << "))"; |
||
15272 | break; |
||
15273 | } |
||
15274 | case 1 : { |
||
15275 | OS << " [[gnu::short_call"; |
||
15276 | OS << "]]"; |
||
15277 | break; |
||
15278 | } |
||
15279 | case 2 : { |
||
15280 | OS << " [[gnu::short_call"; |
||
15281 | OS << "]]"; |
||
15282 | break; |
||
15283 | } |
||
15284 | case 3 : { |
||
15285 | OS << " __attribute__((near"; |
||
15286 | OS << "))"; |
||
15287 | break; |
||
15288 | } |
||
15289 | case 4 : { |
||
15290 | OS << " [[gnu::near"; |
||
15291 | OS << "]]"; |
||
15292 | break; |
||
15293 | } |
||
15294 | case 5 : { |
||
15295 | OS << " [[gnu::near"; |
||
15296 | OS << "]]"; |
||
15297 | break; |
||
15298 | } |
||
15299 | } |
||
15300 | } |
||
15301 | |||
15302 | const char *MipsShortCallAttr::getSpelling() const { |
||
15303 | switch (getAttributeSpellingListIndex()) { |
||
15304 | default: |
||
15305 | llvm_unreachable("Unknown attribute spelling!"); |
||
15306 | return "(No spelling)"; |
||
15307 | case 0: |
||
15308 | return "short_call"; |
||
15309 | case 1: |
||
15310 | return "short_call"; |
||
15311 | case 2: |
||
15312 | return "short_call"; |
||
15313 | case 3: |
||
15314 | return "near"; |
||
15315 | case 4: |
||
15316 | return "near"; |
||
15317 | case 5: |
||
15318 | return "near"; |
||
15319 | } |
||
15320 | } |
||
15321 | |||
15322 | |||
15323 | // ModeAttr implementation |
||
15324 | |||
15325 | ModeAttr *ModeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Mode, const AttributeCommonInfo &CommonInfo) { |
||
15326 | auto *A = new (Ctx) ModeAttr(Ctx, CommonInfo, Mode); |
||
15327 | A->setImplicit(true); |
||
15328 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15329 | A->setAttributeSpellingListIndex(0); |
||
15330 | return A; |
||
15331 | } |
||
15332 | |||
15333 | ModeAttr *ModeAttr::Create(ASTContext &Ctx, IdentifierInfo * Mode, const AttributeCommonInfo &CommonInfo) { |
||
15334 | auto *A = new (Ctx) ModeAttr(Ctx, CommonInfo, Mode); |
||
15335 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15336 | A->setAttributeSpellingListIndex(0); |
||
15337 | return A; |
||
15338 | } |
||
15339 | |||
15340 | ModeAttr *ModeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Mode, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15341 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15342 | return CreateImplicit(Ctx, Mode, I); |
||
15343 | } |
||
15344 | |||
15345 | ModeAttr *ModeAttr::Create(ASTContext &Ctx, IdentifierInfo * Mode, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15346 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15347 | return Create(Ctx, Mode, I); |
||
15348 | } |
||
15349 | |||
15350 | ModeAttr::ModeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15351 | , IdentifierInfo * Mode |
||
15352 | ) |
||
15353 | : Attr(Ctx, CommonInfo, attr::Mode, false) |
||
15354 | , mode(Mode) |
||
15355 | { |
||
15356 | } |
||
15357 | |||
15358 | |||
15359 | |||
15360 | ModeAttr *ModeAttr::clone(ASTContext &C) const { |
||
15361 | auto *A = new (C) ModeAttr(C, *this, mode); |
||
15362 | A->Inherited = Inherited; |
||
15363 | A->IsPackExpansion = IsPackExpansion; |
||
15364 | A->setImplicit(Implicit); |
||
15365 | return A; |
||
15366 | } |
||
15367 | |||
15368 | void ModeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15369 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15370 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15371 | switch (getAttributeSpellingListIndex()) { |
||
15372 | default: |
||
15373 | llvm_unreachable("Unknown attribute spelling!"); |
||
15374 | break; |
||
15375 | case 0 : { |
||
15376 | OS << " __attribute__((mode"; |
||
15377 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
15378 | OS << "" << (getMode() ? getMode()->getName() : "") << ""; |
||
15379 | if (!IsFirstArgument) |
||
15380 | OS << ")"; |
||
15381 | OS << "))"; |
||
15382 | break; |
||
15383 | } |
||
15384 | case 1 : { |
||
15385 | OS << " [[gnu::mode"; |
||
15386 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
15387 | OS << "" << (getMode() ? getMode()->getName() : "") << ""; |
||
15388 | if (!IsFirstArgument) |
||
15389 | OS << ")"; |
||
15390 | OS << "]]"; |
||
15391 | break; |
||
15392 | } |
||
15393 | case 2 : { |
||
15394 | OS << " [[gnu::mode"; |
||
15395 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
15396 | OS << "" << (getMode() ? getMode()->getName() : "") << ""; |
||
15397 | if (!IsFirstArgument) |
||
15398 | OS << ")"; |
||
15399 | OS << "]]"; |
||
15400 | break; |
||
15401 | } |
||
15402 | } |
||
15403 | } |
||
15404 | |||
15405 | const char *ModeAttr::getSpelling() const { |
||
15406 | switch (getAttributeSpellingListIndex()) { |
||
15407 | default: |
||
15408 | llvm_unreachable("Unknown attribute spelling!"); |
||
15409 | return "(No spelling)"; |
||
15410 | case 0: |
||
15411 | return "mode"; |
||
15412 | case 1: |
||
15413 | return "mode"; |
||
15414 | case 2: |
||
15415 | return "mode"; |
||
15416 | } |
||
15417 | } |
||
15418 | |||
15419 | |||
15420 | // MustTailAttr implementation |
||
15421 | |||
15422 | MustTailAttr *MustTailAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15423 | auto *A = new (Ctx) MustTailAttr(Ctx, CommonInfo); |
||
15424 | A->setImplicit(true); |
||
15425 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15426 | A->setAttributeSpellingListIndex(0); |
||
15427 | return A; |
||
15428 | } |
||
15429 | |||
15430 | MustTailAttr *MustTailAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15431 | auto *A = new (Ctx) MustTailAttr(Ctx, CommonInfo); |
||
15432 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15433 | A->setAttributeSpellingListIndex(0); |
||
15434 | return A; |
||
15435 | } |
||
15436 | |||
15437 | MustTailAttr *MustTailAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15438 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15439 | return CreateImplicit(Ctx, I); |
||
15440 | } |
||
15441 | |||
15442 | MustTailAttr *MustTailAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15443 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15444 | return Create(Ctx, I); |
||
15445 | } |
||
15446 | |||
15447 | MustTailAttr::MustTailAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15448 | ) |
||
15449 | : StmtAttr(Ctx, CommonInfo, attr::MustTail, false) |
||
15450 | { |
||
15451 | } |
||
15452 | |||
15453 | MustTailAttr *MustTailAttr::clone(ASTContext &C) const { |
||
15454 | auto *A = new (C) MustTailAttr(C, *this); |
||
15455 | A->Inherited = Inherited; |
||
15456 | A->IsPackExpansion = IsPackExpansion; |
||
15457 | A->setImplicit(Implicit); |
||
15458 | return A; |
||
15459 | } |
||
15460 | |||
15461 | void MustTailAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15462 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15463 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15464 | switch (getAttributeSpellingListIndex()) { |
||
15465 | default: |
||
15466 | llvm_unreachable("Unknown attribute spelling!"); |
||
15467 | break; |
||
15468 | case 0 : { |
||
15469 | OS << " __attribute__((musttail"; |
||
15470 | OS << "))"; |
||
15471 | break; |
||
15472 | } |
||
15473 | case 1 : { |
||
15474 | OS << " [[clang::musttail"; |
||
15475 | OS << "]]"; |
||
15476 | break; |
||
15477 | } |
||
15478 | case 2 : { |
||
15479 | OS << " [[clang::musttail"; |
||
15480 | OS << "]]"; |
||
15481 | break; |
||
15482 | } |
||
15483 | } |
||
15484 | } |
||
15485 | |||
15486 | const char *MustTailAttr::getSpelling() const { |
||
15487 | switch (getAttributeSpellingListIndex()) { |
||
15488 | default: |
||
15489 | llvm_unreachable("Unknown attribute spelling!"); |
||
15490 | return "(No spelling)"; |
||
15491 | case 0: |
||
15492 | return "musttail"; |
||
15493 | case 1: |
||
15494 | return "musttail"; |
||
15495 | case 2: |
||
15496 | return "musttail"; |
||
15497 | } |
||
15498 | } |
||
15499 | |||
15500 | |||
15501 | // NSConsumedAttr implementation |
||
15502 | |||
15503 | NSConsumedAttr *NSConsumedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15504 | auto *A = new (Ctx) NSConsumedAttr(Ctx, CommonInfo); |
||
15505 | A->setImplicit(true); |
||
15506 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15507 | A->setAttributeSpellingListIndex(0); |
||
15508 | return A; |
||
15509 | } |
||
15510 | |||
15511 | NSConsumedAttr *NSConsumedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15512 | auto *A = new (Ctx) NSConsumedAttr(Ctx, CommonInfo); |
||
15513 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15514 | A->setAttributeSpellingListIndex(0); |
||
15515 | return A; |
||
15516 | } |
||
15517 | |||
15518 | NSConsumedAttr *NSConsumedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15519 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15520 | return CreateImplicit(Ctx, I); |
||
15521 | } |
||
15522 | |||
15523 | NSConsumedAttr *NSConsumedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15524 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15525 | return Create(Ctx, I); |
||
15526 | } |
||
15527 | |||
15528 | NSConsumedAttr::NSConsumedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15529 | ) |
||
15530 | : InheritableParamAttr(Ctx, CommonInfo, attr::NSConsumed, false, false) |
||
15531 | { |
||
15532 | } |
||
15533 | |||
15534 | NSConsumedAttr *NSConsumedAttr::clone(ASTContext &C) const { |
||
15535 | auto *A = new (C) NSConsumedAttr(C, *this); |
||
15536 | A->Inherited = Inherited; |
||
15537 | A->IsPackExpansion = IsPackExpansion; |
||
15538 | A->setImplicit(Implicit); |
||
15539 | return A; |
||
15540 | } |
||
15541 | |||
15542 | void NSConsumedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15543 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15544 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15545 | switch (getAttributeSpellingListIndex()) { |
||
15546 | default: |
||
15547 | llvm_unreachable("Unknown attribute spelling!"); |
||
15548 | break; |
||
15549 | case 0 : { |
||
15550 | OS << " __attribute__((ns_consumed"; |
||
15551 | OS << "))"; |
||
15552 | break; |
||
15553 | } |
||
15554 | case 1 : { |
||
15555 | OS << " [[clang::ns_consumed"; |
||
15556 | OS << "]]"; |
||
15557 | break; |
||
15558 | } |
||
15559 | case 2 : { |
||
15560 | OS << " [[clang::ns_consumed"; |
||
15561 | OS << "]]"; |
||
15562 | break; |
||
15563 | } |
||
15564 | } |
||
15565 | } |
||
15566 | |||
15567 | const char *NSConsumedAttr::getSpelling() const { |
||
15568 | switch (getAttributeSpellingListIndex()) { |
||
15569 | default: |
||
15570 | llvm_unreachable("Unknown attribute spelling!"); |
||
15571 | return "(No spelling)"; |
||
15572 | case 0: |
||
15573 | return "ns_consumed"; |
||
15574 | case 1: |
||
15575 | return "ns_consumed"; |
||
15576 | case 2: |
||
15577 | return "ns_consumed"; |
||
15578 | } |
||
15579 | } |
||
15580 | |||
15581 | |||
15582 | // NSConsumesSelfAttr implementation |
||
15583 | |||
15584 | NSConsumesSelfAttr *NSConsumesSelfAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15585 | auto *A = new (Ctx) NSConsumesSelfAttr(Ctx, CommonInfo); |
||
15586 | A->setImplicit(true); |
||
15587 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15588 | A->setAttributeSpellingListIndex(0); |
||
15589 | return A; |
||
15590 | } |
||
15591 | |||
15592 | NSConsumesSelfAttr *NSConsumesSelfAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15593 | auto *A = new (Ctx) NSConsumesSelfAttr(Ctx, CommonInfo); |
||
15594 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15595 | A->setAttributeSpellingListIndex(0); |
||
15596 | return A; |
||
15597 | } |
||
15598 | |||
15599 | NSConsumesSelfAttr *NSConsumesSelfAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15600 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15601 | return CreateImplicit(Ctx, I); |
||
15602 | } |
||
15603 | |||
15604 | NSConsumesSelfAttr *NSConsumesSelfAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15605 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15606 | return Create(Ctx, I); |
||
15607 | } |
||
15608 | |||
15609 | NSConsumesSelfAttr::NSConsumesSelfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15610 | ) |
||
15611 | : InheritableAttr(Ctx, CommonInfo, attr::NSConsumesSelf, false, false) |
||
15612 | { |
||
15613 | } |
||
15614 | |||
15615 | NSConsumesSelfAttr *NSConsumesSelfAttr::clone(ASTContext &C) const { |
||
15616 | auto *A = new (C) NSConsumesSelfAttr(C, *this); |
||
15617 | A->Inherited = Inherited; |
||
15618 | A->IsPackExpansion = IsPackExpansion; |
||
15619 | A->setImplicit(Implicit); |
||
15620 | return A; |
||
15621 | } |
||
15622 | |||
15623 | void NSConsumesSelfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15624 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15625 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15626 | switch (getAttributeSpellingListIndex()) { |
||
15627 | default: |
||
15628 | llvm_unreachable("Unknown attribute spelling!"); |
||
15629 | break; |
||
15630 | case 0 : { |
||
15631 | OS << " __attribute__((ns_consumes_self"; |
||
15632 | OS << "))"; |
||
15633 | break; |
||
15634 | } |
||
15635 | case 1 : { |
||
15636 | OS << " [[clang::ns_consumes_self"; |
||
15637 | OS << "]]"; |
||
15638 | break; |
||
15639 | } |
||
15640 | case 2 : { |
||
15641 | OS << " [[clang::ns_consumes_self"; |
||
15642 | OS << "]]"; |
||
15643 | break; |
||
15644 | } |
||
15645 | } |
||
15646 | } |
||
15647 | |||
15648 | const char *NSConsumesSelfAttr::getSpelling() const { |
||
15649 | switch (getAttributeSpellingListIndex()) { |
||
15650 | default: |
||
15651 | llvm_unreachable("Unknown attribute spelling!"); |
||
15652 | return "(No spelling)"; |
||
15653 | case 0: |
||
15654 | return "ns_consumes_self"; |
||
15655 | case 1: |
||
15656 | return "ns_consumes_self"; |
||
15657 | case 2: |
||
15658 | return "ns_consumes_self"; |
||
15659 | } |
||
15660 | } |
||
15661 | |||
15662 | |||
15663 | // NSErrorDomainAttr implementation |
||
15664 | |||
15665 | NSErrorDomainAttr *NSErrorDomainAttr::CreateImplicit(ASTContext &Ctx, VarDecl * ErrorDomain, const AttributeCommonInfo &CommonInfo) { |
||
15666 | auto *A = new (Ctx) NSErrorDomainAttr(Ctx, CommonInfo, ErrorDomain); |
||
15667 | A->setImplicit(true); |
||
15668 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15669 | A->setAttributeSpellingListIndex(0); |
||
15670 | return A; |
||
15671 | } |
||
15672 | |||
15673 | NSErrorDomainAttr *NSErrorDomainAttr::Create(ASTContext &Ctx, VarDecl * ErrorDomain, const AttributeCommonInfo &CommonInfo) { |
||
15674 | auto *A = new (Ctx) NSErrorDomainAttr(Ctx, CommonInfo, ErrorDomain); |
||
15675 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15676 | A->setAttributeSpellingListIndex(0); |
||
15677 | return A; |
||
15678 | } |
||
15679 | |||
15680 | NSErrorDomainAttr *NSErrorDomainAttr::CreateImplicit(ASTContext &Ctx, VarDecl * ErrorDomain, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15681 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15682 | return CreateImplicit(Ctx, ErrorDomain, I); |
||
15683 | } |
||
15684 | |||
15685 | NSErrorDomainAttr *NSErrorDomainAttr::Create(ASTContext &Ctx, VarDecl * ErrorDomain, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15686 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15687 | return Create(Ctx, ErrorDomain, I); |
||
15688 | } |
||
15689 | |||
15690 | NSErrorDomainAttr::NSErrorDomainAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15691 | , VarDecl * ErrorDomain |
||
15692 | ) |
||
15693 | : InheritableAttr(Ctx, CommonInfo, attr::NSErrorDomain, false, false) |
||
15694 | , errorDomain(ErrorDomain) |
||
15695 | { |
||
15696 | } |
||
15697 | |||
15698 | |||
15699 | |||
15700 | NSErrorDomainAttr *NSErrorDomainAttr::clone(ASTContext &C) const { |
||
15701 | auto *A = new (C) NSErrorDomainAttr(C, *this, errorDomain); |
||
15702 | A->Inherited = Inherited; |
||
15703 | A->IsPackExpansion = IsPackExpansion; |
||
15704 | A->setImplicit(Implicit); |
||
15705 | return A; |
||
15706 | } |
||
15707 | |||
15708 | void NSErrorDomainAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15709 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15710 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15711 | switch (getAttributeSpellingListIndex()) { |
||
15712 | default: |
||
15713 | llvm_unreachable("Unknown attribute spelling!"); |
||
15714 | break; |
||
15715 | case 0 : { |
||
15716 | OS << " __attribute__((ns_error_domain"; |
||
15717 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
15718 | OS << "" << getErrorDomain()->getName() << ""; |
||
15719 | if (!IsFirstArgument) |
||
15720 | OS << ")"; |
||
15721 | OS << "))"; |
||
15722 | break; |
||
15723 | } |
||
15724 | } |
||
15725 | } |
||
15726 | |||
15727 | const char *NSErrorDomainAttr::getSpelling() const { |
||
15728 | switch (getAttributeSpellingListIndex()) { |
||
15729 | default: |
||
15730 | llvm_unreachable("Unknown attribute spelling!"); |
||
15731 | return "(No spelling)"; |
||
15732 | case 0: |
||
15733 | return "ns_error_domain"; |
||
15734 | } |
||
15735 | } |
||
15736 | |||
15737 | |||
15738 | // NSReturnsAutoreleasedAttr implementation |
||
15739 | |||
15740 | NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15741 | auto *A = new (Ctx) NSReturnsAutoreleasedAttr(Ctx, CommonInfo); |
||
15742 | A->setImplicit(true); |
||
15743 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15744 | A->setAttributeSpellingListIndex(0); |
||
15745 | return A; |
||
15746 | } |
||
15747 | |||
15748 | NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15749 | auto *A = new (Ctx) NSReturnsAutoreleasedAttr(Ctx, CommonInfo); |
||
15750 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15751 | A->setAttributeSpellingListIndex(0); |
||
15752 | return A; |
||
15753 | } |
||
15754 | |||
15755 | NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15756 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15757 | return CreateImplicit(Ctx, I); |
||
15758 | } |
||
15759 | |||
15760 | NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15761 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15762 | return Create(Ctx, I); |
||
15763 | } |
||
15764 | |||
15765 | NSReturnsAutoreleasedAttr::NSReturnsAutoreleasedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15766 | ) |
||
15767 | : InheritableAttr(Ctx, CommonInfo, attr::NSReturnsAutoreleased, false, false) |
||
15768 | { |
||
15769 | } |
||
15770 | |||
15771 | NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::clone(ASTContext &C) const { |
||
15772 | auto *A = new (C) NSReturnsAutoreleasedAttr(C, *this); |
||
15773 | A->Inherited = Inherited; |
||
15774 | A->IsPackExpansion = IsPackExpansion; |
||
15775 | A->setImplicit(Implicit); |
||
15776 | return A; |
||
15777 | } |
||
15778 | |||
15779 | void NSReturnsAutoreleasedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15780 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15781 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15782 | switch (getAttributeSpellingListIndex()) { |
||
15783 | default: |
||
15784 | llvm_unreachable("Unknown attribute spelling!"); |
||
15785 | break; |
||
15786 | case 0 : { |
||
15787 | OS << " __attribute__((ns_returns_autoreleased"; |
||
15788 | OS << "))"; |
||
15789 | break; |
||
15790 | } |
||
15791 | case 1 : { |
||
15792 | OS << " [[clang::ns_returns_autoreleased"; |
||
15793 | OS << "]]"; |
||
15794 | break; |
||
15795 | } |
||
15796 | case 2 : { |
||
15797 | OS << " [[clang::ns_returns_autoreleased"; |
||
15798 | OS << "]]"; |
||
15799 | break; |
||
15800 | } |
||
15801 | } |
||
15802 | } |
||
15803 | |||
15804 | const char *NSReturnsAutoreleasedAttr::getSpelling() const { |
||
15805 | switch (getAttributeSpellingListIndex()) { |
||
15806 | default: |
||
15807 | llvm_unreachable("Unknown attribute spelling!"); |
||
15808 | return "(No spelling)"; |
||
15809 | case 0: |
||
15810 | return "ns_returns_autoreleased"; |
||
15811 | case 1: |
||
15812 | return "ns_returns_autoreleased"; |
||
15813 | case 2: |
||
15814 | return "ns_returns_autoreleased"; |
||
15815 | } |
||
15816 | } |
||
15817 | |||
15818 | |||
15819 | // NSReturnsNotRetainedAttr implementation |
||
15820 | |||
15821 | NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15822 | auto *A = new (Ctx) NSReturnsNotRetainedAttr(Ctx, CommonInfo); |
||
15823 | A->setImplicit(true); |
||
15824 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15825 | A->setAttributeSpellingListIndex(0); |
||
15826 | return A; |
||
15827 | } |
||
15828 | |||
15829 | NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15830 | auto *A = new (Ctx) NSReturnsNotRetainedAttr(Ctx, CommonInfo); |
||
15831 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15832 | A->setAttributeSpellingListIndex(0); |
||
15833 | return A; |
||
15834 | } |
||
15835 | |||
15836 | NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15837 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15838 | return CreateImplicit(Ctx, I); |
||
15839 | } |
||
15840 | |||
15841 | NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15842 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15843 | return Create(Ctx, I); |
||
15844 | } |
||
15845 | |||
15846 | NSReturnsNotRetainedAttr::NSReturnsNotRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15847 | ) |
||
15848 | : InheritableAttr(Ctx, CommonInfo, attr::NSReturnsNotRetained, false, false) |
||
15849 | { |
||
15850 | } |
||
15851 | |||
15852 | NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::clone(ASTContext &C) const { |
||
15853 | auto *A = new (C) NSReturnsNotRetainedAttr(C, *this); |
||
15854 | A->Inherited = Inherited; |
||
15855 | A->IsPackExpansion = IsPackExpansion; |
||
15856 | A->setImplicit(Implicit); |
||
15857 | return A; |
||
15858 | } |
||
15859 | |||
15860 | void NSReturnsNotRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15861 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15862 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15863 | switch (getAttributeSpellingListIndex()) { |
||
15864 | default: |
||
15865 | llvm_unreachable("Unknown attribute spelling!"); |
||
15866 | break; |
||
15867 | case 0 : { |
||
15868 | OS << " __attribute__((ns_returns_not_retained"; |
||
15869 | OS << "))"; |
||
15870 | break; |
||
15871 | } |
||
15872 | case 1 : { |
||
15873 | OS << " [[clang::ns_returns_not_retained"; |
||
15874 | OS << "]]"; |
||
15875 | break; |
||
15876 | } |
||
15877 | case 2 : { |
||
15878 | OS << " [[clang::ns_returns_not_retained"; |
||
15879 | OS << "]]"; |
||
15880 | break; |
||
15881 | } |
||
15882 | } |
||
15883 | } |
||
15884 | |||
15885 | const char *NSReturnsNotRetainedAttr::getSpelling() const { |
||
15886 | switch (getAttributeSpellingListIndex()) { |
||
15887 | default: |
||
15888 | llvm_unreachable("Unknown attribute spelling!"); |
||
15889 | return "(No spelling)"; |
||
15890 | case 0: |
||
15891 | return "ns_returns_not_retained"; |
||
15892 | case 1: |
||
15893 | return "ns_returns_not_retained"; |
||
15894 | case 2: |
||
15895 | return "ns_returns_not_retained"; |
||
15896 | } |
||
15897 | } |
||
15898 | |||
15899 | |||
15900 | // NSReturnsRetainedAttr implementation |
||
15901 | |||
15902 | NSReturnsRetainedAttr *NSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15903 | auto *A = new (Ctx) NSReturnsRetainedAttr(Ctx, CommonInfo); |
||
15904 | A->setImplicit(true); |
||
15905 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15906 | A->setAttributeSpellingListIndex(0); |
||
15907 | return A; |
||
15908 | } |
||
15909 | |||
15910 | NSReturnsRetainedAttr *NSReturnsRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15911 | auto *A = new (Ctx) NSReturnsRetainedAttr(Ctx, CommonInfo); |
||
15912 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15913 | A->setAttributeSpellingListIndex(0); |
||
15914 | return A; |
||
15915 | } |
||
15916 | |||
15917 | NSReturnsRetainedAttr *NSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15918 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15919 | return CreateImplicit(Ctx, I); |
||
15920 | } |
||
15921 | |||
15922 | NSReturnsRetainedAttr *NSReturnsRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15923 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
15924 | return Create(Ctx, I); |
||
15925 | } |
||
15926 | |||
15927 | NSReturnsRetainedAttr::NSReturnsRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
15928 | ) |
||
15929 | : InheritableAttr(Ctx, CommonInfo, attr::NSReturnsRetained, false, false) |
||
15930 | { |
||
15931 | } |
||
15932 | |||
15933 | NSReturnsRetainedAttr *NSReturnsRetainedAttr::clone(ASTContext &C) const { |
||
15934 | auto *A = new (C) NSReturnsRetainedAttr(C, *this); |
||
15935 | A->Inherited = Inherited; |
||
15936 | A->IsPackExpansion = IsPackExpansion; |
||
15937 | A->setImplicit(Implicit); |
||
15938 | return A; |
||
15939 | } |
||
15940 | |||
15941 | void NSReturnsRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
15942 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
15943 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
15944 | switch (getAttributeSpellingListIndex()) { |
||
15945 | default: |
||
15946 | llvm_unreachable("Unknown attribute spelling!"); |
||
15947 | break; |
||
15948 | case 0 : { |
||
15949 | OS << " __attribute__((ns_returns_retained"; |
||
15950 | OS << "))"; |
||
15951 | break; |
||
15952 | } |
||
15953 | case 1 : { |
||
15954 | OS << " [[clang::ns_returns_retained"; |
||
15955 | OS << "]]"; |
||
15956 | break; |
||
15957 | } |
||
15958 | case 2 : { |
||
15959 | OS << " [[clang::ns_returns_retained"; |
||
15960 | OS << "]]"; |
||
15961 | break; |
||
15962 | } |
||
15963 | } |
||
15964 | } |
||
15965 | |||
15966 | const char *NSReturnsRetainedAttr::getSpelling() const { |
||
15967 | switch (getAttributeSpellingListIndex()) { |
||
15968 | default: |
||
15969 | llvm_unreachable("Unknown attribute spelling!"); |
||
15970 | return "(No spelling)"; |
||
15971 | case 0: |
||
15972 | return "ns_returns_retained"; |
||
15973 | case 1: |
||
15974 | return "ns_returns_retained"; |
||
15975 | case 2: |
||
15976 | return "ns_returns_retained"; |
||
15977 | } |
||
15978 | } |
||
15979 | |||
15980 | |||
15981 | // NakedAttr implementation |
||
15982 | |||
15983 | NakedAttr *NakedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15984 | auto *A = new (Ctx) NakedAttr(Ctx, CommonInfo); |
||
15985 | A->setImplicit(true); |
||
15986 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15987 | A->setAttributeSpellingListIndex(0); |
||
15988 | return A; |
||
15989 | } |
||
15990 | |||
15991 | NakedAttr *NakedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
15992 | auto *A = new (Ctx) NakedAttr(Ctx, CommonInfo); |
||
15993 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
15994 | A->setAttributeSpellingListIndex(0); |
||
15995 | return A; |
||
15996 | } |
||
15997 | |||
15998 | NakedAttr *NakedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
15999 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16000 | return CreateImplicit(Ctx, I); |
||
16001 | } |
||
16002 | |||
16003 | NakedAttr *NakedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16004 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16005 | return Create(Ctx, I); |
||
16006 | } |
||
16007 | |||
16008 | NakedAttr::NakedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16009 | ) |
||
16010 | : InheritableAttr(Ctx, CommonInfo, attr::Naked, false, false) |
||
16011 | { |
||
16012 | } |
||
16013 | |||
16014 | NakedAttr *NakedAttr::clone(ASTContext &C) const { |
||
16015 | auto *A = new (C) NakedAttr(C, *this); |
||
16016 | A->Inherited = Inherited; |
||
16017 | A->IsPackExpansion = IsPackExpansion; |
||
16018 | A->setImplicit(Implicit); |
||
16019 | return A; |
||
16020 | } |
||
16021 | |||
16022 | void NakedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16023 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16024 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16025 | switch (getAttributeSpellingListIndex()) { |
||
16026 | default: |
||
16027 | llvm_unreachable("Unknown attribute spelling!"); |
||
16028 | break; |
||
16029 | case 0 : { |
||
16030 | OS << " __attribute__((naked"; |
||
16031 | OS << "))"; |
||
16032 | break; |
||
16033 | } |
||
16034 | case 1 : { |
||
16035 | OS << " [[gnu::naked"; |
||
16036 | OS << "]]"; |
||
16037 | break; |
||
16038 | } |
||
16039 | case 2 : { |
||
16040 | OS << " [[gnu::naked"; |
||
16041 | OS << "]]"; |
||
16042 | break; |
||
16043 | } |
||
16044 | case 3 : { |
||
16045 | OS << " __declspec(naked"; |
||
16046 | OS << ")"; |
||
16047 | break; |
||
16048 | } |
||
16049 | } |
||
16050 | } |
||
16051 | |||
16052 | const char *NakedAttr::getSpelling() const { |
||
16053 | switch (getAttributeSpellingListIndex()) { |
||
16054 | default: |
||
16055 | llvm_unreachable("Unknown attribute spelling!"); |
||
16056 | return "(No spelling)"; |
||
16057 | case 0: |
||
16058 | return "naked"; |
||
16059 | case 1: |
||
16060 | return "naked"; |
||
16061 | case 2: |
||
16062 | return "naked"; |
||
16063 | case 3: |
||
16064 | return "naked"; |
||
16065 | } |
||
16066 | } |
||
16067 | |||
16068 | |||
16069 | // NoAliasAttr implementation |
||
16070 | |||
16071 | NoAliasAttr *NoAliasAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16072 | auto *A = new (Ctx) NoAliasAttr(Ctx, CommonInfo); |
||
16073 | A->setImplicit(true); |
||
16074 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16075 | A->setAttributeSpellingListIndex(0); |
||
16076 | return A; |
||
16077 | } |
||
16078 | |||
16079 | NoAliasAttr *NoAliasAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16080 | auto *A = new (Ctx) NoAliasAttr(Ctx, CommonInfo); |
||
16081 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16082 | A->setAttributeSpellingListIndex(0); |
||
16083 | return A; |
||
16084 | } |
||
16085 | |||
16086 | NoAliasAttr *NoAliasAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16087 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16088 | return CreateImplicit(Ctx, I); |
||
16089 | } |
||
16090 | |||
16091 | NoAliasAttr *NoAliasAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16092 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16093 | return Create(Ctx, I); |
||
16094 | } |
||
16095 | |||
16096 | NoAliasAttr::NoAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16097 | ) |
||
16098 | : InheritableAttr(Ctx, CommonInfo, attr::NoAlias, false, false) |
||
16099 | { |
||
16100 | } |
||
16101 | |||
16102 | NoAliasAttr *NoAliasAttr::clone(ASTContext &C) const { |
||
16103 | auto *A = new (C) NoAliasAttr(C, *this); |
||
16104 | A->Inherited = Inherited; |
||
16105 | A->IsPackExpansion = IsPackExpansion; |
||
16106 | A->setImplicit(Implicit); |
||
16107 | return A; |
||
16108 | } |
||
16109 | |||
16110 | void NoAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16111 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16112 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16113 | switch (getAttributeSpellingListIndex()) { |
||
16114 | default: |
||
16115 | llvm_unreachable("Unknown attribute spelling!"); |
||
16116 | break; |
||
16117 | case 0 : { |
||
16118 | OS << " __declspec(noalias"; |
||
16119 | OS << ")"; |
||
16120 | break; |
||
16121 | } |
||
16122 | } |
||
16123 | } |
||
16124 | |||
16125 | const char *NoAliasAttr::getSpelling() const { |
||
16126 | switch (getAttributeSpellingListIndex()) { |
||
16127 | default: |
||
16128 | llvm_unreachable("Unknown attribute spelling!"); |
||
16129 | return "(No spelling)"; |
||
16130 | case 0: |
||
16131 | return "noalias"; |
||
16132 | } |
||
16133 | } |
||
16134 | |||
16135 | |||
16136 | // NoBuiltinAttr implementation |
||
16137 | |||
16138 | NoBuiltinAttr *NoBuiltinAttr::CreateImplicit(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, const AttributeCommonInfo &CommonInfo) { |
||
16139 | auto *A = new (Ctx) NoBuiltinAttr(Ctx, CommonInfo, BuiltinNames, BuiltinNamesSize); |
||
16140 | A->setImplicit(true); |
||
16141 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16142 | A->setAttributeSpellingListIndex(0); |
||
16143 | return A; |
||
16144 | } |
||
16145 | |||
16146 | NoBuiltinAttr *NoBuiltinAttr::Create(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, const AttributeCommonInfo &CommonInfo) { |
||
16147 | auto *A = new (Ctx) NoBuiltinAttr(Ctx, CommonInfo, BuiltinNames, BuiltinNamesSize); |
||
16148 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16149 | A->setAttributeSpellingListIndex(0); |
||
16150 | return A; |
||
16151 | } |
||
16152 | |||
16153 | NoBuiltinAttr *NoBuiltinAttr::CreateImplicit(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16154 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16155 | return CreateImplicit(Ctx, BuiltinNames, BuiltinNamesSize, I); |
||
16156 | } |
||
16157 | |||
16158 | NoBuiltinAttr *NoBuiltinAttr::Create(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16159 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16160 | return Create(Ctx, BuiltinNames, BuiltinNamesSize, I); |
||
16161 | } |
||
16162 | |||
16163 | NoBuiltinAttr::NoBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16164 | , StringRef *BuiltinNames, unsigned BuiltinNamesSize |
||
16165 | ) |
||
16166 | : Attr(Ctx, CommonInfo, attr::NoBuiltin, false) |
||
16167 | , builtinNames_Size(BuiltinNamesSize), builtinNames_(new (Ctx, 16) StringRef[builtinNames_Size]) |
||
16168 | { |
||
16169 | for (size_t I = 0, E = builtinNames_Size; I != E; |
||
16170 | ++I) { |
||
16171 | StringRef Ref = BuiltinNames[I]; |
||
16172 | if (!Ref.empty()) { |
||
16173 | char *Mem = new (Ctx, 1) char[Ref.size()]; |
||
16174 | std::memcpy(Mem, Ref.data(), Ref.size()); |
||
16175 | builtinNames_[I] = StringRef(Mem, Ref.size()); |
||
16176 | } |
||
16177 | } |
||
16178 | } |
||
16179 | |||
16180 | NoBuiltinAttr::NoBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16181 | ) |
||
16182 | : Attr(Ctx, CommonInfo, attr::NoBuiltin, false) |
||
16183 | , builtinNames_Size(0), builtinNames_(nullptr) |
||
16184 | { |
||
16185 | } |
||
16186 | |||
16187 | |||
16188 | |||
16189 | NoBuiltinAttr *NoBuiltinAttr::clone(ASTContext &C) const { |
||
16190 | auto *A = new (C) NoBuiltinAttr(C, *this, builtinNames_, builtinNames_Size); |
||
16191 | A->Inherited = Inherited; |
||
16192 | A->IsPackExpansion = IsPackExpansion; |
||
16193 | A->setImplicit(Implicit); |
||
16194 | return A; |
||
16195 | } |
||
16196 | |||
16197 | void NoBuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16198 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16199 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16200 | switch (getAttributeSpellingListIndex()) { |
||
16201 | default: |
||
16202 | llvm_unreachable("Unknown attribute spelling!"); |
||
16203 | break; |
||
16204 | case 0 : { |
||
16205 | OS << " __attribute__((no_builtin"; |
||
16206 | OS << ""; |
||
16207 | for (const auto &Val : builtinNames()) { |
||
16208 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
16209 | OS << "\"" << Val << "\""; |
||
16210 | } |
||
16211 | OS << ""; |
||
16212 | if (!IsFirstArgument) |
||
16213 | OS << ")"; |
||
16214 | OS << "))"; |
||
16215 | break; |
||
16216 | } |
||
16217 | case 1 : { |
||
16218 | OS << " [[clang::no_builtin"; |
||
16219 | OS << ""; |
||
16220 | for (const auto &Val : builtinNames()) { |
||
16221 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
16222 | OS << "\"" << Val << "\""; |
||
16223 | } |
||
16224 | OS << ""; |
||
16225 | if (!IsFirstArgument) |
||
16226 | OS << ")"; |
||
16227 | OS << "]]"; |
||
16228 | break; |
||
16229 | } |
||
16230 | case 2 : { |
||
16231 | OS << " [[clang::no_builtin"; |
||
16232 | OS << ""; |
||
16233 | for (const auto &Val : builtinNames()) { |
||
16234 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
16235 | OS << "\"" << Val << "\""; |
||
16236 | } |
||
16237 | OS << ""; |
||
16238 | if (!IsFirstArgument) |
||
16239 | OS << ")"; |
||
16240 | OS << "]]"; |
||
16241 | break; |
||
16242 | } |
||
16243 | } |
||
16244 | } |
||
16245 | |||
16246 | const char *NoBuiltinAttr::getSpelling() const { |
||
16247 | switch (getAttributeSpellingListIndex()) { |
||
16248 | default: |
||
16249 | llvm_unreachable("Unknown attribute spelling!"); |
||
16250 | return "(No spelling)"; |
||
16251 | case 0: |
||
16252 | return "no_builtin"; |
||
16253 | case 1: |
||
16254 | return "no_builtin"; |
||
16255 | case 2: |
||
16256 | return "no_builtin"; |
||
16257 | } |
||
16258 | } |
||
16259 | |||
16260 | |||
16261 | // NoCommonAttr implementation |
||
16262 | |||
16263 | NoCommonAttr *NoCommonAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16264 | auto *A = new (Ctx) NoCommonAttr(Ctx, CommonInfo); |
||
16265 | A->setImplicit(true); |
||
16266 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16267 | A->setAttributeSpellingListIndex(0); |
||
16268 | return A; |
||
16269 | } |
||
16270 | |||
16271 | NoCommonAttr *NoCommonAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16272 | auto *A = new (Ctx) NoCommonAttr(Ctx, CommonInfo); |
||
16273 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16274 | A->setAttributeSpellingListIndex(0); |
||
16275 | return A; |
||
16276 | } |
||
16277 | |||
16278 | NoCommonAttr *NoCommonAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16279 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16280 | return CreateImplicit(Ctx, I); |
||
16281 | } |
||
16282 | |||
16283 | NoCommonAttr *NoCommonAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16284 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16285 | return Create(Ctx, I); |
||
16286 | } |
||
16287 | |||
16288 | NoCommonAttr::NoCommonAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16289 | ) |
||
16290 | : InheritableAttr(Ctx, CommonInfo, attr::NoCommon, false, false) |
||
16291 | { |
||
16292 | } |
||
16293 | |||
16294 | NoCommonAttr *NoCommonAttr::clone(ASTContext &C) const { |
||
16295 | auto *A = new (C) NoCommonAttr(C, *this); |
||
16296 | A->Inherited = Inherited; |
||
16297 | A->IsPackExpansion = IsPackExpansion; |
||
16298 | A->setImplicit(Implicit); |
||
16299 | return A; |
||
16300 | } |
||
16301 | |||
16302 | void NoCommonAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16303 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16304 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16305 | switch (getAttributeSpellingListIndex()) { |
||
16306 | default: |
||
16307 | llvm_unreachable("Unknown attribute spelling!"); |
||
16308 | break; |
||
16309 | case 0 : { |
||
16310 | OS << " __attribute__((nocommon"; |
||
16311 | OS << "))"; |
||
16312 | break; |
||
16313 | } |
||
16314 | case 1 : { |
||
16315 | OS << " [[gnu::nocommon"; |
||
16316 | OS << "]]"; |
||
16317 | break; |
||
16318 | } |
||
16319 | case 2 : { |
||
16320 | OS << " [[gnu::nocommon"; |
||
16321 | OS << "]]"; |
||
16322 | break; |
||
16323 | } |
||
16324 | } |
||
16325 | } |
||
16326 | |||
16327 | const char *NoCommonAttr::getSpelling() const { |
||
16328 | switch (getAttributeSpellingListIndex()) { |
||
16329 | default: |
||
16330 | llvm_unreachable("Unknown attribute spelling!"); |
||
16331 | return "(No spelling)"; |
||
16332 | case 0: |
||
16333 | return "nocommon"; |
||
16334 | case 1: |
||
16335 | return "nocommon"; |
||
16336 | case 2: |
||
16337 | return "nocommon"; |
||
16338 | } |
||
16339 | } |
||
16340 | |||
16341 | |||
16342 | // NoDebugAttr implementation |
||
16343 | |||
16344 | NoDebugAttr *NoDebugAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16345 | auto *A = new (Ctx) NoDebugAttr(Ctx, CommonInfo); |
||
16346 | A->setImplicit(true); |
||
16347 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16348 | A->setAttributeSpellingListIndex(0); |
||
16349 | return A; |
||
16350 | } |
||
16351 | |||
16352 | NoDebugAttr *NoDebugAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16353 | auto *A = new (Ctx) NoDebugAttr(Ctx, CommonInfo); |
||
16354 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16355 | A->setAttributeSpellingListIndex(0); |
||
16356 | return A; |
||
16357 | } |
||
16358 | |||
16359 | NoDebugAttr *NoDebugAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16360 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16361 | return CreateImplicit(Ctx, I); |
||
16362 | } |
||
16363 | |||
16364 | NoDebugAttr *NoDebugAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16365 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16366 | return Create(Ctx, I); |
||
16367 | } |
||
16368 | |||
16369 | NoDebugAttr::NoDebugAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16370 | ) |
||
16371 | : InheritableAttr(Ctx, CommonInfo, attr::NoDebug, false, false) |
||
16372 | { |
||
16373 | } |
||
16374 | |||
16375 | NoDebugAttr *NoDebugAttr::clone(ASTContext &C) const { |
||
16376 | auto *A = new (C) NoDebugAttr(C, *this); |
||
16377 | A->Inherited = Inherited; |
||
16378 | A->IsPackExpansion = IsPackExpansion; |
||
16379 | A->setImplicit(Implicit); |
||
16380 | return A; |
||
16381 | } |
||
16382 | |||
16383 | void NoDebugAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16384 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16385 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16386 | switch (getAttributeSpellingListIndex()) { |
||
16387 | default: |
||
16388 | llvm_unreachable("Unknown attribute spelling!"); |
||
16389 | break; |
||
16390 | case 0 : { |
||
16391 | OS << " __attribute__((nodebug"; |
||
16392 | OS << "))"; |
||
16393 | break; |
||
16394 | } |
||
16395 | case 1 : { |
||
16396 | OS << " [[gnu::nodebug"; |
||
16397 | OS << "]]"; |
||
16398 | break; |
||
16399 | } |
||
16400 | case 2 : { |
||
16401 | OS << " [[gnu::nodebug"; |
||
16402 | OS << "]]"; |
||
16403 | break; |
||
16404 | } |
||
16405 | } |
||
16406 | } |
||
16407 | |||
16408 | const char *NoDebugAttr::getSpelling() const { |
||
16409 | switch (getAttributeSpellingListIndex()) { |
||
16410 | default: |
||
16411 | llvm_unreachable("Unknown attribute spelling!"); |
||
16412 | return "(No spelling)"; |
||
16413 | case 0: |
||
16414 | return "nodebug"; |
||
16415 | case 1: |
||
16416 | return "nodebug"; |
||
16417 | case 2: |
||
16418 | return "nodebug"; |
||
16419 | } |
||
16420 | } |
||
16421 | |||
16422 | |||
16423 | // NoDerefAttr implementation |
||
16424 | |||
16425 | NoDerefAttr *NoDerefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16426 | auto *A = new (Ctx) NoDerefAttr(Ctx, CommonInfo); |
||
16427 | A->setImplicit(true); |
||
16428 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16429 | A->setAttributeSpellingListIndex(0); |
||
16430 | return A; |
||
16431 | } |
||
16432 | |||
16433 | NoDerefAttr *NoDerefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16434 | auto *A = new (Ctx) NoDerefAttr(Ctx, CommonInfo); |
||
16435 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16436 | A->setAttributeSpellingListIndex(0); |
||
16437 | return A; |
||
16438 | } |
||
16439 | |||
16440 | NoDerefAttr *NoDerefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16441 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16442 | return CreateImplicit(Ctx, I); |
||
16443 | } |
||
16444 | |||
16445 | NoDerefAttr *NoDerefAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16446 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16447 | return Create(Ctx, I); |
||
16448 | } |
||
16449 | |||
16450 | NoDerefAttr::NoDerefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16451 | ) |
||
16452 | : TypeAttr(Ctx, CommonInfo, attr::NoDeref, false) |
||
16453 | { |
||
16454 | } |
||
16455 | |||
16456 | NoDerefAttr *NoDerefAttr::clone(ASTContext &C) const { |
||
16457 | auto *A = new (C) NoDerefAttr(C, *this); |
||
16458 | A->Inherited = Inherited; |
||
16459 | A->IsPackExpansion = IsPackExpansion; |
||
16460 | A->setImplicit(Implicit); |
||
16461 | return A; |
||
16462 | } |
||
16463 | |||
16464 | void NoDerefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16465 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16466 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16467 | switch (getAttributeSpellingListIndex()) { |
||
16468 | default: |
||
16469 | llvm_unreachable("Unknown attribute spelling!"); |
||
16470 | break; |
||
16471 | case 0 : { |
||
16472 | OS << " __attribute__((noderef"; |
||
16473 | OS << "))"; |
||
16474 | break; |
||
16475 | } |
||
16476 | case 1 : { |
||
16477 | OS << " [[clang::noderef"; |
||
16478 | OS << "]]"; |
||
16479 | break; |
||
16480 | } |
||
16481 | case 2 : { |
||
16482 | OS << " [[clang::noderef"; |
||
16483 | OS << "]]"; |
||
16484 | break; |
||
16485 | } |
||
16486 | } |
||
16487 | } |
||
16488 | |||
16489 | const char *NoDerefAttr::getSpelling() const { |
||
16490 | switch (getAttributeSpellingListIndex()) { |
||
16491 | default: |
||
16492 | llvm_unreachable("Unknown attribute spelling!"); |
||
16493 | return "(No spelling)"; |
||
16494 | case 0: |
||
16495 | return "noderef"; |
||
16496 | case 1: |
||
16497 | return "noderef"; |
||
16498 | case 2: |
||
16499 | return "noderef"; |
||
16500 | } |
||
16501 | } |
||
16502 | |||
16503 | |||
16504 | // NoDestroyAttr implementation |
||
16505 | |||
16506 | NoDestroyAttr *NoDestroyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16507 | auto *A = new (Ctx) NoDestroyAttr(Ctx, CommonInfo); |
||
16508 | A->setImplicit(true); |
||
16509 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16510 | A->setAttributeSpellingListIndex(0); |
||
16511 | return A; |
||
16512 | } |
||
16513 | |||
16514 | NoDestroyAttr *NoDestroyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16515 | auto *A = new (Ctx) NoDestroyAttr(Ctx, CommonInfo); |
||
16516 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16517 | A->setAttributeSpellingListIndex(0); |
||
16518 | return A; |
||
16519 | } |
||
16520 | |||
16521 | NoDestroyAttr *NoDestroyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16522 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16523 | return CreateImplicit(Ctx, I); |
||
16524 | } |
||
16525 | |||
16526 | NoDestroyAttr *NoDestroyAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16527 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16528 | return Create(Ctx, I); |
||
16529 | } |
||
16530 | |||
16531 | NoDestroyAttr::NoDestroyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16532 | ) |
||
16533 | : InheritableAttr(Ctx, CommonInfo, attr::NoDestroy, false, false) |
||
16534 | { |
||
16535 | } |
||
16536 | |||
16537 | NoDestroyAttr *NoDestroyAttr::clone(ASTContext &C) const { |
||
16538 | auto *A = new (C) NoDestroyAttr(C, *this); |
||
16539 | A->Inherited = Inherited; |
||
16540 | A->IsPackExpansion = IsPackExpansion; |
||
16541 | A->setImplicit(Implicit); |
||
16542 | return A; |
||
16543 | } |
||
16544 | |||
16545 | void NoDestroyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16546 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16547 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16548 | switch (getAttributeSpellingListIndex()) { |
||
16549 | default: |
||
16550 | llvm_unreachable("Unknown attribute spelling!"); |
||
16551 | break; |
||
16552 | case 0 : { |
||
16553 | OS << " __attribute__((no_destroy"; |
||
16554 | OS << "))"; |
||
16555 | break; |
||
16556 | } |
||
16557 | case 1 : { |
||
16558 | OS << " [[clang::no_destroy"; |
||
16559 | OS << "]]"; |
||
16560 | break; |
||
16561 | } |
||
16562 | } |
||
16563 | } |
||
16564 | |||
16565 | const char *NoDestroyAttr::getSpelling() const { |
||
16566 | switch (getAttributeSpellingListIndex()) { |
||
16567 | default: |
||
16568 | llvm_unreachable("Unknown attribute spelling!"); |
||
16569 | return "(No spelling)"; |
||
16570 | case 0: |
||
16571 | return "no_destroy"; |
||
16572 | case 1: |
||
16573 | return "no_destroy"; |
||
16574 | } |
||
16575 | } |
||
16576 | |||
16577 | |||
16578 | // NoDuplicateAttr implementation |
||
16579 | |||
16580 | NoDuplicateAttr *NoDuplicateAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16581 | auto *A = new (Ctx) NoDuplicateAttr(Ctx, CommonInfo); |
||
16582 | A->setImplicit(true); |
||
16583 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16584 | A->setAttributeSpellingListIndex(0); |
||
16585 | return A; |
||
16586 | } |
||
16587 | |||
16588 | NoDuplicateAttr *NoDuplicateAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16589 | auto *A = new (Ctx) NoDuplicateAttr(Ctx, CommonInfo); |
||
16590 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16591 | A->setAttributeSpellingListIndex(0); |
||
16592 | return A; |
||
16593 | } |
||
16594 | |||
16595 | NoDuplicateAttr *NoDuplicateAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16596 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16597 | return CreateImplicit(Ctx, I); |
||
16598 | } |
||
16599 | |||
16600 | NoDuplicateAttr *NoDuplicateAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16601 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16602 | return Create(Ctx, I); |
||
16603 | } |
||
16604 | |||
16605 | NoDuplicateAttr::NoDuplicateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16606 | ) |
||
16607 | : InheritableAttr(Ctx, CommonInfo, attr::NoDuplicate, false, false) |
||
16608 | { |
||
16609 | } |
||
16610 | |||
16611 | NoDuplicateAttr *NoDuplicateAttr::clone(ASTContext &C) const { |
||
16612 | auto *A = new (C) NoDuplicateAttr(C, *this); |
||
16613 | A->Inherited = Inherited; |
||
16614 | A->IsPackExpansion = IsPackExpansion; |
||
16615 | A->setImplicit(Implicit); |
||
16616 | return A; |
||
16617 | } |
||
16618 | |||
16619 | void NoDuplicateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16620 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16621 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16622 | switch (getAttributeSpellingListIndex()) { |
||
16623 | default: |
||
16624 | llvm_unreachable("Unknown attribute spelling!"); |
||
16625 | break; |
||
16626 | case 0 : { |
||
16627 | OS << " __attribute__((noduplicate"; |
||
16628 | OS << "))"; |
||
16629 | break; |
||
16630 | } |
||
16631 | case 1 : { |
||
16632 | OS << " [[clang::noduplicate"; |
||
16633 | OS << "]]"; |
||
16634 | break; |
||
16635 | } |
||
16636 | case 2 : { |
||
16637 | OS << " [[clang::noduplicate"; |
||
16638 | OS << "]]"; |
||
16639 | break; |
||
16640 | } |
||
16641 | } |
||
16642 | } |
||
16643 | |||
16644 | const char *NoDuplicateAttr::getSpelling() const { |
||
16645 | switch (getAttributeSpellingListIndex()) { |
||
16646 | default: |
||
16647 | llvm_unreachable("Unknown attribute spelling!"); |
||
16648 | return "(No spelling)"; |
||
16649 | case 0: |
||
16650 | return "noduplicate"; |
||
16651 | case 1: |
||
16652 | return "noduplicate"; |
||
16653 | case 2: |
||
16654 | return "noduplicate"; |
||
16655 | } |
||
16656 | } |
||
16657 | |||
16658 | |||
16659 | // NoEscapeAttr implementation |
||
16660 | |||
16661 | NoEscapeAttr *NoEscapeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16662 | auto *A = new (Ctx) NoEscapeAttr(Ctx, CommonInfo); |
||
16663 | A->setImplicit(true); |
||
16664 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16665 | A->setAttributeSpellingListIndex(0); |
||
16666 | return A; |
||
16667 | } |
||
16668 | |||
16669 | NoEscapeAttr *NoEscapeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16670 | auto *A = new (Ctx) NoEscapeAttr(Ctx, CommonInfo); |
||
16671 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16672 | A->setAttributeSpellingListIndex(0); |
||
16673 | return A; |
||
16674 | } |
||
16675 | |||
16676 | NoEscapeAttr *NoEscapeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16677 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16678 | return CreateImplicit(Ctx, I); |
||
16679 | } |
||
16680 | |||
16681 | NoEscapeAttr *NoEscapeAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16682 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16683 | return Create(Ctx, I); |
||
16684 | } |
||
16685 | |||
16686 | NoEscapeAttr::NoEscapeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16687 | ) |
||
16688 | : Attr(Ctx, CommonInfo, attr::NoEscape, false) |
||
16689 | { |
||
16690 | } |
||
16691 | |||
16692 | NoEscapeAttr *NoEscapeAttr::clone(ASTContext &C) const { |
||
16693 | auto *A = new (C) NoEscapeAttr(C, *this); |
||
16694 | A->Inherited = Inherited; |
||
16695 | A->IsPackExpansion = IsPackExpansion; |
||
16696 | A->setImplicit(Implicit); |
||
16697 | return A; |
||
16698 | } |
||
16699 | |||
16700 | void NoEscapeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16701 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16702 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16703 | switch (getAttributeSpellingListIndex()) { |
||
16704 | default: |
||
16705 | llvm_unreachable("Unknown attribute spelling!"); |
||
16706 | break; |
||
16707 | case 0 : { |
||
16708 | OS << " __attribute__((noescape"; |
||
16709 | OS << "))"; |
||
16710 | break; |
||
16711 | } |
||
16712 | case 1 : { |
||
16713 | OS << " [[clang::noescape"; |
||
16714 | OS << "]]"; |
||
16715 | break; |
||
16716 | } |
||
16717 | case 2 : { |
||
16718 | OS << " [[clang::noescape"; |
||
16719 | OS << "]]"; |
||
16720 | break; |
||
16721 | } |
||
16722 | } |
||
16723 | } |
||
16724 | |||
16725 | const char *NoEscapeAttr::getSpelling() const { |
||
16726 | switch (getAttributeSpellingListIndex()) { |
||
16727 | default: |
||
16728 | llvm_unreachable("Unknown attribute spelling!"); |
||
16729 | return "(No spelling)"; |
||
16730 | case 0: |
||
16731 | return "noescape"; |
||
16732 | case 1: |
||
16733 | return "noescape"; |
||
16734 | case 2: |
||
16735 | return "noescape"; |
||
16736 | } |
||
16737 | } |
||
16738 | |||
16739 | |||
16740 | // NoInlineAttr implementation |
||
16741 | |||
16742 | NoInlineAttr *NoInlineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16743 | auto *A = new (Ctx) NoInlineAttr(Ctx, CommonInfo); |
||
16744 | A->setImplicit(true); |
||
16745 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16746 | A->setAttributeSpellingListIndex(0); |
||
16747 | return A; |
||
16748 | } |
||
16749 | |||
16750 | NoInlineAttr *NoInlineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16751 | auto *A = new (Ctx) NoInlineAttr(Ctx, CommonInfo); |
||
16752 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16753 | A->setAttributeSpellingListIndex(0); |
||
16754 | return A; |
||
16755 | } |
||
16756 | |||
16757 | NoInlineAttr *NoInlineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16758 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16759 | return CreateImplicit(Ctx, I); |
||
16760 | } |
||
16761 | |||
16762 | NoInlineAttr *NoInlineAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16763 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16764 | return Create(Ctx, I); |
||
16765 | } |
||
16766 | |||
16767 | NoInlineAttr::NoInlineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16768 | ) |
||
16769 | : DeclOrStmtAttr(Ctx, CommonInfo, attr::NoInline, false, false) |
||
16770 | { |
||
16771 | } |
||
16772 | |||
16773 | NoInlineAttr *NoInlineAttr::clone(ASTContext &C) const { |
||
16774 | auto *A = new (C) NoInlineAttr(C, *this); |
||
16775 | A->Inherited = Inherited; |
||
16776 | A->IsPackExpansion = IsPackExpansion; |
||
16777 | A->setImplicit(Implicit); |
||
16778 | return A; |
||
16779 | } |
||
16780 | |||
16781 | void NoInlineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16782 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16783 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16784 | switch (getAttributeSpellingListIndex()) { |
||
16785 | default: |
||
16786 | llvm_unreachable("Unknown attribute spelling!"); |
||
16787 | break; |
||
16788 | case 0 : { |
||
16789 | OS << " __noinline__"; |
||
16790 | OS << ""; |
||
16791 | break; |
||
16792 | } |
||
16793 | case 1 : { |
||
16794 | OS << " __attribute__((noinline"; |
||
16795 | OS << "))"; |
||
16796 | break; |
||
16797 | } |
||
16798 | case 2 : { |
||
16799 | OS << " [[gnu::noinline"; |
||
16800 | OS << "]]"; |
||
16801 | break; |
||
16802 | } |
||
16803 | case 3 : { |
||
16804 | OS << " [[gnu::noinline"; |
||
16805 | OS << "]]"; |
||
16806 | break; |
||
16807 | } |
||
16808 | case 4 : { |
||
16809 | OS << " [[clang::noinline"; |
||
16810 | OS << "]]"; |
||
16811 | break; |
||
16812 | } |
||
16813 | case 5 : { |
||
16814 | OS << " [[clang::noinline"; |
||
16815 | OS << "]]"; |
||
16816 | break; |
||
16817 | } |
||
16818 | case 6 : { |
||
16819 | OS << " __declspec(noinline"; |
||
16820 | OS << ")"; |
||
16821 | break; |
||
16822 | } |
||
16823 | } |
||
16824 | } |
||
16825 | |||
16826 | const char *NoInlineAttr::getSpelling() const { |
||
16827 | switch (getAttributeSpellingListIndex()) { |
||
16828 | default: |
||
16829 | llvm_unreachable("Unknown attribute spelling!"); |
||
16830 | return "(No spelling)"; |
||
16831 | case 0: |
||
16832 | return "__noinline__"; |
||
16833 | case 1: |
||
16834 | return "noinline"; |
||
16835 | case 2: |
||
16836 | return "noinline"; |
||
16837 | case 3: |
||
16838 | return "noinline"; |
||
16839 | case 4: |
||
16840 | return "noinline"; |
||
16841 | case 5: |
||
16842 | return "noinline"; |
||
16843 | case 6: |
||
16844 | return "noinline"; |
||
16845 | } |
||
16846 | } |
||
16847 | |||
16848 | |||
16849 | // NoInstrumentFunctionAttr implementation |
||
16850 | |||
16851 | NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16852 | auto *A = new (Ctx) NoInstrumentFunctionAttr(Ctx, CommonInfo); |
||
16853 | A->setImplicit(true); |
||
16854 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16855 | A->setAttributeSpellingListIndex(0); |
||
16856 | return A; |
||
16857 | } |
||
16858 | |||
16859 | NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16860 | auto *A = new (Ctx) NoInstrumentFunctionAttr(Ctx, CommonInfo); |
||
16861 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16862 | A->setAttributeSpellingListIndex(0); |
||
16863 | return A; |
||
16864 | } |
||
16865 | |||
16866 | NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16867 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16868 | return CreateImplicit(Ctx, I); |
||
16869 | } |
||
16870 | |||
16871 | NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16872 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16873 | return Create(Ctx, I); |
||
16874 | } |
||
16875 | |||
16876 | NoInstrumentFunctionAttr::NoInstrumentFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16877 | ) |
||
16878 | : InheritableAttr(Ctx, CommonInfo, attr::NoInstrumentFunction, false, false) |
||
16879 | { |
||
16880 | } |
||
16881 | |||
16882 | NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::clone(ASTContext &C) const { |
||
16883 | auto *A = new (C) NoInstrumentFunctionAttr(C, *this); |
||
16884 | A->Inherited = Inherited; |
||
16885 | A->IsPackExpansion = IsPackExpansion; |
||
16886 | A->setImplicit(Implicit); |
||
16887 | return A; |
||
16888 | } |
||
16889 | |||
16890 | void NoInstrumentFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16891 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16892 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16893 | switch (getAttributeSpellingListIndex()) { |
||
16894 | default: |
||
16895 | llvm_unreachable("Unknown attribute spelling!"); |
||
16896 | break; |
||
16897 | case 0 : { |
||
16898 | OS << " __attribute__((no_instrument_function"; |
||
16899 | OS << "))"; |
||
16900 | break; |
||
16901 | } |
||
16902 | case 1 : { |
||
16903 | OS << " [[gnu::no_instrument_function"; |
||
16904 | OS << "]]"; |
||
16905 | break; |
||
16906 | } |
||
16907 | case 2 : { |
||
16908 | OS << " [[gnu::no_instrument_function"; |
||
16909 | OS << "]]"; |
||
16910 | break; |
||
16911 | } |
||
16912 | } |
||
16913 | } |
||
16914 | |||
16915 | const char *NoInstrumentFunctionAttr::getSpelling() const { |
||
16916 | switch (getAttributeSpellingListIndex()) { |
||
16917 | default: |
||
16918 | llvm_unreachable("Unknown attribute spelling!"); |
||
16919 | return "(No spelling)"; |
||
16920 | case 0: |
||
16921 | return "no_instrument_function"; |
||
16922 | case 1: |
||
16923 | return "no_instrument_function"; |
||
16924 | case 2: |
||
16925 | return "no_instrument_function"; |
||
16926 | } |
||
16927 | } |
||
16928 | |||
16929 | |||
16930 | // NoMergeAttr implementation |
||
16931 | |||
16932 | NoMergeAttr *NoMergeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16933 | auto *A = new (Ctx) NoMergeAttr(Ctx, CommonInfo); |
||
16934 | A->setImplicit(true); |
||
16935 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16936 | A->setAttributeSpellingListIndex(0); |
||
16937 | return A; |
||
16938 | } |
||
16939 | |||
16940 | NoMergeAttr *NoMergeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
16941 | auto *A = new (Ctx) NoMergeAttr(Ctx, CommonInfo); |
||
16942 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
16943 | A->setAttributeSpellingListIndex(0); |
||
16944 | return A; |
||
16945 | } |
||
16946 | |||
16947 | NoMergeAttr *NoMergeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16948 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16949 | return CreateImplicit(Ctx, I); |
||
16950 | } |
||
16951 | |||
16952 | NoMergeAttr *NoMergeAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
16953 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
16954 | return Create(Ctx, I); |
||
16955 | } |
||
16956 | |||
16957 | NoMergeAttr::NoMergeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
16958 | ) |
||
16959 | : DeclOrStmtAttr(Ctx, CommonInfo, attr::NoMerge, false, false) |
||
16960 | { |
||
16961 | } |
||
16962 | |||
16963 | NoMergeAttr *NoMergeAttr::clone(ASTContext &C) const { |
||
16964 | auto *A = new (C) NoMergeAttr(C, *this); |
||
16965 | A->Inherited = Inherited; |
||
16966 | A->IsPackExpansion = IsPackExpansion; |
||
16967 | A->setImplicit(Implicit); |
||
16968 | return A; |
||
16969 | } |
||
16970 | |||
16971 | void NoMergeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
16972 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
16973 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
16974 | switch (getAttributeSpellingListIndex()) { |
||
16975 | default: |
||
16976 | llvm_unreachable("Unknown attribute spelling!"); |
||
16977 | break; |
||
16978 | case 0 : { |
||
16979 | OS << " __attribute__((nomerge"; |
||
16980 | OS << "))"; |
||
16981 | break; |
||
16982 | } |
||
16983 | case 1 : { |
||
16984 | OS << " [[clang::nomerge"; |
||
16985 | OS << "]]"; |
||
16986 | break; |
||
16987 | } |
||
16988 | case 2 : { |
||
16989 | OS << " [[clang::nomerge"; |
||
16990 | OS << "]]"; |
||
16991 | break; |
||
16992 | } |
||
16993 | } |
||
16994 | } |
||
16995 | |||
16996 | const char *NoMergeAttr::getSpelling() const { |
||
16997 | switch (getAttributeSpellingListIndex()) { |
||
16998 | default: |
||
16999 | llvm_unreachable("Unknown attribute spelling!"); |
||
17000 | return "(No spelling)"; |
||
17001 | case 0: |
||
17002 | return "nomerge"; |
||
17003 | case 1: |
||
17004 | return "nomerge"; |
||
17005 | case 2: |
||
17006 | return "nomerge"; |
||
17007 | } |
||
17008 | } |
||
17009 | |||
17010 | |||
17011 | // NoMicroMipsAttr implementation |
||
17012 | |||
17013 | NoMicroMipsAttr *NoMicroMipsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17014 | auto *A = new (Ctx) NoMicroMipsAttr(Ctx, CommonInfo); |
||
17015 | A->setImplicit(true); |
||
17016 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17017 | A->setAttributeSpellingListIndex(0); |
||
17018 | return A; |
||
17019 | } |
||
17020 | |||
17021 | NoMicroMipsAttr *NoMicroMipsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17022 | auto *A = new (Ctx) NoMicroMipsAttr(Ctx, CommonInfo); |
||
17023 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17024 | A->setAttributeSpellingListIndex(0); |
||
17025 | return A; |
||
17026 | } |
||
17027 | |||
17028 | NoMicroMipsAttr *NoMicroMipsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17029 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17030 | return CreateImplicit(Ctx, I); |
||
17031 | } |
||
17032 | |||
17033 | NoMicroMipsAttr *NoMicroMipsAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17034 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17035 | return Create(Ctx, I); |
||
17036 | } |
||
17037 | |||
17038 | NoMicroMipsAttr::NoMicroMipsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17039 | ) |
||
17040 | : InheritableAttr(Ctx, CommonInfo, attr::NoMicroMips, false, false) |
||
17041 | { |
||
17042 | } |
||
17043 | |||
17044 | NoMicroMipsAttr *NoMicroMipsAttr::clone(ASTContext &C) const { |
||
17045 | auto *A = new (C) NoMicroMipsAttr(C, *this); |
||
17046 | A->Inherited = Inherited; |
||
17047 | A->IsPackExpansion = IsPackExpansion; |
||
17048 | A->setImplicit(Implicit); |
||
17049 | return A; |
||
17050 | } |
||
17051 | |||
17052 | void NoMicroMipsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17053 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17054 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17055 | switch (getAttributeSpellingListIndex()) { |
||
17056 | default: |
||
17057 | llvm_unreachable("Unknown attribute spelling!"); |
||
17058 | break; |
||
17059 | case 0 : { |
||
17060 | OS << " __attribute__((nomicromips"; |
||
17061 | OS << "))"; |
||
17062 | break; |
||
17063 | } |
||
17064 | case 1 : { |
||
17065 | OS << " [[gnu::nomicromips"; |
||
17066 | OS << "]]"; |
||
17067 | break; |
||
17068 | } |
||
17069 | case 2 : { |
||
17070 | OS << " [[gnu::nomicromips"; |
||
17071 | OS << "]]"; |
||
17072 | break; |
||
17073 | } |
||
17074 | } |
||
17075 | } |
||
17076 | |||
17077 | const char *NoMicroMipsAttr::getSpelling() const { |
||
17078 | switch (getAttributeSpellingListIndex()) { |
||
17079 | default: |
||
17080 | llvm_unreachable("Unknown attribute spelling!"); |
||
17081 | return "(No spelling)"; |
||
17082 | case 0: |
||
17083 | return "nomicromips"; |
||
17084 | case 1: |
||
17085 | return "nomicromips"; |
||
17086 | case 2: |
||
17087 | return "nomicromips"; |
||
17088 | } |
||
17089 | } |
||
17090 | |||
17091 | |||
17092 | // NoMips16Attr implementation |
||
17093 | |||
17094 | NoMips16Attr *NoMips16Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17095 | auto *A = new (Ctx) NoMips16Attr(Ctx, CommonInfo); |
||
17096 | A->setImplicit(true); |
||
17097 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17098 | A->setAttributeSpellingListIndex(0); |
||
17099 | return A; |
||
17100 | } |
||
17101 | |||
17102 | NoMips16Attr *NoMips16Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17103 | auto *A = new (Ctx) NoMips16Attr(Ctx, CommonInfo); |
||
17104 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17105 | A->setAttributeSpellingListIndex(0); |
||
17106 | return A; |
||
17107 | } |
||
17108 | |||
17109 | NoMips16Attr *NoMips16Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17110 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17111 | return CreateImplicit(Ctx, I); |
||
17112 | } |
||
17113 | |||
17114 | NoMips16Attr *NoMips16Attr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17115 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17116 | return Create(Ctx, I); |
||
17117 | } |
||
17118 | |||
17119 | NoMips16Attr::NoMips16Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17120 | ) |
||
17121 | : InheritableAttr(Ctx, CommonInfo, attr::NoMips16, false, false) |
||
17122 | { |
||
17123 | } |
||
17124 | |||
17125 | NoMips16Attr *NoMips16Attr::clone(ASTContext &C) const { |
||
17126 | auto *A = new (C) NoMips16Attr(C, *this); |
||
17127 | A->Inherited = Inherited; |
||
17128 | A->IsPackExpansion = IsPackExpansion; |
||
17129 | A->setImplicit(Implicit); |
||
17130 | return A; |
||
17131 | } |
||
17132 | |||
17133 | void NoMips16Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17134 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17135 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17136 | switch (getAttributeSpellingListIndex()) { |
||
17137 | default: |
||
17138 | llvm_unreachable("Unknown attribute spelling!"); |
||
17139 | break; |
||
17140 | case 0 : { |
||
17141 | OS << " __attribute__((nomips16"; |
||
17142 | OS << "))"; |
||
17143 | break; |
||
17144 | } |
||
17145 | case 1 : { |
||
17146 | OS << " [[gnu::nomips16"; |
||
17147 | OS << "]]"; |
||
17148 | break; |
||
17149 | } |
||
17150 | case 2 : { |
||
17151 | OS << " [[gnu::nomips16"; |
||
17152 | OS << "]]"; |
||
17153 | break; |
||
17154 | } |
||
17155 | } |
||
17156 | } |
||
17157 | |||
17158 | const char *NoMips16Attr::getSpelling() const { |
||
17159 | switch (getAttributeSpellingListIndex()) { |
||
17160 | default: |
||
17161 | llvm_unreachable("Unknown attribute spelling!"); |
||
17162 | return "(No spelling)"; |
||
17163 | case 0: |
||
17164 | return "nomips16"; |
||
17165 | case 1: |
||
17166 | return "nomips16"; |
||
17167 | case 2: |
||
17168 | return "nomips16"; |
||
17169 | } |
||
17170 | } |
||
17171 | |||
17172 | |||
17173 | // NoProfileFunctionAttr implementation |
||
17174 | |||
17175 | NoProfileFunctionAttr *NoProfileFunctionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17176 | auto *A = new (Ctx) NoProfileFunctionAttr(Ctx, CommonInfo); |
||
17177 | A->setImplicit(true); |
||
17178 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17179 | A->setAttributeSpellingListIndex(0); |
||
17180 | return A; |
||
17181 | } |
||
17182 | |||
17183 | NoProfileFunctionAttr *NoProfileFunctionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17184 | auto *A = new (Ctx) NoProfileFunctionAttr(Ctx, CommonInfo); |
||
17185 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17186 | A->setAttributeSpellingListIndex(0); |
||
17187 | return A; |
||
17188 | } |
||
17189 | |||
17190 | NoProfileFunctionAttr *NoProfileFunctionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17191 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17192 | return CreateImplicit(Ctx, I); |
||
17193 | } |
||
17194 | |||
17195 | NoProfileFunctionAttr *NoProfileFunctionAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17196 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17197 | return Create(Ctx, I); |
||
17198 | } |
||
17199 | |||
17200 | NoProfileFunctionAttr::NoProfileFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17201 | ) |
||
17202 | : InheritableAttr(Ctx, CommonInfo, attr::NoProfileFunction, false, false) |
||
17203 | { |
||
17204 | } |
||
17205 | |||
17206 | NoProfileFunctionAttr *NoProfileFunctionAttr::clone(ASTContext &C) const { |
||
17207 | auto *A = new (C) NoProfileFunctionAttr(C, *this); |
||
17208 | A->Inherited = Inherited; |
||
17209 | A->IsPackExpansion = IsPackExpansion; |
||
17210 | A->setImplicit(Implicit); |
||
17211 | return A; |
||
17212 | } |
||
17213 | |||
17214 | void NoProfileFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17215 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17216 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17217 | switch (getAttributeSpellingListIndex()) { |
||
17218 | default: |
||
17219 | llvm_unreachable("Unknown attribute spelling!"); |
||
17220 | break; |
||
17221 | case 0 : { |
||
17222 | OS << " __attribute__((no_profile_instrument_function"; |
||
17223 | OS << "))"; |
||
17224 | break; |
||
17225 | } |
||
17226 | case 1 : { |
||
17227 | OS << " [[gnu::no_profile_instrument_function"; |
||
17228 | OS << "]]"; |
||
17229 | break; |
||
17230 | } |
||
17231 | case 2 : { |
||
17232 | OS << " [[gnu::no_profile_instrument_function"; |
||
17233 | OS << "]]"; |
||
17234 | break; |
||
17235 | } |
||
17236 | } |
||
17237 | } |
||
17238 | |||
17239 | const char *NoProfileFunctionAttr::getSpelling() const { |
||
17240 | switch (getAttributeSpellingListIndex()) { |
||
17241 | default: |
||
17242 | llvm_unreachable("Unknown attribute spelling!"); |
||
17243 | return "(No spelling)"; |
||
17244 | case 0: |
||
17245 | return "no_profile_instrument_function"; |
||
17246 | case 1: |
||
17247 | return "no_profile_instrument_function"; |
||
17248 | case 2: |
||
17249 | return "no_profile_instrument_function"; |
||
17250 | } |
||
17251 | } |
||
17252 | |||
17253 | |||
17254 | // NoRandomizeLayoutAttr implementation |
||
17255 | |||
17256 | NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17257 | auto *A = new (Ctx) NoRandomizeLayoutAttr(Ctx, CommonInfo); |
||
17258 | A->setImplicit(true); |
||
17259 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17260 | A->setAttributeSpellingListIndex(0); |
||
17261 | return A; |
||
17262 | } |
||
17263 | |||
17264 | NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17265 | auto *A = new (Ctx) NoRandomizeLayoutAttr(Ctx, CommonInfo); |
||
17266 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17267 | A->setAttributeSpellingListIndex(0); |
||
17268 | return A; |
||
17269 | } |
||
17270 | |||
17271 | NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17272 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17273 | return CreateImplicit(Ctx, I); |
||
17274 | } |
||
17275 | |||
17276 | NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17277 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17278 | return Create(Ctx, I); |
||
17279 | } |
||
17280 | |||
17281 | NoRandomizeLayoutAttr::NoRandomizeLayoutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17282 | ) |
||
17283 | : InheritableAttr(Ctx, CommonInfo, attr::NoRandomizeLayout, false, false) |
||
17284 | { |
||
17285 | } |
||
17286 | |||
17287 | NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::clone(ASTContext &C) const { |
||
17288 | auto *A = new (C) NoRandomizeLayoutAttr(C, *this); |
||
17289 | A->Inherited = Inherited; |
||
17290 | A->IsPackExpansion = IsPackExpansion; |
||
17291 | A->setImplicit(Implicit); |
||
17292 | return A; |
||
17293 | } |
||
17294 | |||
17295 | void NoRandomizeLayoutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17296 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17297 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17298 | switch (getAttributeSpellingListIndex()) { |
||
17299 | default: |
||
17300 | llvm_unreachable("Unknown attribute spelling!"); |
||
17301 | break; |
||
17302 | case 0 : { |
||
17303 | OS << " __attribute__((no_randomize_layout"; |
||
17304 | OS << "))"; |
||
17305 | break; |
||
17306 | } |
||
17307 | case 1 : { |
||
17308 | OS << " [[gnu::no_randomize_layout"; |
||
17309 | OS << "]]"; |
||
17310 | break; |
||
17311 | } |
||
17312 | case 2 : { |
||
17313 | OS << " [[gnu::no_randomize_layout"; |
||
17314 | OS << "]]"; |
||
17315 | break; |
||
17316 | } |
||
17317 | } |
||
17318 | } |
||
17319 | |||
17320 | const char *NoRandomizeLayoutAttr::getSpelling() const { |
||
17321 | switch (getAttributeSpellingListIndex()) { |
||
17322 | default: |
||
17323 | llvm_unreachable("Unknown attribute spelling!"); |
||
17324 | return "(No spelling)"; |
||
17325 | case 0: |
||
17326 | return "no_randomize_layout"; |
||
17327 | case 1: |
||
17328 | return "no_randomize_layout"; |
||
17329 | case 2: |
||
17330 | return "no_randomize_layout"; |
||
17331 | } |
||
17332 | } |
||
17333 | |||
17334 | |||
17335 | // NoReturnAttr implementation |
||
17336 | |||
17337 | NoReturnAttr *NoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17338 | auto *A = new (Ctx) NoReturnAttr(Ctx, CommonInfo); |
||
17339 | A->setImplicit(true); |
||
17340 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17341 | A->setAttributeSpellingListIndex(0); |
||
17342 | return A; |
||
17343 | } |
||
17344 | |||
17345 | NoReturnAttr *NoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17346 | auto *A = new (Ctx) NoReturnAttr(Ctx, CommonInfo); |
||
17347 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17348 | A->setAttributeSpellingListIndex(0); |
||
17349 | return A; |
||
17350 | } |
||
17351 | |||
17352 | NoReturnAttr *NoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17353 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17354 | return CreateImplicit(Ctx, I); |
||
17355 | } |
||
17356 | |||
17357 | NoReturnAttr *NoReturnAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17358 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17359 | return Create(Ctx, I); |
||
17360 | } |
||
17361 | |||
17362 | NoReturnAttr::NoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17363 | ) |
||
17364 | : InheritableAttr(Ctx, CommonInfo, attr::NoReturn, false, false) |
||
17365 | { |
||
17366 | } |
||
17367 | |||
17368 | NoReturnAttr *NoReturnAttr::clone(ASTContext &C) const { |
||
17369 | auto *A = new (C) NoReturnAttr(C, *this); |
||
17370 | A->Inherited = Inherited; |
||
17371 | A->IsPackExpansion = IsPackExpansion; |
||
17372 | A->setImplicit(Implicit); |
||
17373 | return A; |
||
17374 | } |
||
17375 | |||
17376 | void NoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17377 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17378 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17379 | switch (getAttributeSpellingListIndex()) { |
||
17380 | default: |
||
17381 | llvm_unreachable("Unknown attribute spelling!"); |
||
17382 | break; |
||
17383 | case 0 : { |
||
17384 | OS << " __attribute__((noreturn"; |
||
17385 | OS << "))"; |
||
17386 | break; |
||
17387 | } |
||
17388 | case 1 : { |
||
17389 | OS << " [[gnu::noreturn"; |
||
17390 | OS << "]]"; |
||
17391 | break; |
||
17392 | } |
||
17393 | case 2 : { |
||
17394 | OS << " [[gnu::noreturn"; |
||
17395 | OS << "]]"; |
||
17396 | break; |
||
17397 | } |
||
17398 | case 3 : { |
||
17399 | OS << " __declspec(noreturn"; |
||
17400 | OS << ")"; |
||
17401 | break; |
||
17402 | } |
||
17403 | } |
||
17404 | } |
||
17405 | |||
17406 | const char *NoReturnAttr::getSpelling() const { |
||
17407 | switch (getAttributeSpellingListIndex()) { |
||
17408 | default: |
||
17409 | llvm_unreachable("Unknown attribute spelling!"); |
||
17410 | return "(No spelling)"; |
||
17411 | case 0: |
||
17412 | return "noreturn"; |
||
17413 | case 1: |
||
17414 | return "noreturn"; |
||
17415 | case 2: |
||
17416 | return "noreturn"; |
||
17417 | case 3: |
||
17418 | return "noreturn"; |
||
17419 | } |
||
17420 | } |
||
17421 | |||
17422 | |||
17423 | // NoSanitizeAttr implementation |
||
17424 | |||
17425 | NoSanitizeAttr *NoSanitizeAttr::CreateImplicit(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, const AttributeCommonInfo &CommonInfo) { |
||
17426 | auto *A = new (Ctx) NoSanitizeAttr(Ctx, CommonInfo, Sanitizers, SanitizersSize); |
||
17427 | A->setImplicit(true); |
||
17428 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17429 | A->setAttributeSpellingListIndex(0); |
||
17430 | return A; |
||
17431 | } |
||
17432 | |||
17433 | NoSanitizeAttr *NoSanitizeAttr::Create(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, const AttributeCommonInfo &CommonInfo) { |
||
17434 | auto *A = new (Ctx) NoSanitizeAttr(Ctx, CommonInfo, Sanitizers, SanitizersSize); |
||
17435 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17436 | A->setAttributeSpellingListIndex(0); |
||
17437 | return A; |
||
17438 | } |
||
17439 | |||
17440 | NoSanitizeAttr *NoSanitizeAttr::CreateImplicit(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17441 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17442 | return CreateImplicit(Ctx, Sanitizers, SanitizersSize, I); |
||
17443 | } |
||
17444 | |||
17445 | NoSanitizeAttr *NoSanitizeAttr::Create(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17446 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17447 | return Create(Ctx, Sanitizers, SanitizersSize, I); |
||
17448 | } |
||
17449 | |||
17450 | NoSanitizeAttr::NoSanitizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17451 | , StringRef *Sanitizers, unsigned SanitizersSize |
||
17452 | ) |
||
17453 | : InheritableAttr(Ctx, CommonInfo, attr::NoSanitize, false, false) |
||
17454 | , sanitizers_Size(SanitizersSize), sanitizers_(new (Ctx, 16) StringRef[sanitizers_Size]) |
||
17455 | { |
||
17456 | for (size_t I = 0, E = sanitizers_Size; I != E; |
||
17457 | ++I) { |
||
17458 | StringRef Ref = Sanitizers[I]; |
||
17459 | if (!Ref.empty()) { |
||
17460 | char *Mem = new (Ctx, 1) char[Ref.size()]; |
||
17461 | std::memcpy(Mem, Ref.data(), Ref.size()); |
||
17462 | sanitizers_[I] = StringRef(Mem, Ref.size()); |
||
17463 | } |
||
17464 | } |
||
17465 | } |
||
17466 | |||
17467 | NoSanitizeAttr::NoSanitizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17468 | ) |
||
17469 | : InheritableAttr(Ctx, CommonInfo, attr::NoSanitize, false, false) |
||
17470 | , sanitizers_Size(0), sanitizers_(nullptr) |
||
17471 | { |
||
17472 | } |
||
17473 | |||
17474 | |||
17475 | |||
17476 | NoSanitizeAttr *NoSanitizeAttr::clone(ASTContext &C) const { |
||
17477 | auto *A = new (C) NoSanitizeAttr(C, *this, sanitizers_, sanitizers_Size); |
||
17478 | A->Inherited = Inherited; |
||
17479 | A->IsPackExpansion = IsPackExpansion; |
||
17480 | A->setImplicit(Implicit); |
||
17481 | return A; |
||
17482 | } |
||
17483 | |||
17484 | void NoSanitizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17485 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17486 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17487 | switch (getAttributeSpellingListIndex()) { |
||
17488 | default: |
||
17489 | llvm_unreachable("Unknown attribute spelling!"); |
||
17490 | break; |
||
17491 | case 0 : { |
||
17492 | OS << " __attribute__((no_sanitize"; |
||
17493 | OS << ""; |
||
17494 | for (const auto &Val : sanitizers()) { |
||
17495 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
17496 | OS << "\"" << Val << "\""; |
||
17497 | } |
||
17498 | OS << ""; |
||
17499 | if (!IsFirstArgument) |
||
17500 | OS << ")"; |
||
17501 | OS << "))"; |
||
17502 | break; |
||
17503 | } |
||
17504 | case 1 : { |
||
17505 | OS << " [[clang::no_sanitize"; |
||
17506 | OS << ""; |
||
17507 | for (const auto &Val : sanitizers()) { |
||
17508 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
17509 | OS << "\"" << Val << "\""; |
||
17510 | } |
||
17511 | OS << ""; |
||
17512 | if (!IsFirstArgument) |
||
17513 | OS << ")"; |
||
17514 | OS << "]]"; |
||
17515 | break; |
||
17516 | } |
||
17517 | case 2 : { |
||
17518 | OS << " [[clang::no_sanitize"; |
||
17519 | OS << ""; |
||
17520 | for (const auto &Val : sanitizers()) { |
||
17521 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
17522 | OS << "\"" << Val << "\""; |
||
17523 | } |
||
17524 | OS << ""; |
||
17525 | if (!IsFirstArgument) |
||
17526 | OS << ")"; |
||
17527 | OS << "]]"; |
||
17528 | break; |
||
17529 | } |
||
17530 | } |
||
17531 | } |
||
17532 | |||
17533 | const char *NoSanitizeAttr::getSpelling() const { |
||
17534 | switch (getAttributeSpellingListIndex()) { |
||
17535 | default: |
||
17536 | llvm_unreachable("Unknown attribute spelling!"); |
||
17537 | return "(No spelling)"; |
||
17538 | case 0: |
||
17539 | return "no_sanitize"; |
||
17540 | case 1: |
||
17541 | return "no_sanitize"; |
||
17542 | case 2: |
||
17543 | return "no_sanitize"; |
||
17544 | } |
||
17545 | } |
||
17546 | |||
17547 | |||
17548 | // NoSpeculativeLoadHardeningAttr implementation |
||
17549 | |||
17550 | NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17551 | auto *A = new (Ctx) NoSpeculativeLoadHardeningAttr(Ctx, CommonInfo); |
||
17552 | A->setImplicit(true); |
||
17553 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17554 | A->setAttributeSpellingListIndex(0); |
||
17555 | return A; |
||
17556 | } |
||
17557 | |||
17558 | NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17559 | auto *A = new (Ctx) NoSpeculativeLoadHardeningAttr(Ctx, CommonInfo); |
||
17560 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17561 | A->setAttributeSpellingListIndex(0); |
||
17562 | return A; |
||
17563 | } |
||
17564 | |||
17565 | NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17566 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17567 | return CreateImplicit(Ctx, I); |
||
17568 | } |
||
17569 | |||
17570 | NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17571 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17572 | return Create(Ctx, I); |
||
17573 | } |
||
17574 | |||
17575 | NoSpeculativeLoadHardeningAttr::NoSpeculativeLoadHardeningAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17576 | ) |
||
17577 | : InheritableAttr(Ctx, CommonInfo, attr::NoSpeculativeLoadHardening, false, false) |
||
17578 | { |
||
17579 | } |
||
17580 | |||
17581 | NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::clone(ASTContext &C) const { |
||
17582 | auto *A = new (C) NoSpeculativeLoadHardeningAttr(C, *this); |
||
17583 | A->Inherited = Inherited; |
||
17584 | A->IsPackExpansion = IsPackExpansion; |
||
17585 | A->setImplicit(Implicit); |
||
17586 | return A; |
||
17587 | } |
||
17588 | |||
17589 | void NoSpeculativeLoadHardeningAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17590 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17591 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17592 | switch (getAttributeSpellingListIndex()) { |
||
17593 | default: |
||
17594 | llvm_unreachable("Unknown attribute spelling!"); |
||
17595 | break; |
||
17596 | case 0 : { |
||
17597 | OS << " __attribute__((no_speculative_load_hardening"; |
||
17598 | OS << "))"; |
||
17599 | break; |
||
17600 | } |
||
17601 | case 1 : { |
||
17602 | OS << " [[clang::no_speculative_load_hardening"; |
||
17603 | OS << "]]"; |
||
17604 | break; |
||
17605 | } |
||
17606 | case 2 : { |
||
17607 | OS << " [[clang::no_speculative_load_hardening"; |
||
17608 | OS << "]]"; |
||
17609 | break; |
||
17610 | } |
||
17611 | } |
||
17612 | } |
||
17613 | |||
17614 | const char *NoSpeculativeLoadHardeningAttr::getSpelling() const { |
||
17615 | switch (getAttributeSpellingListIndex()) { |
||
17616 | default: |
||
17617 | llvm_unreachable("Unknown attribute spelling!"); |
||
17618 | return "(No spelling)"; |
||
17619 | case 0: |
||
17620 | return "no_speculative_load_hardening"; |
||
17621 | case 1: |
||
17622 | return "no_speculative_load_hardening"; |
||
17623 | case 2: |
||
17624 | return "no_speculative_load_hardening"; |
||
17625 | } |
||
17626 | } |
||
17627 | |||
17628 | |||
17629 | // NoSplitStackAttr implementation |
||
17630 | |||
17631 | NoSplitStackAttr *NoSplitStackAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17632 | auto *A = new (Ctx) NoSplitStackAttr(Ctx, CommonInfo); |
||
17633 | A->setImplicit(true); |
||
17634 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17635 | A->setAttributeSpellingListIndex(0); |
||
17636 | return A; |
||
17637 | } |
||
17638 | |||
17639 | NoSplitStackAttr *NoSplitStackAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17640 | auto *A = new (Ctx) NoSplitStackAttr(Ctx, CommonInfo); |
||
17641 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17642 | A->setAttributeSpellingListIndex(0); |
||
17643 | return A; |
||
17644 | } |
||
17645 | |||
17646 | NoSplitStackAttr *NoSplitStackAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17647 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17648 | return CreateImplicit(Ctx, I); |
||
17649 | } |
||
17650 | |||
17651 | NoSplitStackAttr *NoSplitStackAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17652 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17653 | return Create(Ctx, I); |
||
17654 | } |
||
17655 | |||
17656 | NoSplitStackAttr::NoSplitStackAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17657 | ) |
||
17658 | : InheritableAttr(Ctx, CommonInfo, attr::NoSplitStack, false, false) |
||
17659 | { |
||
17660 | } |
||
17661 | |||
17662 | NoSplitStackAttr *NoSplitStackAttr::clone(ASTContext &C) const { |
||
17663 | auto *A = new (C) NoSplitStackAttr(C, *this); |
||
17664 | A->Inherited = Inherited; |
||
17665 | A->IsPackExpansion = IsPackExpansion; |
||
17666 | A->setImplicit(Implicit); |
||
17667 | return A; |
||
17668 | } |
||
17669 | |||
17670 | void NoSplitStackAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17671 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17672 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17673 | switch (getAttributeSpellingListIndex()) { |
||
17674 | default: |
||
17675 | llvm_unreachable("Unknown attribute spelling!"); |
||
17676 | break; |
||
17677 | case 0 : { |
||
17678 | OS << " __attribute__((no_split_stack"; |
||
17679 | OS << "))"; |
||
17680 | break; |
||
17681 | } |
||
17682 | case 1 : { |
||
17683 | OS << " [[gnu::no_split_stack"; |
||
17684 | OS << "]]"; |
||
17685 | break; |
||
17686 | } |
||
17687 | case 2 : { |
||
17688 | OS << " [[gnu::no_split_stack"; |
||
17689 | OS << "]]"; |
||
17690 | break; |
||
17691 | } |
||
17692 | } |
||
17693 | } |
||
17694 | |||
17695 | const char *NoSplitStackAttr::getSpelling() const { |
||
17696 | switch (getAttributeSpellingListIndex()) { |
||
17697 | default: |
||
17698 | llvm_unreachable("Unknown attribute spelling!"); |
||
17699 | return "(No spelling)"; |
||
17700 | case 0: |
||
17701 | return "no_split_stack"; |
||
17702 | case 1: |
||
17703 | return "no_split_stack"; |
||
17704 | case 2: |
||
17705 | return "no_split_stack"; |
||
17706 | } |
||
17707 | } |
||
17708 | |||
17709 | |||
17710 | // NoStackProtectorAttr implementation |
||
17711 | |||
17712 | NoStackProtectorAttr *NoStackProtectorAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17713 | auto *A = new (Ctx) NoStackProtectorAttr(Ctx, CommonInfo); |
||
17714 | A->setImplicit(true); |
||
17715 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17716 | A->setAttributeSpellingListIndex(0); |
||
17717 | return A; |
||
17718 | } |
||
17719 | |||
17720 | NoStackProtectorAttr *NoStackProtectorAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17721 | auto *A = new (Ctx) NoStackProtectorAttr(Ctx, CommonInfo); |
||
17722 | return A; |
||
17723 | } |
||
17724 | |||
17725 | NoStackProtectorAttr *NoStackProtectorAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, NoStackProtectorAttr::Spelling S) { |
||
17726 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
17727 | return CreateImplicit(Ctx, I); |
||
17728 | } |
||
17729 | |||
17730 | NoStackProtectorAttr *NoStackProtectorAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, NoStackProtectorAttr::Spelling S) { |
||
17731 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
17732 | return Create(Ctx, I); |
||
17733 | } |
||
17734 | |||
17735 | NoStackProtectorAttr::NoStackProtectorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17736 | ) |
||
17737 | : InheritableAttr(Ctx, CommonInfo, attr::NoStackProtector, false, false) |
||
17738 | { |
||
17739 | } |
||
17740 | |||
17741 | NoStackProtectorAttr::Spelling NoStackProtectorAttr::getSemanticSpelling() const { |
||
17742 | switch (getAttributeSpellingListIndex()) { |
||
17743 | default: llvm_unreachable("Unknown spelling list index"); |
||
17744 | case 0: return GNU_no_stack_protector; |
||
17745 | case 1: return CXX11_clang_no_stack_protector; |
||
17746 | case 2: return C2x_clang_no_stack_protector; |
||
17747 | case 3: return Declspec_safebuffers; |
||
17748 | } |
||
17749 | } |
||
17750 | NoStackProtectorAttr *NoStackProtectorAttr::clone(ASTContext &C) const { |
||
17751 | auto *A = new (C) NoStackProtectorAttr(C, *this); |
||
17752 | A->Inherited = Inherited; |
||
17753 | A->IsPackExpansion = IsPackExpansion; |
||
17754 | A->setImplicit(Implicit); |
||
17755 | return A; |
||
17756 | } |
||
17757 | |||
17758 | void NoStackProtectorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17759 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17760 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17761 | switch (getAttributeSpellingListIndex()) { |
||
17762 | default: |
||
17763 | llvm_unreachable("Unknown attribute spelling!"); |
||
17764 | break; |
||
17765 | case 0 : { |
||
17766 | OS << " __attribute__((no_stack_protector"; |
||
17767 | OS << "))"; |
||
17768 | break; |
||
17769 | } |
||
17770 | case 1 : { |
||
17771 | OS << " [[clang::no_stack_protector"; |
||
17772 | OS << "]]"; |
||
17773 | break; |
||
17774 | } |
||
17775 | case 2 : { |
||
17776 | OS << " [[clang::no_stack_protector"; |
||
17777 | OS << "]]"; |
||
17778 | break; |
||
17779 | } |
||
17780 | case 3 : { |
||
17781 | OS << " __declspec(safebuffers"; |
||
17782 | OS << ")"; |
||
17783 | break; |
||
17784 | } |
||
17785 | } |
||
17786 | } |
||
17787 | |||
17788 | const char *NoStackProtectorAttr::getSpelling() const { |
||
17789 | switch (getAttributeSpellingListIndex()) { |
||
17790 | default: |
||
17791 | llvm_unreachable("Unknown attribute spelling!"); |
||
17792 | return "(No spelling)"; |
||
17793 | case 0: |
||
17794 | return "no_stack_protector"; |
||
17795 | case 1: |
||
17796 | return "no_stack_protector"; |
||
17797 | case 2: |
||
17798 | return "no_stack_protector"; |
||
17799 | case 3: |
||
17800 | return "safebuffers"; |
||
17801 | } |
||
17802 | } |
||
17803 | |||
17804 | |||
17805 | // NoThreadSafetyAnalysisAttr implementation |
||
17806 | |||
17807 | NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17808 | auto *A = new (Ctx) NoThreadSafetyAnalysisAttr(Ctx, CommonInfo); |
||
17809 | A->setImplicit(true); |
||
17810 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17811 | A->setAttributeSpellingListIndex(0); |
||
17812 | return A; |
||
17813 | } |
||
17814 | |||
17815 | NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17816 | auto *A = new (Ctx) NoThreadSafetyAnalysisAttr(Ctx, CommonInfo); |
||
17817 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17818 | A->setAttributeSpellingListIndex(0); |
||
17819 | return A; |
||
17820 | } |
||
17821 | |||
17822 | NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17823 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17824 | return CreateImplicit(Ctx, I); |
||
17825 | } |
||
17826 | |||
17827 | NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17828 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17829 | return Create(Ctx, I); |
||
17830 | } |
||
17831 | |||
17832 | NoThreadSafetyAnalysisAttr::NoThreadSafetyAnalysisAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17833 | ) |
||
17834 | : InheritableAttr(Ctx, CommonInfo, attr::NoThreadSafetyAnalysis, false, false) |
||
17835 | { |
||
17836 | } |
||
17837 | |||
17838 | NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::clone(ASTContext &C) const { |
||
17839 | auto *A = new (C) NoThreadSafetyAnalysisAttr(C, *this); |
||
17840 | A->Inherited = Inherited; |
||
17841 | A->IsPackExpansion = IsPackExpansion; |
||
17842 | A->setImplicit(Implicit); |
||
17843 | return A; |
||
17844 | } |
||
17845 | |||
17846 | void NoThreadSafetyAnalysisAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17847 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17848 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17849 | switch (getAttributeSpellingListIndex()) { |
||
17850 | default: |
||
17851 | llvm_unreachable("Unknown attribute spelling!"); |
||
17852 | break; |
||
17853 | case 0 : { |
||
17854 | OS << " __attribute__((no_thread_safety_analysis"; |
||
17855 | OS << "))"; |
||
17856 | break; |
||
17857 | } |
||
17858 | case 1 : { |
||
17859 | OS << " [[clang::no_thread_safety_analysis"; |
||
17860 | OS << "]]"; |
||
17861 | break; |
||
17862 | } |
||
17863 | case 2 : { |
||
17864 | OS << " [[clang::no_thread_safety_analysis"; |
||
17865 | OS << "]]"; |
||
17866 | break; |
||
17867 | } |
||
17868 | } |
||
17869 | } |
||
17870 | |||
17871 | const char *NoThreadSafetyAnalysisAttr::getSpelling() const { |
||
17872 | switch (getAttributeSpellingListIndex()) { |
||
17873 | default: |
||
17874 | llvm_unreachable("Unknown attribute spelling!"); |
||
17875 | return "(No spelling)"; |
||
17876 | case 0: |
||
17877 | return "no_thread_safety_analysis"; |
||
17878 | case 1: |
||
17879 | return "no_thread_safety_analysis"; |
||
17880 | case 2: |
||
17881 | return "no_thread_safety_analysis"; |
||
17882 | } |
||
17883 | } |
||
17884 | |||
17885 | |||
17886 | // NoThrowAttr implementation |
||
17887 | |||
17888 | NoThrowAttr *NoThrowAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17889 | auto *A = new (Ctx) NoThrowAttr(Ctx, CommonInfo); |
||
17890 | A->setImplicit(true); |
||
17891 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17892 | A->setAttributeSpellingListIndex(0); |
||
17893 | return A; |
||
17894 | } |
||
17895 | |||
17896 | NoThrowAttr *NoThrowAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17897 | auto *A = new (Ctx) NoThrowAttr(Ctx, CommonInfo); |
||
17898 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17899 | A->setAttributeSpellingListIndex(0); |
||
17900 | return A; |
||
17901 | } |
||
17902 | |||
17903 | NoThrowAttr *NoThrowAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17904 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17905 | return CreateImplicit(Ctx, I); |
||
17906 | } |
||
17907 | |||
17908 | NoThrowAttr *NoThrowAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17909 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17910 | return Create(Ctx, I); |
||
17911 | } |
||
17912 | |||
17913 | NoThrowAttr::NoThrowAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
17914 | ) |
||
17915 | : InheritableAttr(Ctx, CommonInfo, attr::NoThrow, false, false) |
||
17916 | { |
||
17917 | } |
||
17918 | |||
17919 | NoThrowAttr *NoThrowAttr::clone(ASTContext &C) const { |
||
17920 | auto *A = new (C) NoThrowAttr(C, *this); |
||
17921 | A->Inherited = Inherited; |
||
17922 | A->IsPackExpansion = IsPackExpansion; |
||
17923 | A->setImplicit(Implicit); |
||
17924 | return A; |
||
17925 | } |
||
17926 | |||
17927 | void NoThrowAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
17928 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
17929 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
17930 | switch (getAttributeSpellingListIndex()) { |
||
17931 | default: |
||
17932 | llvm_unreachable("Unknown attribute spelling!"); |
||
17933 | break; |
||
17934 | case 0 : { |
||
17935 | OS << " __attribute__((nothrow"; |
||
17936 | OS << "))"; |
||
17937 | break; |
||
17938 | } |
||
17939 | case 1 : { |
||
17940 | OS << " [[gnu::nothrow"; |
||
17941 | OS << "]]"; |
||
17942 | break; |
||
17943 | } |
||
17944 | case 2 : { |
||
17945 | OS << " [[gnu::nothrow"; |
||
17946 | OS << "]]"; |
||
17947 | break; |
||
17948 | } |
||
17949 | case 3 : { |
||
17950 | OS << " __declspec(nothrow"; |
||
17951 | OS << ")"; |
||
17952 | break; |
||
17953 | } |
||
17954 | } |
||
17955 | } |
||
17956 | |||
17957 | const char *NoThrowAttr::getSpelling() const { |
||
17958 | switch (getAttributeSpellingListIndex()) { |
||
17959 | default: |
||
17960 | llvm_unreachable("Unknown attribute spelling!"); |
||
17961 | return "(No spelling)"; |
||
17962 | case 0: |
||
17963 | return "nothrow"; |
||
17964 | case 1: |
||
17965 | return "nothrow"; |
||
17966 | case 2: |
||
17967 | return "nothrow"; |
||
17968 | case 3: |
||
17969 | return "nothrow"; |
||
17970 | } |
||
17971 | } |
||
17972 | |||
17973 | |||
17974 | // NoUniqueAddressAttr implementation |
||
17975 | |||
17976 | NoUniqueAddressAttr *NoUniqueAddressAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17977 | auto *A = new (Ctx) NoUniqueAddressAttr(Ctx, CommonInfo); |
||
17978 | A->setImplicit(true); |
||
17979 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17980 | A->setAttributeSpellingListIndex(0); |
||
17981 | return A; |
||
17982 | } |
||
17983 | |||
17984 | NoUniqueAddressAttr *NoUniqueAddressAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
17985 | auto *A = new (Ctx) NoUniqueAddressAttr(Ctx, CommonInfo); |
||
17986 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
17987 | A->setAttributeSpellingListIndex(0); |
||
17988 | return A; |
||
17989 | } |
||
17990 | |||
17991 | NoUniqueAddressAttr *NoUniqueAddressAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17992 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17993 | return CreateImplicit(Ctx, I); |
||
17994 | } |
||
17995 | |||
17996 | NoUniqueAddressAttr *NoUniqueAddressAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
17997 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
17998 | return Create(Ctx, I); |
||
17999 | } |
||
18000 | |||
18001 | NoUniqueAddressAttr::NoUniqueAddressAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18002 | ) |
||
18003 | : InheritableAttr(Ctx, CommonInfo, attr::NoUniqueAddress, false, false) |
||
18004 | { |
||
18005 | } |
||
18006 | |||
18007 | NoUniqueAddressAttr *NoUniqueAddressAttr::clone(ASTContext &C) const { |
||
18008 | auto *A = new (C) NoUniqueAddressAttr(C, *this); |
||
18009 | A->Inherited = Inherited; |
||
18010 | A->IsPackExpansion = IsPackExpansion; |
||
18011 | A->setImplicit(Implicit); |
||
18012 | return A; |
||
18013 | } |
||
18014 | |||
18015 | void NoUniqueAddressAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18016 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
18017 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
18018 | switch (getAttributeSpellingListIndex()) { |
||
18019 | default: |
||
18020 | llvm_unreachable("Unknown attribute spelling!"); |
||
18021 | break; |
||
18022 | case 0 : { |
||
18023 | OS << " [[no_unique_address"; |
||
18024 | OS << "]]"; |
||
18025 | break; |
||
18026 | } |
||
18027 | } |
||
18028 | } |
||
18029 | |||
18030 | const char *NoUniqueAddressAttr::getSpelling() const { |
||
18031 | switch (getAttributeSpellingListIndex()) { |
||
18032 | default: |
||
18033 | llvm_unreachable("Unknown attribute spelling!"); |
||
18034 | return "(No spelling)"; |
||
18035 | case 0: |
||
18036 | return "no_unique_address"; |
||
18037 | } |
||
18038 | } |
||
18039 | |||
18040 | |||
18041 | // NoUwtableAttr implementation |
||
18042 | |||
18043 | NoUwtableAttr *NoUwtableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
18044 | auto *A = new (Ctx) NoUwtableAttr(Ctx, CommonInfo); |
||
18045 | A->setImplicit(true); |
||
18046 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18047 | A->setAttributeSpellingListIndex(0); |
||
18048 | return A; |
||
18049 | } |
||
18050 | |||
18051 | NoUwtableAttr *NoUwtableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
18052 | auto *A = new (Ctx) NoUwtableAttr(Ctx, CommonInfo); |
||
18053 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18054 | A->setAttributeSpellingListIndex(0); |
||
18055 | return A; |
||
18056 | } |
||
18057 | |||
18058 | NoUwtableAttr *NoUwtableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18059 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18060 | return CreateImplicit(Ctx, I); |
||
18061 | } |
||
18062 | |||
18063 | NoUwtableAttr *NoUwtableAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18064 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18065 | return Create(Ctx, I); |
||
18066 | } |
||
18067 | |||
18068 | NoUwtableAttr::NoUwtableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18069 | ) |
||
18070 | : InheritableAttr(Ctx, CommonInfo, attr::NoUwtable, false, false) |
||
18071 | { |
||
18072 | } |
||
18073 | |||
18074 | NoUwtableAttr *NoUwtableAttr::clone(ASTContext &C) const { |
||
18075 | auto *A = new (C) NoUwtableAttr(C, *this); |
||
18076 | A->Inherited = Inherited; |
||
18077 | A->IsPackExpansion = IsPackExpansion; |
||
18078 | A->setImplicit(Implicit); |
||
18079 | return A; |
||
18080 | } |
||
18081 | |||
18082 | void NoUwtableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18083 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
18084 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
18085 | switch (getAttributeSpellingListIndex()) { |
||
18086 | default: |
||
18087 | llvm_unreachable("Unknown attribute spelling!"); |
||
18088 | break; |
||
18089 | case 0 : { |
||
18090 | OS << " __attribute__((nouwtable"; |
||
18091 | OS << "))"; |
||
18092 | break; |
||
18093 | } |
||
18094 | case 1 : { |
||
18095 | OS << " [[clang::nouwtable"; |
||
18096 | OS << "]]"; |
||
18097 | break; |
||
18098 | } |
||
18099 | case 2 : { |
||
18100 | OS << " [[clang::nouwtable"; |
||
18101 | OS << "]]"; |
||
18102 | break; |
||
18103 | } |
||
18104 | } |
||
18105 | } |
||
18106 | |||
18107 | const char *NoUwtableAttr::getSpelling() const { |
||
18108 | switch (getAttributeSpellingListIndex()) { |
||
18109 | default: |
||
18110 | llvm_unreachable("Unknown attribute spelling!"); |
||
18111 | return "(No spelling)"; |
||
18112 | case 0: |
||
18113 | return "nouwtable"; |
||
18114 | case 1: |
||
18115 | return "nouwtable"; |
||
18116 | case 2: |
||
18117 | return "nouwtable"; |
||
18118 | } |
||
18119 | } |
||
18120 | |||
18121 | |||
18122 | // NonNullAttr implementation |
||
18123 | |||
18124 | NonNullAttr *NonNullAttr::CreateImplicit(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
18125 | auto *A = new (Ctx) NonNullAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
18126 | A->setImplicit(true); |
||
18127 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18128 | A->setAttributeSpellingListIndex(0); |
||
18129 | return A; |
||
18130 | } |
||
18131 | |||
18132 | NonNullAttr *NonNullAttr::Create(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
18133 | auto *A = new (Ctx) NonNullAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
18134 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18135 | A->setAttributeSpellingListIndex(0); |
||
18136 | return A; |
||
18137 | } |
||
18138 | |||
18139 | NonNullAttr *NonNullAttr::CreateImplicit(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18140 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18141 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
18142 | } |
||
18143 | |||
18144 | NonNullAttr *NonNullAttr::Create(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18145 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18146 | return Create(Ctx, Args, ArgsSize, I); |
||
18147 | } |
||
18148 | |||
18149 | NonNullAttr::NonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18150 | , ParamIdx *Args, unsigned ArgsSize |
||
18151 | ) |
||
18152 | : InheritableParamAttr(Ctx, CommonInfo, attr::NonNull, false, true) |
||
18153 | , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size]) |
||
18154 | { |
||
18155 | std::copy(Args, Args + args_Size, args_); |
||
18156 | } |
||
18157 | |||
18158 | NonNullAttr::NonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18159 | ) |
||
18160 | : InheritableParamAttr(Ctx, CommonInfo, attr::NonNull, false, true) |
||
18161 | , args_Size(0), args_(nullptr) |
||
18162 | { |
||
18163 | } |
||
18164 | |||
18165 | |||
18166 | |||
18167 | NonNullAttr *NonNullAttr::clone(ASTContext &C) const { |
||
18168 | auto *A = new (C) NonNullAttr(C, *this, args_, args_Size); |
||
18169 | A->Inherited = Inherited; |
||
18170 | A->IsPackExpansion = IsPackExpansion; |
||
18171 | A->setImplicit(Implicit); |
||
18172 | return A; |
||
18173 | } |
||
18174 | |||
18175 | void NonNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18176 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
18177 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
18178 | switch (getAttributeSpellingListIndex()) { |
||
18179 | default: |
||
18180 | llvm_unreachable("Unknown attribute spelling!"); |
||
18181 | break; |
||
18182 | case 0 : { |
||
18183 | OS << " __attribute__((nonnull"; |
||
18184 | OS << ""; |
||
18185 | for (const auto &Val : args()) { |
||
18186 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
18187 | OS << Val.getSourceIndex(); |
||
18188 | } |
||
18189 | OS << ""; |
||
18190 | if (!IsFirstArgument) |
||
18191 | OS << ")"; |
||
18192 | OS << "))"; |
||
18193 | break; |
||
18194 | } |
||
18195 | case 1 : { |
||
18196 | OS << " [[gnu::nonnull"; |
||
18197 | OS << ""; |
||
18198 | for (const auto &Val : args()) { |
||
18199 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
18200 | OS << Val.getSourceIndex(); |
||
18201 | } |
||
18202 | OS << ""; |
||
18203 | if (!IsFirstArgument) |
||
18204 | OS << ")"; |
||
18205 | OS << "]]"; |
||
18206 | break; |
||
18207 | } |
||
18208 | case 2 : { |
||
18209 | OS << " [[gnu::nonnull"; |
||
18210 | OS << ""; |
||
18211 | for (const auto &Val : args()) { |
||
18212 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
18213 | OS << Val.getSourceIndex(); |
||
18214 | } |
||
18215 | OS << ""; |
||
18216 | if (!IsFirstArgument) |
||
18217 | OS << ")"; |
||
18218 | OS << "]]"; |
||
18219 | break; |
||
18220 | } |
||
18221 | } |
||
18222 | } |
||
18223 | |||
18224 | const char *NonNullAttr::getSpelling() const { |
||
18225 | switch (getAttributeSpellingListIndex()) { |
||
18226 | default: |
||
18227 | llvm_unreachable("Unknown attribute spelling!"); |
||
18228 | return "(No spelling)"; |
||
18229 | case 0: |
||
18230 | return "nonnull"; |
||
18231 | case 1: |
||
18232 | return "nonnull"; |
||
18233 | case 2: |
||
18234 | return "nonnull"; |
||
18235 | } |
||
18236 | } |
||
18237 | |||
18238 | |||
18239 | // NotTailCalledAttr implementation |
||
18240 | |||
18241 | NotTailCalledAttr *NotTailCalledAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
18242 | auto *A = new (Ctx) NotTailCalledAttr(Ctx, CommonInfo); |
||
18243 | A->setImplicit(true); |
||
18244 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18245 | A->setAttributeSpellingListIndex(0); |
||
18246 | return A; |
||
18247 | } |
||
18248 | |||
18249 | NotTailCalledAttr *NotTailCalledAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
18250 | auto *A = new (Ctx) NotTailCalledAttr(Ctx, CommonInfo); |
||
18251 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18252 | A->setAttributeSpellingListIndex(0); |
||
18253 | return A; |
||
18254 | } |
||
18255 | |||
18256 | NotTailCalledAttr *NotTailCalledAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18257 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18258 | return CreateImplicit(Ctx, I); |
||
18259 | } |
||
18260 | |||
18261 | NotTailCalledAttr *NotTailCalledAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18262 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18263 | return Create(Ctx, I); |
||
18264 | } |
||
18265 | |||
18266 | NotTailCalledAttr::NotTailCalledAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18267 | ) |
||
18268 | : InheritableAttr(Ctx, CommonInfo, attr::NotTailCalled, false, false) |
||
18269 | { |
||
18270 | } |
||
18271 | |||
18272 | NotTailCalledAttr *NotTailCalledAttr::clone(ASTContext &C) const { |
||
18273 | auto *A = new (C) NotTailCalledAttr(C, *this); |
||
18274 | A->Inherited = Inherited; |
||
18275 | A->IsPackExpansion = IsPackExpansion; |
||
18276 | A->setImplicit(Implicit); |
||
18277 | return A; |
||
18278 | } |
||
18279 | |||
18280 | void NotTailCalledAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18281 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
18282 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
18283 | switch (getAttributeSpellingListIndex()) { |
||
18284 | default: |
||
18285 | llvm_unreachable("Unknown attribute spelling!"); |
||
18286 | break; |
||
18287 | case 0 : { |
||
18288 | OS << " __attribute__((not_tail_called"; |
||
18289 | OS << "))"; |
||
18290 | break; |
||
18291 | } |
||
18292 | case 1 : { |
||
18293 | OS << " [[clang::not_tail_called"; |
||
18294 | OS << "]]"; |
||
18295 | break; |
||
18296 | } |
||
18297 | case 2 : { |
||
18298 | OS << " [[clang::not_tail_called"; |
||
18299 | OS << "]]"; |
||
18300 | break; |
||
18301 | } |
||
18302 | } |
||
18303 | } |
||
18304 | |||
18305 | const char *NotTailCalledAttr::getSpelling() const { |
||
18306 | switch (getAttributeSpellingListIndex()) { |
||
18307 | default: |
||
18308 | llvm_unreachable("Unknown attribute spelling!"); |
||
18309 | return "(No spelling)"; |
||
18310 | case 0: |
||
18311 | return "not_tail_called"; |
||
18312 | case 1: |
||
18313 | return "not_tail_called"; |
||
18314 | case 2: |
||
18315 | return "not_tail_called"; |
||
18316 | } |
||
18317 | } |
||
18318 | |||
18319 | |||
18320 | // OMPAllocateDeclAttr implementation |
||
18321 | |||
18322 | OMPAllocateDeclAttr *OMPAllocateDeclAttr::CreateImplicit(ASTContext &Ctx, AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { |
||
18323 | auto *A = new (Ctx) OMPAllocateDeclAttr(Ctx, CommonInfo, AllocatorType, Allocator, Alignment); |
||
18324 | A->setImplicit(true); |
||
18325 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18326 | A->setAttributeSpellingListIndex(0); |
||
18327 | return A; |
||
18328 | } |
||
18329 | |||
18330 | OMPAllocateDeclAttr *OMPAllocateDeclAttr::Create(ASTContext &Ctx, AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { |
||
18331 | auto *A = new (Ctx) OMPAllocateDeclAttr(Ctx, CommonInfo, AllocatorType, Allocator, Alignment); |
||
18332 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18333 | A->setAttributeSpellingListIndex(0); |
||
18334 | return A; |
||
18335 | } |
||
18336 | |||
18337 | OMPAllocateDeclAttr *OMPAllocateDeclAttr::CreateImplicit(ASTContext &Ctx, AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18338 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18339 | return CreateImplicit(Ctx, AllocatorType, Allocator, Alignment, I); |
||
18340 | } |
||
18341 | |||
18342 | OMPAllocateDeclAttr *OMPAllocateDeclAttr::Create(ASTContext &Ctx, AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18343 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18344 | return Create(Ctx, AllocatorType, Allocator, Alignment, I); |
||
18345 | } |
||
18346 | |||
18347 | OMPAllocateDeclAttr::OMPAllocateDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18348 | , AllocatorTypeTy AllocatorType |
||
18349 | , Expr * Allocator |
||
18350 | , Expr * Alignment |
||
18351 | ) |
||
18352 | : InheritableAttr(Ctx, CommonInfo, attr::OMPAllocateDecl, false, false) |
||
18353 | , allocatorType(AllocatorType) |
||
18354 | , allocator(Allocator) |
||
18355 | , alignment(Alignment) |
||
18356 | { |
||
18357 | } |
||
18358 | |||
18359 | |||
18360 | |||
18361 | bool OMPAllocateDeclAttr::ConvertStrToAllocatorTypeTy(StringRef Val, AllocatorTypeTy &Out) { |
||
18362 | std::optional<AllocatorTypeTy> R = llvm::StringSwitch<std::optional<AllocatorTypeTy>>(Val) |
||
18363 | .Case("omp_null_allocator", OMPAllocateDeclAttr::OMPNullMemAlloc) |
||
18364 | .Case("omp_default_mem_alloc", OMPAllocateDeclAttr::OMPDefaultMemAlloc) |
||
18365 | .Case("omp_large_cap_mem_alloc", OMPAllocateDeclAttr::OMPLargeCapMemAlloc) |
||
18366 | .Case("omp_const_mem_alloc", OMPAllocateDeclAttr::OMPConstMemAlloc) |
||
18367 | .Case("omp_high_bw_mem_alloc", OMPAllocateDeclAttr::OMPHighBWMemAlloc) |
||
18368 | .Case("omp_low_lat_mem_alloc", OMPAllocateDeclAttr::OMPLowLatMemAlloc) |
||
18369 | .Case("omp_cgroup_mem_alloc", OMPAllocateDeclAttr::OMPCGroupMemAlloc) |
||
18370 | .Case("omp_pteam_mem_alloc", OMPAllocateDeclAttr::OMPPTeamMemAlloc) |
||
18371 | .Case("omp_thread_mem_alloc", OMPAllocateDeclAttr::OMPThreadMemAlloc) |
||
18372 | .Case("", OMPAllocateDeclAttr::OMPUserDefinedMemAlloc) |
||
18373 | .Default(std::optional<AllocatorTypeTy>()); |
||
18374 | if (R) { |
||
18375 | Out = *R; |
||
18376 | return true; |
||
18377 | } |
||
18378 | return false; |
||
18379 | } |
||
18380 | |||
18381 | const char *OMPAllocateDeclAttr::ConvertAllocatorTypeTyToStr(AllocatorTypeTy Val) { |
||
18382 | switch(Val) { |
||
18383 | case OMPAllocateDeclAttr::OMPNullMemAlloc: return "omp_null_allocator"; |
||
18384 | case OMPAllocateDeclAttr::OMPDefaultMemAlloc: return "omp_default_mem_alloc"; |
||
18385 | case OMPAllocateDeclAttr::OMPLargeCapMemAlloc: return "omp_large_cap_mem_alloc"; |
||
18386 | case OMPAllocateDeclAttr::OMPConstMemAlloc: return "omp_const_mem_alloc"; |
||
18387 | case OMPAllocateDeclAttr::OMPHighBWMemAlloc: return "omp_high_bw_mem_alloc"; |
||
18388 | case OMPAllocateDeclAttr::OMPLowLatMemAlloc: return "omp_low_lat_mem_alloc"; |
||
18389 | case OMPAllocateDeclAttr::OMPCGroupMemAlloc: return "omp_cgroup_mem_alloc"; |
||
18390 | case OMPAllocateDeclAttr::OMPPTeamMemAlloc: return "omp_pteam_mem_alloc"; |
||
18391 | case OMPAllocateDeclAttr::OMPThreadMemAlloc: return "omp_thread_mem_alloc"; |
||
18392 | case OMPAllocateDeclAttr::OMPUserDefinedMemAlloc: return ""; |
||
18393 | } |
||
18394 | llvm_unreachable("No enumerator with that value"); |
||
18395 | } |
||
18396 | |||
18397 | |||
18398 | |||
18399 | |||
18400 | OMPAllocateDeclAttr *OMPAllocateDeclAttr::clone(ASTContext &C) const { |
||
18401 | auto *A = new (C) OMPAllocateDeclAttr(C, *this, allocatorType, allocator, alignment); |
||
18402 | A->Inherited = Inherited; |
||
18403 | A->IsPackExpansion = IsPackExpansion; |
||
18404 | A->setImplicit(Implicit); |
||
18405 | return A; |
||
18406 | } |
||
18407 | |||
18408 | void OMPAllocateDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18409 | } |
||
18410 | |||
18411 | const char *OMPAllocateDeclAttr::getSpelling() const { |
||
18412 | return "(No spelling)"; |
||
18413 | } |
||
18414 | |||
18415 | |||
18416 | // OMPCaptureKindAttr implementation |
||
18417 | |||
18418 | OMPCaptureKindAttr *OMPCaptureKindAttr::CreateImplicit(ASTContext &Ctx, unsigned CaptureKindVal, const AttributeCommonInfo &CommonInfo) { |
||
18419 | auto *A = new (Ctx) OMPCaptureKindAttr(Ctx, CommonInfo, CaptureKindVal); |
||
18420 | A->setImplicit(true); |
||
18421 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18422 | A->setAttributeSpellingListIndex(0); |
||
18423 | return A; |
||
18424 | } |
||
18425 | |||
18426 | OMPCaptureKindAttr *OMPCaptureKindAttr::Create(ASTContext &Ctx, unsigned CaptureKindVal, const AttributeCommonInfo &CommonInfo) { |
||
18427 | auto *A = new (Ctx) OMPCaptureKindAttr(Ctx, CommonInfo, CaptureKindVal); |
||
18428 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18429 | A->setAttributeSpellingListIndex(0); |
||
18430 | return A; |
||
18431 | } |
||
18432 | |||
18433 | OMPCaptureKindAttr *OMPCaptureKindAttr::CreateImplicit(ASTContext &Ctx, unsigned CaptureKindVal, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18434 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18435 | return CreateImplicit(Ctx, CaptureKindVal, I); |
||
18436 | } |
||
18437 | |||
18438 | OMPCaptureKindAttr *OMPCaptureKindAttr::Create(ASTContext &Ctx, unsigned CaptureKindVal, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18439 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18440 | return Create(Ctx, CaptureKindVal, I); |
||
18441 | } |
||
18442 | |||
18443 | OMPCaptureKindAttr::OMPCaptureKindAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18444 | , unsigned CaptureKindVal |
||
18445 | ) |
||
18446 | : Attr(Ctx, CommonInfo, attr::OMPCaptureKind, false) |
||
18447 | , captureKindVal(CaptureKindVal) |
||
18448 | { |
||
18449 | } |
||
18450 | |||
18451 | |||
18452 | |||
18453 | OMPCaptureKindAttr *OMPCaptureKindAttr::clone(ASTContext &C) const { |
||
18454 | auto *A = new (C) OMPCaptureKindAttr(C, *this, captureKindVal); |
||
18455 | A->Inherited = Inherited; |
||
18456 | A->IsPackExpansion = IsPackExpansion; |
||
18457 | A->setImplicit(Implicit); |
||
18458 | return A; |
||
18459 | } |
||
18460 | |||
18461 | void OMPCaptureKindAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18462 | } |
||
18463 | |||
18464 | const char *OMPCaptureKindAttr::getSpelling() const { |
||
18465 | return "(No spelling)"; |
||
18466 | } |
||
18467 | |||
18468 | |||
18469 | // OMPCaptureNoInitAttr implementation |
||
18470 | |||
18471 | OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
18472 | auto *A = new (Ctx) OMPCaptureNoInitAttr(Ctx, CommonInfo); |
||
18473 | A->setImplicit(true); |
||
18474 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18475 | A->setAttributeSpellingListIndex(0); |
||
18476 | return A; |
||
18477 | } |
||
18478 | |||
18479 | OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
18480 | auto *A = new (Ctx) OMPCaptureNoInitAttr(Ctx, CommonInfo); |
||
18481 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18482 | A->setAttributeSpellingListIndex(0); |
||
18483 | return A; |
||
18484 | } |
||
18485 | |||
18486 | OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18487 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18488 | return CreateImplicit(Ctx, I); |
||
18489 | } |
||
18490 | |||
18491 | OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18492 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18493 | return Create(Ctx, I); |
||
18494 | } |
||
18495 | |||
18496 | OMPCaptureNoInitAttr::OMPCaptureNoInitAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18497 | ) |
||
18498 | : InheritableAttr(Ctx, CommonInfo, attr::OMPCaptureNoInit, false, false) |
||
18499 | { |
||
18500 | } |
||
18501 | |||
18502 | OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::clone(ASTContext &C) const { |
||
18503 | auto *A = new (C) OMPCaptureNoInitAttr(C, *this); |
||
18504 | A->Inherited = Inherited; |
||
18505 | A->IsPackExpansion = IsPackExpansion; |
||
18506 | A->setImplicit(Implicit); |
||
18507 | return A; |
||
18508 | } |
||
18509 | |||
18510 | void OMPCaptureNoInitAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18511 | } |
||
18512 | |||
18513 | const char *OMPCaptureNoInitAttr::getSpelling() const { |
||
18514 | return "(No spelling)"; |
||
18515 | } |
||
18516 | |||
18517 | |||
18518 | // OMPDeclareSimdDeclAttr implementation |
||
18519 | |||
18520 | OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::CreateImplicit(ASTContext &Ctx, BranchStateTy BranchState, Expr * Simdlen, Expr * *Uniforms, unsigned UniformsSize, Expr * *Aligneds, unsigned AlignedsSize, Expr * *Alignments, unsigned AlignmentsSize, Expr * *Linears, unsigned LinearsSize, unsigned *Modifiers, unsigned ModifiersSize, Expr * *Steps, unsigned StepsSize, const AttributeCommonInfo &CommonInfo) { |
||
18521 | auto *A = new (Ctx) OMPDeclareSimdDeclAttr(Ctx, CommonInfo, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize); |
||
18522 | A->setImplicit(true); |
||
18523 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18524 | A->setAttributeSpellingListIndex(0); |
||
18525 | return A; |
||
18526 | } |
||
18527 | |||
18528 | OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::Create(ASTContext &Ctx, BranchStateTy BranchState, Expr * Simdlen, Expr * *Uniforms, unsigned UniformsSize, Expr * *Aligneds, unsigned AlignedsSize, Expr * *Alignments, unsigned AlignmentsSize, Expr * *Linears, unsigned LinearsSize, unsigned *Modifiers, unsigned ModifiersSize, Expr * *Steps, unsigned StepsSize, const AttributeCommonInfo &CommonInfo) { |
||
18529 | auto *A = new (Ctx) OMPDeclareSimdDeclAttr(Ctx, CommonInfo, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize); |
||
18530 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18531 | A->setAttributeSpellingListIndex(0); |
||
18532 | return A; |
||
18533 | } |
||
18534 | |||
18535 | OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::CreateImplicit(ASTContext &Ctx, BranchStateTy BranchState, Expr * Simdlen, Expr * *Uniforms, unsigned UniformsSize, Expr * *Aligneds, unsigned AlignedsSize, Expr * *Alignments, unsigned AlignmentsSize, Expr * *Linears, unsigned LinearsSize, unsigned *Modifiers, unsigned ModifiersSize, Expr * *Steps, unsigned StepsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18536 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18537 | return CreateImplicit(Ctx, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize, I); |
||
18538 | } |
||
18539 | |||
18540 | OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::Create(ASTContext &Ctx, BranchStateTy BranchState, Expr * Simdlen, Expr * *Uniforms, unsigned UniformsSize, Expr * *Aligneds, unsigned AlignedsSize, Expr * *Alignments, unsigned AlignmentsSize, Expr * *Linears, unsigned LinearsSize, unsigned *Modifiers, unsigned ModifiersSize, Expr * *Steps, unsigned StepsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18541 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18542 | return Create(Ctx, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize, I); |
||
18543 | } |
||
18544 | |||
18545 | OMPDeclareSimdDeclAttr::OMPDeclareSimdDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18546 | , BranchStateTy BranchState |
||
18547 | , Expr * Simdlen |
||
18548 | , Expr * *Uniforms, unsigned UniformsSize |
||
18549 | , Expr * *Aligneds, unsigned AlignedsSize |
||
18550 | , Expr * *Alignments, unsigned AlignmentsSize |
||
18551 | , Expr * *Linears, unsigned LinearsSize |
||
18552 | , unsigned *Modifiers, unsigned ModifiersSize |
||
18553 | , Expr * *Steps, unsigned StepsSize |
||
18554 | ) |
||
18555 | : Attr(Ctx, CommonInfo, attr::OMPDeclareSimdDecl, false) |
||
18556 | , branchState(BranchState) |
||
18557 | , simdlen(Simdlen) |
||
18558 | , uniforms_Size(UniformsSize), uniforms_(new (Ctx, 16) Expr *[uniforms_Size]) |
||
18559 | , aligneds_Size(AlignedsSize), aligneds_(new (Ctx, 16) Expr *[aligneds_Size]) |
||
18560 | , alignments_Size(AlignmentsSize), alignments_(new (Ctx, 16) Expr *[alignments_Size]) |
||
18561 | , linears_Size(LinearsSize), linears_(new (Ctx, 16) Expr *[linears_Size]) |
||
18562 | , modifiers_Size(ModifiersSize), modifiers_(new (Ctx, 16) unsigned[modifiers_Size]) |
||
18563 | , steps_Size(StepsSize), steps_(new (Ctx, 16) Expr *[steps_Size]) |
||
18564 | { |
||
18565 | std::copy(Uniforms, Uniforms + uniforms_Size, uniforms_); |
||
18566 | std::copy(Aligneds, Aligneds + aligneds_Size, aligneds_); |
||
18567 | std::copy(Alignments, Alignments + alignments_Size, alignments_); |
||
18568 | std::copy(Linears, Linears + linears_Size, linears_); |
||
18569 | std::copy(Modifiers, Modifiers + modifiers_Size, modifiers_); |
||
18570 | std::copy(Steps, Steps + steps_Size, steps_); |
||
18571 | } |
||
18572 | |||
18573 | OMPDeclareSimdDeclAttr::OMPDeclareSimdDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18574 | , BranchStateTy BranchState |
||
18575 | , Expr * Simdlen |
||
18576 | ) |
||
18577 | : Attr(Ctx, CommonInfo, attr::OMPDeclareSimdDecl, false) |
||
18578 | , branchState(BranchState) |
||
18579 | , simdlen(Simdlen) |
||
18580 | , uniforms_Size(0), uniforms_(nullptr) |
||
18581 | , aligneds_Size(0), aligneds_(nullptr) |
||
18582 | , alignments_Size(0), alignments_(nullptr) |
||
18583 | , linears_Size(0), linears_(nullptr) |
||
18584 | , modifiers_Size(0), modifiers_(nullptr) |
||
18585 | , steps_Size(0), steps_(nullptr) |
||
18586 | { |
||
18587 | } |
||
18588 | |||
18589 | |||
18590 | |||
18591 | bool OMPDeclareSimdDeclAttr::ConvertStrToBranchStateTy(StringRef Val, BranchStateTy &Out) { |
||
18592 | std::optional<BranchStateTy> R = llvm::StringSwitch<std::optional<BranchStateTy>>(Val) |
||
18593 | .Case("", OMPDeclareSimdDeclAttr::BS_Undefined) |
||
18594 | .Case("inbranch", OMPDeclareSimdDeclAttr::BS_Inbranch) |
||
18595 | .Case("notinbranch", OMPDeclareSimdDeclAttr::BS_Notinbranch) |
||
18596 | .Default(std::optional<BranchStateTy>()); |
||
18597 | if (R) { |
||
18598 | Out = *R; |
||
18599 | return true; |
||
18600 | } |
||
18601 | return false; |
||
18602 | } |
||
18603 | |||
18604 | const char *OMPDeclareSimdDeclAttr::ConvertBranchStateTyToStr(BranchStateTy Val) { |
||
18605 | switch(Val) { |
||
18606 | case OMPDeclareSimdDeclAttr::BS_Undefined: return ""; |
||
18607 | case OMPDeclareSimdDeclAttr::BS_Inbranch: return "inbranch"; |
||
18608 | case OMPDeclareSimdDeclAttr::BS_Notinbranch: return "notinbranch"; |
||
18609 | } |
||
18610 | llvm_unreachable("No enumerator with that value"); |
||
18611 | } |
||
18612 | |||
18613 | |||
18614 | |||
18615 | |||
18616 | |||
18617 | |||
18618 | |||
18619 | |||
18620 | |||
18621 | |||
18622 | |||
18623 | |||
18624 | |||
18625 | |||
18626 | OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::clone(ASTContext &C) const { |
||
18627 | auto *A = new (C) OMPDeclareSimdDeclAttr(C, *this, branchState, simdlen, uniforms_, uniforms_Size, aligneds_, aligneds_Size, alignments_, alignments_Size, linears_, linears_Size, modifiers_, modifiers_Size, steps_, steps_Size); |
||
18628 | A->Inherited = Inherited; |
||
18629 | A->IsPackExpansion = IsPackExpansion; |
||
18630 | A->setImplicit(Implicit); |
||
18631 | return A; |
||
18632 | } |
||
18633 | |||
18634 | void OMPDeclareSimdDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18635 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
18636 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
18637 | switch (getAttributeSpellingListIndex()) { |
||
18638 | default: |
||
18639 | llvm_unreachable("Unknown attribute spelling!"); |
||
18640 | break; |
||
18641 | case 0 : { |
||
18642 | OS << "#pragma omp declare simd"; |
||
18643 | printPrettyPragma(OS, Policy); |
||
18644 | OS << "\n"; break; |
||
18645 | } |
||
18646 | } |
||
18647 | } |
||
18648 | |||
18649 | const char *OMPDeclareSimdDeclAttr::getSpelling() const { |
||
18650 | switch (getAttributeSpellingListIndex()) { |
||
18651 | default: |
||
18652 | llvm_unreachable("Unknown attribute spelling!"); |
||
18653 | return "(No spelling)"; |
||
18654 | case 0: |
||
18655 | return "declare simd"; |
||
18656 | } |
||
18657 | } |
||
18658 | |||
18659 | |||
18660 | // OMPDeclareTargetDeclAttr implementation |
||
18661 | |||
18662 | OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::CreateImplicit(ASTContext &Ctx, MapTypeTy MapType, DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, const AttributeCommonInfo &CommonInfo) { |
||
18663 | auto *A = new (Ctx) OMPDeclareTargetDeclAttr(Ctx, CommonInfo, MapType, DevType, IndirectExpr, Indirect, Level); |
||
18664 | A->setImplicit(true); |
||
18665 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18666 | A->setAttributeSpellingListIndex(0); |
||
18667 | return A; |
||
18668 | } |
||
18669 | |||
18670 | OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::Create(ASTContext &Ctx, MapTypeTy MapType, DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, const AttributeCommonInfo &CommonInfo) { |
||
18671 | auto *A = new (Ctx) OMPDeclareTargetDeclAttr(Ctx, CommonInfo, MapType, DevType, IndirectExpr, Indirect, Level); |
||
18672 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18673 | A->setAttributeSpellingListIndex(0); |
||
18674 | return A; |
||
18675 | } |
||
18676 | |||
18677 | OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::CreateImplicit(ASTContext &Ctx, MapTypeTy MapType, DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18678 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18679 | return CreateImplicit(Ctx, MapType, DevType, IndirectExpr, Indirect, Level, I); |
||
18680 | } |
||
18681 | |||
18682 | OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::Create(ASTContext &Ctx, MapTypeTy MapType, DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18683 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18684 | return Create(Ctx, MapType, DevType, IndirectExpr, Indirect, Level, I); |
||
18685 | } |
||
18686 | |||
18687 | OMPDeclareTargetDeclAttr::OMPDeclareTargetDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18688 | , MapTypeTy MapType |
||
18689 | , DevTypeTy DevType |
||
18690 | , Expr * IndirectExpr |
||
18691 | , bool Indirect |
||
18692 | , unsigned Level |
||
18693 | ) |
||
18694 | : InheritableAttr(Ctx, CommonInfo, attr::OMPDeclareTargetDecl, false, false) |
||
18695 | , mapType(MapType) |
||
18696 | , devType(DevType) |
||
18697 | , indirectExpr(IndirectExpr) |
||
18698 | , indirect(Indirect) |
||
18699 | , level(Level) |
||
18700 | { |
||
18701 | } |
||
18702 | |||
18703 | |||
18704 | |||
18705 | bool OMPDeclareTargetDeclAttr::ConvertStrToMapTypeTy(StringRef Val, MapTypeTy &Out) { |
||
18706 | std::optional<MapTypeTy> R = llvm::StringSwitch<std::optional<MapTypeTy>>(Val) |
||
18707 | .Case("to", OMPDeclareTargetDeclAttr::MT_To) |
||
18708 | .Case("enter", OMPDeclareTargetDeclAttr::MT_Enter) |
||
18709 | .Case("link", OMPDeclareTargetDeclAttr::MT_Link) |
||
18710 | .Default(std::optional<MapTypeTy>()); |
||
18711 | if (R) { |
||
18712 | Out = *R; |
||
18713 | return true; |
||
18714 | } |
||
18715 | return false; |
||
18716 | } |
||
18717 | |||
18718 | const char *OMPDeclareTargetDeclAttr::ConvertMapTypeTyToStr(MapTypeTy Val) { |
||
18719 | switch(Val) { |
||
18720 | case OMPDeclareTargetDeclAttr::MT_To: return "to"; |
||
18721 | case OMPDeclareTargetDeclAttr::MT_Enter: return "enter"; |
||
18722 | case OMPDeclareTargetDeclAttr::MT_Link: return "link"; |
||
18723 | } |
||
18724 | llvm_unreachable("No enumerator with that value"); |
||
18725 | } |
||
18726 | |||
18727 | |||
18728 | bool OMPDeclareTargetDeclAttr::ConvertStrToDevTypeTy(StringRef Val, DevTypeTy &Out) { |
||
18729 | std::optional<DevTypeTy> R = llvm::StringSwitch<std::optional<DevTypeTy>>(Val) |
||
18730 | .Case("host", OMPDeclareTargetDeclAttr::DT_Host) |
||
18731 | .Case("nohost", OMPDeclareTargetDeclAttr::DT_NoHost) |
||
18732 | .Case("any", OMPDeclareTargetDeclAttr::DT_Any) |
||
18733 | .Default(std::optional<DevTypeTy>()); |
||
18734 | if (R) { |
||
18735 | Out = *R; |
||
18736 | return true; |
||
18737 | } |
||
18738 | return false; |
||
18739 | } |
||
18740 | |||
18741 | const char *OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(DevTypeTy Val) { |
||
18742 | switch(Val) { |
||
18743 | case OMPDeclareTargetDeclAttr::DT_Host: return "host"; |
||
18744 | case OMPDeclareTargetDeclAttr::DT_NoHost: return "nohost"; |
||
18745 | case OMPDeclareTargetDeclAttr::DT_Any: return "any"; |
||
18746 | } |
||
18747 | llvm_unreachable("No enumerator with that value"); |
||
18748 | } |
||
18749 | |||
18750 | |||
18751 | |||
18752 | |||
18753 | |||
18754 | |||
18755 | OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::clone(ASTContext &C) const { |
||
18756 | auto *A = new (C) OMPDeclareTargetDeclAttr(C, *this, mapType, devType, indirectExpr, indirect, level); |
||
18757 | A->Inherited = Inherited; |
||
18758 | A->IsPackExpansion = IsPackExpansion; |
||
18759 | A->setImplicit(Implicit); |
||
18760 | return A; |
||
18761 | } |
||
18762 | |||
18763 | void OMPDeclareTargetDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18764 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
18765 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
18766 | switch (getAttributeSpellingListIndex()) { |
||
18767 | default: |
||
18768 | llvm_unreachable("Unknown attribute spelling!"); |
||
18769 | break; |
||
18770 | case 0 : { |
||
18771 | OS << "#pragma omp declare target"; |
||
18772 | printPrettyPragma(OS, Policy); |
||
18773 | OS << "\n"; break; |
||
18774 | } |
||
18775 | } |
||
18776 | } |
||
18777 | |||
18778 | const char *OMPDeclareTargetDeclAttr::getSpelling() const { |
||
18779 | switch (getAttributeSpellingListIndex()) { |
||
18780 | default: |
||
18781 | llvm_unreachable("Unknown attribute spelling!"); |
||
18782 | return "(No spelling)"; |
||
18783 | case 0: |
||
18784 | return "declare target"; |
||
18785 | } |
||
18786 | } |
||
18787 | |||
18788 | |||
18789 | // OMPDeclareVariantAttr implementation |
||
18790 | |||
18791 | OMPDeclareVariantAttr *OMPDeclareVariantAttr::CreateImplicit(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
18792 | auto *A = new (Ctx) OMPDeclareVariantAttr(Ctx, CommonInfo, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize); |
||
18793 | A->setImplicit(true); |
||
18794 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18795 | A->setAttributeSpellingListIndex(0); |
||
18796 | return A; |
||
18797 | } |
||
18798 | |||
18799 | OMPDeclareVariantAttr *OMPDeclareVariantAttr::Create(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
18800 | auto *A = new (Ctx) OMPDeclareVariantAttr(Ctx, CommonInfo, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize); |
||
18801 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18802 | A->setAttributeSpellingListIndex(0); |
||
18803 | return A; |
||
18804 | } |
||
18805 | |||
18806 | OMPDeclareVariantAttr *OMPDeclareVariantAttr::CreateImplicit(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18807 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18808 | return CreateImplicit(Ctx, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize, I); |
||
18809 | } |
||
18810 | |||
18811 | OMPDeclareVariantAttr *OMPDeclareVariantAttr::Create(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18812 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18813 | return Create(Ctx, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize, I); |
||
18814 | } |
||
18815 | |||
18816 | OMPDeclareVariantAttr::OMPDeclareVariantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18817 | , Expr * VariantFuncRef |
||
18818 | , OMPTraitInfo * TraitInfos |
||
18819 | , Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize |
||
18820 | , Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize |
||
18821 | , OMPInteropInfo *AppendArgs, unsigned AppendArgsSize |
||
18822 | ) |
||
18823 | : InheritableAttr(Ctx, CommonInfo, attr::OMPDeclareVariant, false, true) |
||
18824 | , variantFuncRef(VariantFuncRef) |
||
18825 | , traitInfos(TraitInfos) |
||
18826 | , adjustArgsNothing_Size(AdjustArgsNothingSize), adjustArgsNothing_(new (Ctx, 16) Expr *[adjustArgsNothing_Size]) |
||
18827 | , adjustArgsNeedDevicePtr_Size(AdjustArgsNeedDevicePtrSize), adjustArgsNeedDevicePtr_(new (Ctx, 16) Expr *[adjustArgsNeedDevicePtr_Size]) |
||
18828 | , appendArgs_Size(AppendArgsSize), appendArgs_(new (Ctx, 16) OMPInteropInfo[appendArgs_Size]) |
||
18829 | { |
||
18830 | std::copy(AdjustArgsNothing, AdjustArgsNothing + adjustArgsNothing_Size, adjustArgsNothing_); |
||
18831 | std::copy(AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtr + adjustArgsNeedDevicePtr_Size, adjustArgsNeedDevicePtr_); |
||
18832 | std::copy(AppendArgs, AppendArgs + appendArgs_Size, appendArgs_); |
||
18833 | } |
||
18834 | |||
18835 | OMPDeclareVariantAttr::OMPDeclareVariantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18836 | , Expr * VariantFuncRef |
||
18837 | , OMPTraitInfo * TraitInfos |
||
18838 | , OMPInteropInfo *AppendArgs, unsigned AppendArgsSize |
||
18839 | ) |
||
18840 | : InheritableAttr(Ctx, CommonInfo, attr::OMPDeclareVariant, false, true) |
||
18841 | , variantFuncRef(VariantFuncRef) |
||
18842 | , traitInfos(TraitInfos) |
||
18843 | , adjustArgsNothing_Size(0), adjustArgsNothing_(nullptr) |
||
18844 | , adjustArgsNeedDevicePtr_Size(0), adjustArgsNeedDevicePtr_(nullptr) |
||
18845 | , appendArgs_Size(AppendArgsSize), appendArgs_(new (Ctx, 16) OMPInteropInfo[appendArgs_Size]) |
||
18846 | { |
||
18847 | std::copy(AppendArgs, AppendArgs + appendArgs_Size, appendArgs_); |
||
18848 | } |
||
18849 | |||
18850 | |||
18851 | |||
18852 | |||
18853 | |||
18854 | |||
18855 | |||
18856 | |||
18857 | |||
18858 | |||
18859 | |||
18860 | OMPDeclareVariantAttr *OMPDeclareVariantAttr::clone(ASTContext &C) const { |
||
18861 | auto *A = new (C) OMPDeclareVariantAttr(C, *this, variantFuncRef, traitInfos, adjustArgsNothing_, adjustArgsNothing_Size, adjustArgsNeedDevicePtr_, adjustArgsNeedDevicePtr_Size, appendArgs_, appendArgs_Size); |
||
18862 | A->Inherited = Inherited; |
||
18863 | A->IsPackExpansion = IsPackExpansion; |
||
18864 | A->setImplicit(Implicit); |
||
18865 | return A; |
||
18866 | } |
||
18867 | |||
18868 | void OMPDeclareVariantAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18869 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
18870 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
18871 | switch (getAttributeSpellingListIndex()) { |
||
18872 | default: |
||
18873 | llvm_unreachable("Unknown attribute spelling!"); |
||
18874 | break; |
||
18875 | case 0 : { |
||
18876 | OS << "#pragma omp declare variant"; |
||
18877 | printPrettyPragma(OS, Policy); |
||
18878 | OS << "\n"; break; |
||
18879 | } |
||
18880 | } |
||
18881 | } |
||
18882 | |||
18883 | const char *OMPDeclareVariantAttr::getSpelling() const { |
||
18884 | switch (getAttributeSpellingListIndex()) { |
||
18885 | default: |
||
18886 | llvm_unreachable("Unknown attribute spelling!"); |
||
18887 | return "(No spelling)"; |
||
18888 | case 0: |
||
18889 | return "declare variant"; |
||
18890 | } |
||
18891 | } |
||
18892 | |||
18893 | |||
18894 | // OMPReferencedVarAttr implementation |
||
18895 | |||
18896 | OMPReferencedVarAttr *OMPReferencedVarAttr::CreateImplicit(ASTContext &Ctx, Expr * Ref, const AttributeCommonInfo &CommonInfo) { |
||
18897 | auto *A = new (Ctx) OMPReferencedVarAttr(Ctx, CommonInfo, Ref); |
||
18898 | A->setImplicit(true); |
||
18899 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18900 | A->setAttributeSpellingListIndex(0); |
||
18901 | return A; |
||
18902 | } |
||
18903 | |||
18904 | OMPReferencedVarAttr *OMPReferencedVarAttr::Create(ASTContext &Ctx, Expr * Ref, const AttributeCommonInfo &CommonInfo) { |
||
18905 | auto *A = new (Ctx) OMPReferencedVarAttr(Ctx, CommonInfo, Ref); |
||
18906 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18907 | A->setAttributeSpellingListIndex(0); |
||
18908 | return A; |
||
18909 | } |
||
18910 | |||
18911 | OMPReferencedVarAttr *OMPReferencedVarAttr::CreateImplicit(ASTContext &Ctx, Expr * Ref, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18912 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18913 | return CreateImplicit(Ctx, Ref, I); |
||
18914 | } |
||
18915 | |||
18916 | OMPReferencedVarAttr *OMPReferencedVarAttr::Create(ASTContext &Ctx, Expr * Ref, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18917 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18918 | return Create(Ctx, Ref, I); |
||
18919 | } |
||
18920 | |||
18921 | OMPReferencedVarAttr::OMPReferencedVarAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18922 | , Expr * Ref |
||
18923 | ) |
||
18924 | : Attr(Ctx, CommonInfo, attr::OMPReferencedVar, false) |
||
18925 | , ref(Ref) |
||
18926 | { |
||
18927 | } |
||
18928 | |||
18929 | |||
18930 | |||
18931 | OMPReferencedVarAttr *OMPReferencedVarAttr::clone(ASTContext &C) const { |
||
18932 | auto *A = new (C) OMPReferencedVarAttr(C, *this, ref); |
||
18933 | A->Inherited = Inherited; |
||
18934 | A->IsPackExpansion = IsPackExpansion; |
||
18935 | A->setImplicit(Implicit); |
||
18936 | return A; |
||
18937 | } |
||
18938 | |||
18939 | void OMPReferencedVarAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18940 | } |
||
18941 | |||
18942 | const char *OMPReferencedVarAttr::getSpelling() const { |
||
18943 | return "(No spelling)"; |
||
18944 | } |
||
18945 | |||
18946 | |||
18947 | // OMPThreadPrivateDeclAttr implementation |
||
18948 | |||
18949 | OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
18950 | auto *A = new (Ctx) OMPThreadPrivateDeclAttr(Ctx, CommonInfo); |
||
18951 | A->setImplicit(true); |
||
18952 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18953 | A->setAttributeSpellingListIndex(0); |
||
18954 | return A; |
||
18955 | } |
||
18956 | |||
18957 | OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
18958 | auto *A = new (Ctx) OMPThreadPrivateDeclAttr(Ctx, CommonInfo); |
||
18959 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
18960 | A->setAttributeSpellingListIndex(0); |
||
18961 | return A; |
||
18962 | } |
||
18963 | |||
18964 | OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18965 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18966 | return CreateImplicit(Ctx, I); |
||
18967 | } |
||
18968 | |||
18969 | OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
18970 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
18971 | return Create(Ctx, I); |
||
18972 | } |
||
18973 | |||
18974 | OMPThreadPrivateDeclAttr::OMPThreadPrivateDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
18975 | ) |
||
18976 | : InheritableAttr(Ctx, CommonInfo, attr::OMPThreadPrivateDecl, false, false) |
||
18977 | { |
||
18978 | } |
||
18979 | |||
18980 | OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::clone(ASTContext &C) const { |
||
18981 | auto *A = new (C) OMPThreadPrivateDeclAttr(C, *this); |
||
18982 | A->Inherited = Inherited; |
||
18983 | A->IsPackExpansion = IsPackExpansion; |
||
18984 | A->setImplicit(Implicit); |
||
18985 | return A; |
||
18986 | } |
||
18987 | |||
18988 | void OMPThreadPrivateDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
18989 | } |
||
18990 | |||
18991 | const char *OMPThreadPrivateDeclAttr::getSpelling() const { |
||
18992 | return "(No spelling)"; |
||
18993 | } |
||
18994 | |||
18995 | |||
18996 | // OSConsumedAttr implementation |
||
18997 | |||
18998 | OSConsumedAttr *OSConsumedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
18999 | auto *A = new (Ctx) OSConsumedAttr(Ctx, CommonInfo); |
||
19000 | A->setImplicit(true); |
||
19001 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19002 | A->setAttributeSpellingListIndex(0); |
||
19003 | return A; |
||
19004 | } |
||
19005 | |||
19006 | OSConsumedAttr *OSConsumedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19007 | auto *A = new (Ctx) OSConsumedAttr(Ctx, CommonInfo); |
||
19008 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19009 | A->setAttributeSpellingListIndex(0); |
||
19010 | return A; |
||
19011 | } |
||
19012 | |||
19013 | OSConsumedAttr *OSConsumedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19014 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19015 | return CreateImplicit(Ctx, I); |
||
19016 | } |
||
19017 | |||
19018 | OSConsumedAttr *OSConsumedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19019 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19020 | return Create(Ctx, I); |
||
19021 | } |
||
19022 | |||
19023 | OSConsumedAttr::OSConsumedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19024 | ) |
||
19025 | : InheritableParamAttr(Ctx, CommonInfo, attr::OSConsumed, false, false) |
||
19026 | { |
||
19027 | } |
||
19028 | |||
19029 | OSConsumedAttr *OSConsumedAttr::clone(ASTContext &C) const { |
||
19030 | auto *A = new (C) OSConsumedAttr(C, *this); |
||
19031 | A->Inherited = Inherited; |
||
19032 | A->IsPackExpansion = IsPackExpansion; |
||
19033 | A->setImplicit(Implicit); |
||
19034 | return A; |
||
19035 | } |
||
19036 | |||
19037 | void OSConsumedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19038 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19039 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19040 | switch (getAttributeSpellingListIndex()) { |
||
19041 | default: |
||
19042 | llvm_unreachable("Unknown attribute spelling!"); |
||
19043 | break; |
||
19044 | case 0 : { |
||
19045 | OS << " __attribute__((os_consumed"; |
||
19046 | OS << "))"; |
||
19047 | break; |
||
19048 | } |
||
19049 | case 1 : { |
||
19050 | OS << " [[clang::os_consumed"; |
||
19051 | OS << "]]"; |
||
19052 | break; |
||
19053 | } |
||
19054 | case 2 : { |
||
19055 | OS << " [[clang::os_consumed"; |
||
19056 | OS << "]]"; |
||
19057 | break; |
||
19058 | } |
||
19059 | } |
||
19060 | } |
||
19061 | |||
19062 | const char *OSConsumedAttr::getSpelling() const { |
||
19063 | switch (getAttributeSpellingListIndex()) { |
||
19064 | default: |
||
19065 | llvm_unreachable("Unknown attribute spelling!"); |
||
19066 | return "(No spelling)"; |
||
19067 | case 0: |
||
19068 | return "os_consumed"; |
||
19069 | case 1: |
||
19070 | return "os_consumed"; |
||
19071 | case 2: |
||
19072 | return "os_consumed"; |
||
19073 | } |
||
19074 | } |
||
19075 | |||
19076 | |||
19077 | // OSConsumesThisAttr implementation |
||
19078 | |||
19079 | OSConsumesThisAttr *OSConsumesThisAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19080 | auto *A = new (Ctx) OSConsumesThisAttr(Ctx, CommonInfo); |
||
19081 | A->setImplicit(true); |
||
19082 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19083 | A->setAttributeSpellingListIndex(0); |
||
19084 | return A; |
||
19085 | } |
||
19086 | |||
19087 | OSConsumesThisAttr *OSConsumesThisAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19088 | auto *A = new (Ctx) OSConsumesThisAttr(Ctx, CommonInfo); |
||
19089 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19090 | A->setAttributeSpellingListIndex(0); |
||
19091 | return A; |
||
19092 | } |
||
19093 | |||
19094 | OSConsumesThisAttr *OSConsumesThisAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19095 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19096 | return CreateImplicit(Ctx, I); |
||
19097 | } |
||
19098 | |||
19099 | OSConsumesThisAttr *OSConsumesThisAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19100 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19101 | return Create(Ctx, I); |
||
19102 | } |
||
19103 | |||
19104 | OSConsumesThisAttr::OSConsumesThisAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19105 | ) |
||
19106 | : InheritableAttr(Ctx, CommonInfo, attr::OSConsumesThis, false, false) |
||
19107 | { |
||
19108 | } |
||
19109 | |||
19110 | OSConsumesThisAttr *OSConsumesThisAttr::clone(ASTContext &C) const { |
||
19111 | auto *A = new (C) OSConsumesThisAttr(C, *this); |
||
19112 | A->Inherited = Inherited; |
||
19113 | A->IsPackExpansion = IsPackExpansion; |
||
19114 | A->setImplicit(Implicit); |
||
19115 | return A; |
||
19116 | } |
||
19117 | |||
19118 | void OSConsumesThisAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19119 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19120 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19121 | switch (getAttributeSpellingListIndex()) { |
||
19122 | default: |
||
19123 | llvm_unreachable("Unknown attribute spelling!"); |
||
19124 | break; |
||
19125 | case 0 : { |
||
19126 | OS << " __attribute__((os_consumes_this"; |
||
19127 | OS << "))"; |
||
19128 | break; |
||
19129 | } |
||
19130 | case 1 : { |
||
19131 | OS << " [[clang::os_consumes_this"; |
||
19132 | OS << "]]"; |
||
19133 | break; |
||
19134 | } |
||
19135 | case 2 : { |
||
19136 | OS << " [[clang::os_consumes_this"; |
||
19137 | OS << "]]"; |
||
19138 | break; |
||
19139 | } |
||
19140 | } |
||
19141 | } |
||
19142 | |||
19143 | const char *OSConsumesThisAttr::getSpelling() const { |
||
19144 | switch (getAttributeSpellingListIndex()) { |
||
19145 | default: |
||
19146 | llvm_unreachable("Unknown attribute spelling!"); |
||
19147 | return "(No spelling)"; |
||
19148 | case 0: |
||
19149 | return "os_consumes_this"; |
||
19150 | case 1: |
||
19151 | return "os_consumes_this"; |
||
19152 | case 2: |
||
19153 | return "os_consumes_this"; |
||
19154 | } |
||
19155 | } |
||
19156 | |||
19157 | |||
19158 | // OSReturnsNotRetainedAttr implementation |
||
19159 | |||
19160 | OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19161 | auto *A = new (Ctx) OSReturnsNotRetainedAttr(Ctx, CommonInfo); |
||
19162 | A->setImplicit(true); |
||
19163 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19164 | A->setAttributeSpellingListIndex(0); |
||
19165 | return A; |
||
19166 | } |
||
19167 | |||
19168 | OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19169 | auto *A = new (Ctx) OSReturnsNotRetainedAttr(Ctx, CommonInfo); |
||
19170 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19171 | A->setAttributeSpellingListIndex(0); |
||
19172 | return A; |
||
19173 | } |
||
19174 | |||
19175 | OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19176 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19177 | return CreateImplicit(Ctx, I); |
||
19178 | } |
||
19179 | |||
19180 | OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19181 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19182 | return Create(Ctx, I); |
||
19183 | } |
||
19184 | |||
19185 | OSReturnsNotRetainedAttr::OSReturnsNotRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19186 | ) |
||
19187 | : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsNotRetained, false, false) |
||
19188 | { |
||
19189 | } |
||
19190 | |||
19191 | OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::clone(ASTContext &C) const { |
||
19192 | auto *A = new (C) OSReturnsNotRetainedAttr(C, *this); |
||
19193 | A->Inherited = Inherited; |
||
19194 | A->IsPackExpansion = IsPackExpansion; |
||
19195 | A->setImplicit(Implicit); |
||
19196 | return A; |
||
19197 | } |
||
19198 | |||
19199 | void OSReturnsNotRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19200 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19201 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19202 | switch (getAttributeSpellingListIndex()) { |
||
19203 | default: |
||
19204 | llvm_unreachable("Unknown attribute spelling!"); |
||
19205 | break; |
||
19206 | case 0 : { |
||
19207 | OS << " __attribute__((os_returns_not_retained"; |
||
19208 | OS << "))"; |
||
19209 | break; |
||
19210 | } |
||
19211 | case 1 : { |
||
19212 | OS << " [[clang::os_returns_not_retained"; |
||
19213 | OS << "]]"; |
||
19214 | break; |
||
19215 | } |
||
19216 | case 2 : { |
||
19217 | OS << " [[clang::os_returns_not_retained"; |
||
19218 | OS << "]]"; |
||
19219 | break; |
||
19220 | } |
||
19221 | } |
||
19222 | } |
||
19223 | |||
19224 | const char *OSReturnsNotRetainedAttr::getSpelling() const { |
||
19225 | switch (getAttributeSpellingListIndex()) { |
||
19226 | default: |
||
19227 | llvm_unreachable("Unknown attribute spelling!"); |
||
19228 | return "(No spelling)"; |
||
19229 | case 0: |
||
19230 | return "os_returns_not_retained"; |
||
19231 | case 1: |
||
19232 | return "os_returns_not_retained"; |
||
19233 | case 2: |
||
19234 | return "os_returns_not_retained"; |
||
19235 | } |
||
19236 | } |
||
19237 | |||
19238 | |||
19239 | // OSReturnsRetainedAttr implementation |
||
19240 | |||
19241 | OSReturnsRetainedAttr *OSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19242 | auto *A = new (Ctx) OSReturnsRetainedAttr(Ctx, CommonInfo); |
||
19243 | A->setImplicit(true); |
||
19244 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19245 | A->setAttributeSpellingListIndex(0); |
||
19246 | return A; |
||
19247 | } |
||
19248 | |||
19249 | OSReturnsRetainedAttr *OSReturnsRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19250 | auto *A = new (Ctx) OSReturnsRetainedAttr(Ctx, CommonInfo); |
||
19251 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19252 | A->setAttributeSpellingListIndex(0); |
||
19253 | return A; |
||
19254 | } |
||
19255 | |||
19256 | OSReturnsRetainedAttr *OSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19257 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19258 | return CreateImplicit(Ctx, I); |
||
19259 | } |
||
19260 | |||
19261 | OSReturnsRetainedAttr *OSReturnsRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19262 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19263 | return Create(Ctx, I); |
||
19264 | } |
||
19265 | |||
19266 | OSReturnsRetainedAttr::OSReturnsRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19267 | ) |
||
19268 | : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsRetained, false, false) |
||
19269 | { |
||
19270 | } |
||
19271 | |||
19272 | OSReturnsRetainedAttr *OSReturnsRetainedAttr::clone(ASTContext &C) const { |
||
19273 | auto *A = new (C) OSReturnsRetainedAttr(C, *this); |
||
19274 | A->Inherited = Inherited; |
||
19275 | A->IsPackExpansion = IsPackExpansion; |
||
19276 | A->setImplicit(Implicit); |
||
19277 | return A; |
||
19278 | } |
||
19279 | |||
19280 | void OSReturnsRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19281 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19282 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19283 | switch (getAttributeSpellingListIndex()) { |
||
19284 | default: |
||
19285 | llvm_unreachable("Unknown attribute spelling!"); |
||
19286 | break; |
||
19287 | case 0 : { |
||
19288 | OS << " __attribute__((os_returns_retained"; |
||
19289 | OS << "))"; |
||
19290 | break; |
||
19291 | } |
||
19292 | case 1 : { |
||
19293 | OS << " [[clang::os_returns_retained"; |
||
19294 | OS << "]]"; |
||
19295 | break; |
||
19296 | } |
||
19297 | case 2 : { |
||
19298 | OS << " [[clang::os_returns_retained"; |
||
19299 | OS << "]]"; |
||
19300 | break; |
||
19301 | } |
||
19302 | } |
||
19303 | } |
||
19304 | |||
19305 | const char *OSReturnsRetainedAttr::getSpelling() const { |
||
19306 | switch (getAttributeSpellingListIndex()) { |
||
19307 | default: |
||
19308 | llvm_unreachable("Unknown attribute spelling!"); |
||
19309 | return "(No spelling)"; |
||
19310 | case 0: |
||
19311 | return "os_returns_retained"; |
||
19312 | case 1: |
||
19313 | return "os_returns_retained"; |
||
19314 | case 2: |
||
19315 | return "os_returns_retained"; |
||
19316 | } |
||
19317 | } |
||
19318 | |||
19319 | |||
19320 | // OSReturnsRetainedOnNonZeroAttr implementation |
||
19321 | |||
19322 | OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19323 | auto *A = new (Ctx) OSReturnsRetainedOnNonZeroAttr(Ctx, CommonInfo); |
||
19324 | A->setImplicit(true); |
||
19325 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19326 | A->setAttributeSpellingListIndex(0); |
||
19327 | return A; |
||
19328 | } |
||
19329 | |||
19330 | OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19331 | auto *A = new (Ctx) OSReturnsRetainedOnNonZeroAttr(Ctx, CommonInfo); |
||
19332 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19333 | A->setAttributeSpellingListIndex(0); |
||
19334 | return A; |
||
19335 | } |
||
19336 | |||
19337 | OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19338 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19339 | return CreateImplicit(Ctx, I); |
||
19340 | } |
||
19341 | |||
19342 | OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19343 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19344 | return Create(Ctx, I); |
||
19345 | } |
||
19346 | |||
19347 | OSReturnsRetainedOnNonZeroAttr::OSReturnsRetainedOnNonZeroAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19348 | ) |
||
19349 | : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsRetainedOnNonZero, false, false) |
||
19350 | { |
||
19351 | } |
||
19352 | |||
19353 | OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::clone(ASTContext &C) const { |
||
19354 | auto *A = new (C) OSReturnsRetainedOnNonZeroAttr(C, *this); |
||
19355 | A->Inherited = Inherited; |
||
19356 | A->IsPackExpansion = IsPackExpansion; |
||
19357 | A->setImplicit(Implicit); |
||
19358 | return A; |
||
19359 | } |
||
19360 | |||
19361 | void OSReturnsRetainedOnNonZeroAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19362 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19363 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19364 | switch (getAttributeSpellingListIndex()) { |
||
19365 | default: |
||
19366 | llvm_unreachable("Unknown attribute spelling!"); |
||
19367 | break; |
||
19368 | case 0 : { |
||
19369 | OS << " __attribute__((os_returns_retained_on_non_zero"; |
||
19370 | OS << "))"; |
||
19371 | break; |
||
19372 | } |
||
19373 | case 1 : { |
||
19374 | OS << " [[clang::os_returns_retained_on_non_zero"; |
||
19375 | OS << "]]"; |
||
19376 | break; |
||
19377 | } |
||
19378 | case 2 : { |
||
19379 | OS << " [[clang::os_returns_retained_on_non_zero"; |
||
19380 | OS << "]]"; |
||
19381 | break; |
||
19382 | } |
||
19383 | } |
||
19384 | } |
||
19385 | |||
19386 | const char *OSReturnsRetainedOnNonZeroAttr::getSpelling() const { |
||
19387 | switch (getAttributeSpellingListIndex()) { |
||
19388 | default: |
||
19389 | llvm_unreachable("Unknown attribute spelling!"); |
||
19390 | return "(No spelling)"; |
||
19391 | case 0: |
||
19392 | return "os_returns_retained_on_non_zero"; |
||
19393 | case 1: |
||
19394 | return "os_returns_retained_on_non_zero"; |
||
19395 | case 2: |
||
19396 | return "os_returns_retained_on_non_zero"; |
||
19397 | } |
||
19398 | } |
||
19399 | |||
19400 | |||
19401 | // OSReturnsRetainedOnZeroAttr implementation |
||
19402 | |||
19403 | OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19404 | auto *A = new (Ctx) OSReturnsRetainedOnZeroAttr(Ctx, CommonInfo); |
||
19405 | A->setImplicit(true); |
||
19406 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19407 | A->setAttributeSpellingListIndex(0); |
||
19408 | return A; |
||
19409 | } |
||
19410 | |||
19411 | OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19412 | auto *A = new (Ctx) OSReturnsRetainedOnZeroAttr(Ctx, CommonInfo); |
||
19413 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19414 | A->setAttributeSpellingListIndex(0); |
||
19415 | return A; |
||
19416 | } |
||
19417 | |||
19418 | OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19419 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19420 | return CreateImplicit(Ctx, I); |
||
19421 | } |
||
19422 | |||
19423 | OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19424 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19425 | return Create(Ctx, I); |
||
19426 | } |
||
19427 | |||
19428 | OSReturnsRetainedOnZeroAttr::OSReturnsRetainedOnZeroAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19429 | ) |
||
19430 | : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsRetainedOnZero, false, false) |
||
19431 | { |
||
19432 | } |
||
19433 | |||
19434 | OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::clone(ASTContext &C) const { |
||
19435 | auto *A = new (C) OSReturnsRetainedOnZeroAttr(C, *this); |
||
19436 | A->Inherited = Inherited; |
||
19437 | A->IsPackExpansion = IsPackExpansion; |
||
19438 | A->setImplicit(Implicit); |
||
19439 | return A; |
||
19440 | } |
||
19441 | |||
19442 | void OSReturnsRetainedOnZeroAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19443 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19444 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19445 | switch (getAttributeSpellingListIndex()) { |
||
19446 | default: |
||
19447 | llvm_unreachable("Unknown attribute spelling!"); |
||
19448 | break; |
||
19449 | case 0 : { |
||
19450 | OS << " __attribute__((os_returns_retained_on_zero"; |
||
19451 | OS << "))"; |
||
19452 | break; |
||
19453 | } |
||
19454 | case 1 : { |
||
19455 | OS << " [[clang::os_returns_retained_on_zero"; |
||
19456 | OS << "]]"; |
||
19457 | break; |
||
19458 | } |
||
19459 | case 2 : { |
||
19460 | OS << " [[clang::os_returns_retained_on_zero"; |
||
19461 | OS << "]]"; |
||
19462 | break; |
||
19463 | } |
||
19464 | } |
||
19465 | } |
||
19466 | |||
19467 | const char *OSReturnsRetainedOnZeroAttr::getSpelling() const { |
||
19468 | switch (getAttributeSpellingListIndex()) { |
||
19469 | default: |
||
19470 | llvm_unreachable("Unknown attribute spelling!"); |
||
19471 | return "(No spelling)"; |
||
19472 | case 0: |
||
19473 | return "os_returns_retained_on_zero"; |
||
19474 | case 1: |
||
19475 | return "os_returns_retained_on_zero"; |
||
19476 | case 2: |
||
19477 | return "os_returns_retained_on_zero"; |
||
19478 | } |
||
19479 | } |
||
19480 | |||
19481 | |||
19482 | // ObjCBoxableAttr implementation |
||
19483 | |||
19484 | ObjCBoxableAttr *ObjCBoxableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19485 | auto *A = new (Ctx) ObjCBoxableAttr(Ctx, CommonInfo); |
||
19486 | A->setImplicit(true); |
||
19487 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19488 | A->setAttributeSpellingListIndex(0); |
||
19489 | return A; |
||
19490 | } |
||
19491 | |||
19492 | ObjCBoxableAttr *ObjCBoxableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19493 | auto *A = new (Ctx) ObjCBoxableAttr(Ctx, CommonInfo); |
||
19494 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19495 | A->setAttributeSpellingListIndex(0); |
||
19496 | return A; |
||
19497 | } |
||
19498 | |||
19499 | ObjCBoxableAttr *ObjCBoxableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19500 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19501 | return CreateImplicit(Ctx, I); |
||
19502 | } |
||
19503 | |||
19504 | ObjCBoxableAttr *ObjCBoxableAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19505 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19506 | return Create(Ctx, I); |
||
19507 | } |
||
19508 | |||
19509 | ObjCBoxableAttr::ObjCBoxableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19510 | ) |
||
19511 | : Attr(Ctx, CommonInfo, attr::ObjCBoxable, false) |
||
19512 | { |
||
19513 | } |
||
19514 | |||
19515 | ObjCBoxableAttr *ObjCBoxableAttr::clone(ASTContext &C) const { |
||
19516 | auto *A = new (C) ObjCBoxableAttr(C, *this); |
||
19517 | A->Inherited = Inherited; |
||
19518 | A->IsPackExpansion = IsPackExpansion; |
||
19519 | A->setImplicit(Implicit); |
||
19520 | return A; |
||
19521 | } |
||
19522 | |||
19523 | void ObjCBoxableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19524 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19525 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19526 | switch (getAttributeSpellingListIndex()) { |
||
19527 | default: |
||
19528 | llvm_unreachable("Unknown attribute spelling!"); |
||
19529 | break; |
||
19530 | case 0 : { |
||
19531 | OS << " __attribute__((objc_boxable"; |
||
19532 | OS << "))"; |
||
19533 | break; |
||
19534 | } |
||
19535 | case 1 : { |
||
19536 | OS << " [[clang::objc_boxable"; |
||
19537 | OS << "]]"; |
||
19538 | break; |
||
19539 | } |
||
19540 | case 2 : { |
||
19541 | OS << " [[clang::objc_boxable"; |
||
19542 | OS << "]]"; |
||
19543 | break; |
||
19544 | } |
||
19545 | } |
||
19546 | } |
||
19547 | |||
19548 | const char *ObjCBoxableAttr::getSpelling() const { |
||
19549 | switch (getAttributeSpellingListIndex()) { |
||
19550 | default: |
||
19551 | llvm_unreachable("Unknown attribute spelling!"); |
||
19552 | return "(No spelling)"; |
||
19553 | case 0: |
||
19554 | return "objc_boxable"; |
||
19555 | case 1: |
||
19556 | return "objc_boxable"; |
||
19557 | case 2: |
||
19558 | return "objc_boxable"; |
||
19559 | } |
||
19560 | } |
||
19561 | |||
19562 | |||
19563 | // ObjCBridgeAttr implementation |
||
19564 | |||
19565 | ObjCBridgeAttr *ObjCBridgeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) { |
||
19566 | auto *A = new (Ctx) ObjCBridgeAttr(Ctx, CommonInfo, BridgedType); |
||
19567 | A->setImplicit(true); |
||
19568 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19569 | A->setAttributeSpellingListIndex(0); |
||
19570 | return A; |
||
19571 | } |
||
19572 | |||
19573 | ObjCBridgeAttr *ObjCBridgeAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) { |
||
19574 | auto *A = new (Ctx) ObjCBridgeAttr(Ctx, CommonInfo, BridgedType); |
||
19575 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19576 | A->setAttributeSpellingListIndex(0); |
||
19577 | return A; |
||
19578 | } |
||
19579 | |||
19580 | ObjCBridgeAttr *ObjCBridgeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19581 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19582 | return CreateImplicit(Ctx, BridgedType, I); |
||
19583 | } |
||
19584 | |||
19585 | ObjCBridgeAttr *ObjCBridgeAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19586 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19587 | return Create(Ctx, BridgedType, I); |
||
19588 | } |
||
19589 | |||
19590 | ObjCBridgeAttr::ObjCBridgeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19591 | , IdentifierInfo * BridgedType |
||
19592 | ) |
||
19593 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCBridge, false, false) |
||
19594 | , bridgedType(BridgedType) |
||
19595 | { |
||
19596 | } |
||
19597 | |||
19598 | |||
19599 | |||
19600 | ObjCBridgeAttr *ObjCBridgeAttr::clone(ASTContext &C) const { |
||
19601 | auto *A = new (C) ObjCBridgeAttr(C, *this, bridgedType); |
||
19602 | A->Inherited = Inherited; |
||
19603 | A->IsPackExpansion = IsPackExpansion; |
||
19604 | A->setImplicit(Implicit); |
||
19605 | return A; |
||
19606 | } |
||
19607 | |||
19608 | void ObjCBridgeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19609 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19610 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19611 | switch (getAttributeSpellingListIndex()) { |
||
19612 | default: |
||
19613 | llvm_unreachable("Unknown attribute spelling!"); |
||
19614 | break; |
||
19615 | case 0 : { |
||
19616 | OS << " __attribute__((objc_bridge"; |
||
19617 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19618 | OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; |
||
19619 | if (!IsFirstArgument) |
||
19620 | OS << ")"; |
||
19621 | OS << "))"; |
||
19622 | break; |
||
19623 | } |
||
19624 | case 1 : { |
||
19625 | OS << " [[clang::objc_bridge"; |
||
19626 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19627 | OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; |
||
19628 | if (!IsFirstArgument) |
||
19629 | OS << ")"; |
||
19630 | OS << "]]"; |
||
19631 | break; |
||
19632 | } |
||
19633 | case 2 : { |
||
19634 | OS << " [[clang::objc_bridge"; |
||
19635 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19636 | OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; |
||
19637 | if (!IsFirstArgument) |
||
19638 | OS << ")"; |
||
19639 | OS << "]]"; |
||
19640 | break; |
||
19641 | } |
||
19642 | } |
||
19643 | } |
||
19644 | |||
19645 | const char *ObjCBridgeAttr::getSpelling() const { |
||
19646 | switch (getAttributeSpellingListIndex()) { |
||
19647 | default: |
||
19648 | llvm_unreachable("Unknown attribute spelling!"); |
||
19649 | return "(No spelling)"; |
||
19650 | case 0: |
||
19651 | return "objc_bridge"; |
||
19652 | case 1: |
||
19653 | return "objc_bridge"; |
||
19654 | case 2: |
||
19655 | return "objc_bridge"; |
||
19656 | } |
||
19657 | } |
||
19658 | |||
19659 | |||
19660 | // ObjCBridgeMutableAttr implementation |
||
19661 | |||
19662 | ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) { |
||
19663 | auto *A = new (Ctx) ObjCBridgeMutableAttr(Ctx, CommonInfo, BridgedType); |
||
19664 | A->setImplicit(true); |
||
19665 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19666 | A->setAttributeSpellingListIndex(0); |
||
19667 | return A; |
||
19668 | } |
||
19669 | |||
19670 | ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) { |
||
19671 | auto *A = new (Ctx) ObjCBridgeMutableAttr(Ctx, CommonInfo, BridgedType); |
||
19672 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19673 | A->setAttributeSpellingListIndex(0); |
||
19674 | return A; |
||
19675 | } |
||
19676 | |||
19677 | ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19678 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19679 | return CreateImplicit(Ctx, BridgedType, I); |
||
19680 | } |
||
19681 | |||
19682 | ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19683 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19684 | return Create(Ctx, BridgedType, I); |
||
19685 | } |
||
19686 | |||
19687 | ObjCBridgeMutableAttr::ObjCBridgeMutableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19688 | , IdentifierInfo * BridgedType |
||
19689 | ) |
||
19690 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCBridgeMutable, false, false) |
||
19691 | , bridgedType(BridgedType) |
||
19692 | { |
||
19693 | } |
||
19694 | |||
19695 | |||
19696 | |||
19697 | ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::clone(ASTContext &C) const { |
||
19698 | auto *A = new (C) ObjCBridgeMutableAttr(C, *this, bridgedType); |
||
19699 | A->Inherited = Inherited; |
||
19700 | A->IsPackExpansion = IsPackExpansion; |
||
19701 | A->setImplicit(Implicit); |
||
19702 | return A; |
||
19703 | } |
||
19704 | |||
19705 | void ObjCBridgeMutableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19706 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19707 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19708 | switch (getAttributeSpellingListIndex()) { |
||
19709 | default: |
||
19710 | llvm_unreachable("Unknown attribute spelling!"); |
||
19711 | break; |
||
19712 | case 0 : { |
||
19713 | OS << " __attribute__((objc_bridge_mutable"; |
||
19714 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19715 | OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; |
||
19716 | if (!IsFirstArgument) |
||
19717 | OS << ")"; |
||
19718 | OS << "))"; |
||
19719 | break; |
||
19720 | } |
||
19721 | case 1 : { |
||
19722 | OS << " [[clang::objc_bridge_mutable"; |
||
19723 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19724 | OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; |
||
19725 | if (!IsFirstArgument) |
||
19726 | OS << ")"; |
||
19727 | OS << "]]"; |
||
19728 | break; |
||
19729 | } |
||
19730 | case 2 : { |
||
19731 | OS << " [[clang::objc_bridge_mutable"; |
||
19732 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19733 | OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; |
||
19734 | if (!IsFirstArgument) |
||
19735 | OS << ")"; |
||
19736 | OS << "]]"; |
||
19737 | break; |
||
19738 | } |
||
19739 | } |
||
19740 | } |
||
19741 | |||
19742 | const char *ObjCBridgeMutableAttr::getSpelling() const { |
||
19743 | switch (getAttributeSpellingListIndex()) { |
||
19744 | default: |
||
19745 | llvm_unreachable("Unknown attribute spelling!"); |
||
19746 | return "(No spelling)"; |
||
19747 | case 0: |
||
19748 | return "objc_bridge_mutable"; |
||
19749 | case 1: |
||
19750 | return "objc_bridge_mutable"; |
||
19751 | case 2: |
||
19752 | return "objc_bridge_mutable"; |
||
19753 | } |
||
19754 | } |
||
19755 | |||
19756 | |||
19757 | // ObjCBridgeRelatedAttr implementation |
||
19758 | |||
19759 | ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, const AttributeCommonInfo &CommonInfo) { |
||
19760 | auto *A = new (Ctx) ObjCBridgeRelatedAttr(Ctx, CommonInfo, RelatedClass, ClassMethod, InstanceMethod); |
||
19761 | A->setImplicit(true); |
||
19762 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19763 | A->setAttributeSpellingListIndex(0); |
||
19764 | return A; |
||
19765 | } |
||
19766 | |||
19767 | ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::Create(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, const AttributeCommonInfo &CommonInfo) { |
||
19768 | auto *A = new (Ctx) ObjCBridgeRelatedAttr(Ctx, CommonInfo, RelatedClass, ClassMethod, InstanceMethod); |
||
19769 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19770 | A->setAttributeSpellingListIndex(0); |
||
19771 | return A; |
||
19772 | } |
||
19773 | |||
19774 | ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19775 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19776 | return CreateImplicit(Ctx, RelatedClass, ClassMethod, InstanceMethod, I); |
||
19777 | } |
||
19778 | |||
19779 | ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::Create(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19780 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19781 | return Create(Ctx, RelatedClass, ClassMethod, InstanceMethod, I); |
||
19782 | } |
||
19783 | |||
19784 | ObjCBridgeRelatedAttr::ObjCBridgeRelatedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19785 | , IdentifierInfo * RelatedClass |
||
19786 | , IdentifierInfo * ClassMethod |
||
19787 | , IdentifierInfo * InstanceMethod |
||
19788 | ) |
||
19789 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCBridgeRelated, false, false) |
||
19790 | , relatedClass(RelatedClass) |
||
19791 | , classMethod(ClassMethod) |
||
19792 | , instanceMethod(InstanceMethod) |
||
19793 | { |
||
19794 | } |
||
19795 | |||
19796 | |||
19797 | |||
19798 | |||
19799 | |||
19800 | |||
19801 | |||
19802 | ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::clone(ASTContext &C) const { |
||
19803 | auto *A = new (C) ObjCBridgeRelatedAttr(C, *this, relatedClass, classMethod, instanceMethod); |
||
19804 | A->Inherited = Inherited; |
||
19805 | A->IsPackExpansion = IsPackExpansion; |
||
19806 | A->setImplicit(Implicit); |
||
19807 | return A; |
||
19808 | } |
||
19809 | |||
19810 | void ObjCBridgeRelatedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19811 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19812 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19813 | switch (getAttributeSpellingListIndex()) { |
||
19814 | default: |
||
19815 | llvm_unreachable("Unknown attribute spelling!"); |
||
19816 | break; |
||
19817 | case 0 : { |
||
19818 | OS << " __attribute__((objc_bridge_related"; |
||
19819 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19820 | OS << "" << (getRelatedClass() ? getRelatedClass()->getName() : "") << ""; |
||
19821 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19822 | OS << "" << (getClassMethod() ? getClassMethod()->getName() : "") << ""; |
||
19823 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19824 | OS << "" << (getInstanceMethod() ? getInstanceMethod()->getName() : "") << ""; |
||
19825 | if (!IsFirstArgument) |
||
19826 | OS << ")"; |
||
19827 | OS << "))"; |
||
19828 | break; |
||
19829 | } |
||
19830 | case 1 : { |
||
19831 | OS << " [[clang::objc_bridge_related"; |
||
19832 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19833 | OS << "" << (getRelatedClass() ? getRelatedClass()->getName() : "") << ""; |
||
19834 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19835 | OS << "" << (getClassMethod() ? getClassMethod()->getName() : "") << ""; |
||
19836 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19837 | OS << "" << (getInstanceMethod() ? getInstanceMethod()->getName() : "") << ""; |
||
19838 | if (!IsFirstArgument) |
||
19839 | OS << ")"; |
||
19840 | OS << "]]"; |
||
19841 | break; |
||
19842 | } |
||
19843 | case 2 : { |
||
19844 | OS << " [[clang::objc_bridge_related"; |
||
19845 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19846 | OS << "" << (getRelatedClass() ? getRelatedClass()->getName() : "") << ""; |
||
19847 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19848 | OS << "" << (getClassMethod() ? getClassMethod()->getName() : "") << ""; |
||
19849 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
19850 | OS << "" << (getInstanceMethod() ? getInstanceMethod()->getName() : "") << ""; |
||
19851 | if (!IsFirstArgument) |
||
19852 | OS << ")"; |
||
19853 | OS << "]]"; |
||
19854 | break; |
||
19855 | } |
||
19856 | } |
||
19857 | } |
||
19858 | |||
19859 | const char *ObjCBridgeRelatedAttr::getSpelling() const { |
||
19860 | switch (getAttributeSpellingListIndex()) { |
||
19861 | default: |
||
19862 | llvm_unreachable("Unknown attribute spelling!"); |
||
19863 | return "(No spelling)"; |
||
19864 | case 0: |
||
19865 | return "objc_bridge_related"; |
||
19866 | case 1: |
||
19867 | return "objc_bridge_related"; |
||
19868 | case 2: |
||
19869 | return "objc_bridge_related"; |
||
19870 | } |
||
19871 | } |
||
19872 | |||
19873 | |||
19874 | // ObjCClassStubAttr implementation |
||
19875 | |||
19876 | ObjCClassStubAttr *ObjCClassStubAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19877 | auto *A = new (Ctx) ObjCClassStubAttr(Ctx, CommonInfo); |
||
19878 | A->setImplicit(true); |
||
19879 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19880 | A->setAttributeSpellingListIndex(0); |
||
19881 | return A; |
||
19882 | } |
||
19883 | |||
19884 | ObjCClassStubAttr *ObjCClassStubAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19885 | auto *A = new (Ctx) ObjCClassStubAttr(Ctx, CommonInfo); |
||
19886 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19887 | A->setAttributeSpellingListIndex(0); |
||
19888 | return A; |
||
19889 | } |
||
19890 | |||
19891 | ObjCClassStubAttr *ObjCClassStubAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19892 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19893 | return CreateImplicit(Ctx, I); |
||
19894 | } |
||
19895 | |||
19896 | ObjCClassStubAttr *ObjCClassStubAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19897 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19898 | return Create(Ctx, I); |
||
19899 | } |
||
19900 | |||
19901 | ObjCClassStubAttr::ObjCClassStubAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19902 | ) |
||
19903 | : Attr(Ctx, CommonInfo, attr::ObjCClassStub, false) |
||
19904 | { |
||
19905 | } |
||
19906 | |||
19907 | ObjCClassStubAttr *ObjCClassStubAttr::clone(ASTContext &C) const { |
||
19908 | auto *A = new (C) ObjCClassStubAttr(C, *this); |
||
19909 | A->Inherited = Inherited; |
||
19910 | A->IsPackExpansion = IsPackExpansion; |
||
19911 | A->setImplicit(Implicit); |
||
19912 | return A; |
||
19913 | } |
||
19914 | |||
19915 | void ObjCClassStubAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19916 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19917 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19918 | switch (getAttributeSpellingListIndex()) { |
||
19919 | default: |
||
19920 | llvm_unreachable("Unknown attribute spelling!"); |
||
19921 | break; |
||
19922 | case 0 : { |
||
19923 | OS << " __attribute__((objc_class_stub"; |
||
19924 | OS << "))"; |
||
19925 | break; |
||
19926 | } |
||
19927 | case 1 : { |
||
19928 | OS << " [[clang::objc_class_stub"; |
||
19929 | OS << "]]"; |
||
19930 | break; |
||
19931 | } |
||
19932 | case 2 : { |
||
19933 | OS << " [[clang::objc_class_stub"; |
||
19934 | OS << "]]"; |
||
19935 | break; |
||
19936 | } |
||
19937 | } |
||
19938 | } |
||
19939 | |||
19940 | const char *ObjCClassStubAttr::getSpelling() const { |
||
19941 | switch (getAttributeSpellingListIndex()) { |
||
19942 | default: |
||
19943 | llvm_unreachable("Unknown attribute spelling!"); |
||
19944 | return "(No spelling)"; |
||
19945 | case 0: |
||
19946 | return "objc_class_stub"; |
||
19947 | case 1: |
||
19948 | return "objc_class_stub"; |
||
19949 | case 2: |
||
19950 | return "objc_class_stub"; |
||
19951 | } |
||
19952 | } |
||
19953 | |||
19954 | |||
19955 | // ObjCDesignatedInitializerAttr implementation |
||
19956 | |||
19957 | ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19958 | auto *A = new (Ctx) ObjCDesignatedInitializerAttr(Ctx, CommonInfo); |
||
19959 | A->setImplicit(true); |
||
19960 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19961 | A->setAttributeSpellingListIndex(0); |
||
19962 | return A; |
||
19963 | } |
||
19964 | |||
19965 | ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
19966 | auto *A = new (Ctx) ObjCDesignatedInitializerAttr(Ctx, CommonInfo); |
||
19967 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
19968 | A->setAttributeSpellingListIndex(0); |
||
19969 | return A; |
||
19970 | } |
||
19971 | |||
19972 | ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19973 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19974 | return CreateImplicit(Ctx, I); |
||
19975 | } |
||
19976 | |||
19977 | ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
19978 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
19979 | return Create(Ctx, I); |
||
19980 | } |
||
19981 | |||
19982 | ObjCDesignatedInitializerAttr::ObjCDesignatedInitializerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
19983 | ) |
||
19984 | : Attr(Ctx, CommonInfo, attr::ObjCDesignatedInitializer, false) |
||
19985 | { |
||
19986 | } |
||
19987 | |||
19988 | ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::clone(ASTContext &C) const { |
||
19989 | auto *A = new (C) ObjCDesignatedInitializerAttr(C, *this); |
||
19990 | A->Inherited = Inherited; |
||
19991 | A->IsPackExpansion = IsPackExpansion; |
||
19992 | A->setImplicit(Implicit); |
||
19993 | return A; |
||
19994 | } |
||
19995 | |||
19996 | void ObjCDesignatedInitializerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
19997 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
19998 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
19999 | switch (getAttributeSpellingListIndex()) { |
||
20000 | default: |
||
20001 | llvm_unreachable("Unknown attribute spelling!"); |
||
20002 | break; |
||
20003 | case 0 : { |
||
20004 | OS << " __attribute__((objc_designated_initializer"; |
||
20005 | OS << "))"; |
||
20006 | break; |
||
20007 | } |
||
20008 | case 1 : { |
||
20009 | OS << " [[clang::objc_designated_initializer"; |
||
20010 | OS << "]]"; |
||
20011 | break; |
||
20012 | } |
||
20013 | case 2 : { |
||
20014 | OS << " [[clang::objc_designated_initializer"; |
||
20015 | OS << "]]"; |
||
20016 | break; |
||
20017 | } |
||
20018 | } |
||
20019 | } |
||
20020 | |||
20021 | const char *ObjCDesignatedInitializerAttr::getSpelling() const { |
||
20022 | switch (getAttributeSpellingListIndex()) { |
||
20023 | default: |
||
20024 | llvm_unreachable("Unknown attribute spelling!"); |
||
20025 | return "(No spelling)"; |
||
20026 | case 0: |
||
20027 | return "objc_designated_initializer"; |
||
20028 | case 1: |
||
20029 | return "objc_designated_initializer"; |
||
20030 | case 2: |
||
20031 | return "objc_designated_initializer"; |
||
20032 | } |
||
20033 | } |
||
20034 | |||
20035 | |||
20036 | // ObjCDirectAttr implementation |
||
20037 | |||
20038 | ObjCDirectAttr *ObjCDirectAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20039 | auto *A = new (Ctx) ObjCDirectAttr(Ctx, CommonInfo); |
||
20040 | A->setImplicit(true); |
||
20041 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20042 | A->setAttributeSpellingListIndex(0); |
||
20043 | return A; |
||
20044 | } |
||
20045 | |||
20046 | ObjCDirectAttr *ObjCDirectAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20047 | auto *A = new (Ctx) ObjCDirectAttr(Ctx, CommonInfo); |
||
20048 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20049 | A->setAttributeSpellingListIndex(0); |
||
20050 | return A; |
||
20051 | } |
||
20052 | |||
20053 | ObjCDirectAttr *ObjCDirectAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20054 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20055 | return CreateImplicit(Ctx, I); |
||
20056 | } |
||
20057 | |||
20058 | ObjCDirectAttr *ObjCDirectAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20059 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20060 | return Create(Ctx, I); |
||
20061 | } |
||
20062 | |||
20063 | ObjCDirectAttr::ObjCDirectAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20064 | ) |
||
20065 | : Attr(Ctx, CommonInfo, attr::ObjCDirect, false) |
||
20066 | { |
||
20067 | } |
||
20068 | |||
20069 | ObjCDirectAttr *ObjCDirectAttr::clone(ASTContext &C) const { |
||
20070 | auto *A = new (C) ObjCDirectAttr(C, *this); |
||
20071 | A->Inherited = Inherited; |
||
20072 | A->IsPackExpansion = IsPackExpansion; |
||
20073 | A->setImplicit(Implicit); |
||
20074 | return A; |
||
20075 | } |
||
20076 | |||
20077 | void ObjCDirectAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20078 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20079 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20080 | switch (getAttributeSpellingListIndex()) { |
||
20081 | default: |
||
20082 | llvm_unreachable("Unknown attribute spelling!"); |
||
20083 | break; |
||
20084 | case 0 : { |
||
20085 | OS << " __attribute__((objc_direct"; |
||
20086 | OS << "))"; |
||
20087 | break; |
||
20088 | } |
||
20089 | case 1 : { |
||
20090 | OS << " [[clang::objc_direct"; |
||
20091 | OS << "]]"; |
||
20092 | break; |
||
20093 | } |
||
20094 | case 2 : { |
||
20095 | OS << " [[clang::objc_direct"; |
||
20096 | OS << "]]"; |
||
20097 | break; |
||
20098 | } |
||
20099 | } |
||
20100 | } |
||
20101 | |||
20102 | const char *ObjCDirectAttr::getSpelling() const { |
||
20103 | switch (getAttributeSpellingListIndex()) { |
||
20104 | default: |
||
20105 | llvm_unreachable("Unknown attribute spelling!"); |
||
20106 | return "(No spelling)"; |
||
20107 | case 0: |
||
20108 | return "objc_direct"; |
||
20109 | case 1: |
||
20110 | return "objc_direct"; |
||
20111 | case 2: |
||
20112 | return "objc_direct"; |
||
20113 | } |
||
20114 | } |
||
20115 | |||
20116 | |||
20117 | // ObjCDirectMembersAttr implementation |
||
20118 | |||
20119 | ObjCDirectMembersAttr *ObjCDirectMembersAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20120 | auto *A = new (Ctx) ObjCDirectMembersAttr(Ctx, CommonInfo); |
||
20121 | A->setImplicit(true); |
||
20122 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20123 | A->setAttributeSpellingListIndex(0); |
||
20124 | return A; |
||
20125 | } |
||
20126 | |||
20127 | ObjCDirectMembersAttr *ObjCDirectMembersAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20128 | auto *A = new (Ctx) ObjCDirectMembersAttr(Ctx, CommonInfo); |
||
20129 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20130 | A->setAttributeSpellingListIndex(0); |
||
20131 | return A; |
||
20132 | } |
||
20133 | |||
20134 | ObjCDirectMembersAttr *ObjCDirectMembersAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20135 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20136 | return CreateImplicit(Ctx, I); |
||
20137 | } |
||
20138 | |||
20139 | ObjCDirectMembersAttr *ObjCDirectMembersAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20140 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20141 | return Create(Ctx, I); |
||
20142 | } |
||
20143 | |||
20144 | ObjCDirectMembersAttr::ObjCDirectMembersAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20145 | ) |
||
20146 | : Attr(Ctx, CommonInfo, attr::ObjCDirectMembers, false) |
||
20147 | { |
||
20148 | } |
||
20149 | |||
20150 | ObjCDirectMembersAttr *ObjCDirectMembersAttr::clone(ASTContext &C) const { |
||
20151 | auto *A = new (C) ObjCDirectMembersAttr(C, *this); |
||
20152 | A->Inherited = Inherited; |
||
20153 | A->IsPackExpansion = IsPackExpansion; |
||
20154 | A->setImplicit(Implicit); |
||
20155 | return A; |
||
20156 | } |
||
20157 | |||
20158 | void ObjCDirectMembersAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20159 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20160 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20161 | switch (getAttributeSpellingListIndex()) { |
||
20162 | default: |
||
20163 | llvm_unreachable("Unknown attribute spelling!"); |
||
20164 | break; |
||
20165 | case 0 : { |
||
20166 | OS << " __attribute__((objc_direct_members"; |
||
20167 | OS << "))"; |
||
20168 | break; |
||
20169 | } |
||
20170 | case 1 : { |
||
20171 | OS << " [[clang::objc_direct_members"; |
||
20172 | OS << "]]"; |
||
20173 | break; |
||
20174 | } |
||
20175 | case 2 : { |
||
20176 | OS << " [[clang::objc_direct_members"; |
||
20177 | OS << "]]"; |
||
20178 | break; |
||
20179 | } |
||
20180 | } |
||
20181 | } |
||
20182 | |||
20183 | const char *ObjCDirectMembersAttr::getSpelling() const { |
||
20184 | switch (getAttributeSpellingListIndex()) { |
||
20185 | default: |
||
20186 | llvm_unreachable("Unknown attribute spelling!"); |
||
20187 | return "(No spelling)"; |
||
20188 | case 0: |
||
20189 | return "objc_direct_members"; |
||
20190 | case 1: |
||
20191 | return "objc_direct_members"; |
||
20192 | case 2: |
||
20193 | return "objc_direct_members"; |
||
20194 | } |
||
20195 | } |
||
20196 | |||
20197 | |||
20198 | // ObjCExceptionAttr implementation |
||
20199 | |||
20200 | ObjCExceptionAttr *ObjCExceptionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20201 | auto *A = new (Ctx) ObjCExceptionAttr(Ctx, CommonInfo); |
||
20202 | A->setImplicit(true); |
||
20203 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20204 | A->setAttributeSpellingListIndex(0); |
||
20205 | return A; |
||
20206 | } |
||
20207 | |||
20208 | ObjCExceptionAttr *ObjCExceptionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20209 | auto *A = new (Ctx) ObjCExceptionAttr(Ctx, CommonInfo); |
||
20210 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20211 | A->setAttributeSpellingListIndex(0); |
||
20212 | return A; |
||
20213 | } |
||
20214 | |||
20215 | ObjCExceptionAttr *ObjCExceptionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20216 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20217 | return CreateImplicit(Ctx, I); |
||
20218 | } |
||
20219 | |||
20220 | ObjCExceptionAttr *ObjCExceptionAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20221 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20222 | return Create(Ctx, I); |
||
20223 | } |
||
20224 | |||
20225 | ObjCExceptionAttr::ObjCExceptionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20226 | ) |
||
20227 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCException, false, false) |
||
20228 | { |
||
20229 | } |
||
20230 | |||
20231 | ObjCExceptionAttr *ObjCExceptionAttr::clone(ASTContext &C) const { |
||
20232 | auto *A = new (C) ObjCExceptionAttr(C, *this); |
||
20233 | A->Inherited = Inherited; |
||
20234 | A->IsPackExpansion = IsPackExpansion; |
||
20235 | A->setImplicit(Implicit); |
||
20236 | return A; |
||
20237 | } |
||
20238 | |||
20239 | void ObjCExceptionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20240 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20241 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20242 | switch (getAttributeSpellingListIndex()) { |
||
20243 | default: |
||
20244 | llvm_unreachable("Unknown attribute spelling!"); |
||
20245 | break; |
||
20246 | case 0 : { |
||
20247 | OS << " __attribute__((objc_exception"; |
||
20248 | OS << "))"; |
||
20249 | break; |
||
20250 | } |
||
20251 | case 1 : { |
||
20252 | OS << " [[clang::objc_exception"; |
||
20253 | OS << "]]"; |
||
20254 | break; |
||
20255 | } |
||
20256 | case 2 : { |
||
20257 | OS << " [[clang::objc_exception"; |
||
20258 | OS << "]]"; |
||
20259 | break; |
||
20260 | } |
||
20261 | } |
||
20262 | } |
||
20263 | |||
20264 | const char *ObjCExceptionAttr::getSpelling() const { |
||
20265 | switch (getAttributeSpellingListIndex()) { |
||
20266 | default: |
||
20267 | llvm_unreachable("Unknown attribute spelling!"); |
||
20268 | return "(No spelling)"; |
||
20269 | case 0: |
||
20270 | return "objc_exception"; |
||
20271 | case 1: |
||
20272 | return "objc_exception"; |
||
20273 | case 2: |
||
20274 | return "objc_exception"; |
||
20275 | } |
||
20276 | } |
||
20277 | |||
20278 | |||
20279 | // ObjCExplicitProtocolImplAttr implementation |
||
20280 | |||
20281 | ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20282 | auto *A = new (Ctx) ObjCExplicitProtocolImplAttr(Ctx, CommonInfo); |
||
20283 | A->setImplicit(true); |
||
20284 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20285 | A->setAttributeSpellingListIndex(0); |
||
20286 | return A; |
||
20287 | } |
||
20288 | |||
20289 | ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20290 | auto *A = new (Ctx) ObjCExplicitProtocolImplAttr(Ctx, CommonInfo); |
||
20291 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20292 | A->setAttributeSpellingListIndex(0); |
||
20293 | return A; |
||
20294 | } |
||
20295 | |||
20296 | ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20297 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20298 | return CreateImplicit(Ctx, I); |
||
20299 | } |
||
20300 | |||
20301 | ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20302 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20303 | return Create(Ctx, I); |
||
20304 | } |
||
20305 | |||
20306 | ObjCExplicitProtocolImplAttr::ObjCExplicitProtocolImplAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20307 | ) |
||
20308 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCExplicitProtocolImpl, false, false) |
||
20309 | { |
||
20310 | } |
||
20311 | |||
20312 | ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::clone(ASTContext &C) const { |
||
20313 | auto *A = new (C) ObjCExplicitProtocolImplAttr(C, *this); |
||
20314 | A->Inherited = Inherited; |
||
20315 | A->IsPackExpansion = IsPackExpansion; |
||
20316 | A->setImplicit(Implicit); |
||
20317 | return A; |
||
20318 | } |
||
20319 | |||
20320 | void ObjCExplicitProtocolImplAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20321 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20322 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20323 | switch (getAttributeSpellingListIndex()) { |
||
20324 | default: |
||
20325 | llvm_unreachable("Unknown attribute spelling!"); |
||
20326 | break; |
||
20327 | case 0 : { |
||
20328 | OS << " __attribute__((objc_protocol_requires_explicit_implementation"; |
||
20329 | OS << "))"; |
||
20330 | break; |
||
20331 | } |
||
20332 | case 1 : { |
||
20333 | OS << " [[clang::objc_protocol_requires_explicit_implementation"; |
||
20334 | OS << "]]"; |
||
20335 | break; |
||
20336 | } |
||
20337 | case 2 : { |
||
20338 | OS << " [[clang::objc_protocol_requires_explicit_implementation"; |
||
20339 | OS << "]]"; |
||
20340 | break; |
||
20341 | } |
||
20342 | } |
||
20343 | } |
||
20344 | |||
20345 | const char *ObjCExplicitProtocolImplAttr::getSpelling() const { |
||
20346 | switch (getAttributeSpellingListIndex()) { |
||
20347 | default: |
||
20348 | llvm_unreachable("Unknown attribute spelling!"); |
||
20349 | return "(No spelling)"; |
||
20350 | case 0: |
||
20351 | return "objc_protocol_requires_explicit_implementation"; |
||
20352 | case 1: |
||
20353 | return "objc_protocol_requires_explicit_implementation"; |
||
20354 | case 2: |
||
20355 | return "objc_protocol_requires_explicit_implementation"; |
||
20356 | } |
||
20357 | } |
||
20358 | |||
20359 | |||
20360 | // ObjCExternallyRetainedAttr implementation |
||
20361 | |||
20362 | ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20363 | auto *A = new (Ctx) ObjCExternallyRetainedAttr(Ctx, CommonInfo); |
||
20364 | A->setImplicit(true); |
||
20365 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20366 | A->setAttributeSpellingListIndex(0); |
||
20367 | return A; |
||
20368 | } |
||
20369 | |||
20370 | ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20371 | auto *A = new (Ctx) ObjCExternallyRetainedAttr(Ctx, CommonInfo); |
||
20372 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20373 | A->setAttributeSpellingListIndex(0); |
||
20374 | return A; |
||
20375 | } |
||
20376 | |||
20377 | ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20378 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20379 | return CreateImplicit(Ctx, I); |
||
20380 | } |
||
20381 | |||
20382 | ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20383 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20384 | return Create(Ctx, I); |
||
20385 | } |
||
20386 | |||
20387 | ObjCExternallyRetainedAttr::ObjCExternallyRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20388 | ) |
||
20389 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCExternallyRetained, false, false) |
||
20390 | { |
||
20391 | } |
||
20392 | |||
20393 | ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::clone(ASTContext &C) const { |
||
20394 | auto *A = new (C) ObjCExternallyRetainedAttr(C, *this); |
||
20395 | A->Inherited = Inherited; |
||
20396 | A->IsPackExpansion = IsPackExpansion; |
||
20397 | A->setImplicit(Implicit); |
||
20398 | return A; |
||
20399 | } |
||
20400 | |||
20401 | void ObjCExternallyRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20402 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20403 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20404 | switch (getAttributeSpellingListIndex()) { |
||
20405 | default: |
||
20406 | llvm_unreachable("Unknown attribute spelling!"); |
||
20407 | break; |
||
20408 | case 0 : { |
||
20409 | OS << " __attribute__((objc_externally_retained"; |
||
20410 | OS << "))"; |
||
20411 | break; |
||
20412 | } |
||
20413 | case 1 : { |
||
20414 | OS << " [[clang::objc_externally_retained"; |
||
20415 | OS << "]]"; |
||
20416 | break; |
||
20417 | } |
||
20418 | case 2 : { |
||
20419 | OS << " [[clang::objc_externally_retained"; |
||
20420 | OS << "]]"; |
||
20421 | break; |
||
20422 | } |
||
20423 | } |
||
20424 | } |
||
20425 | |||
20426 | const char *ObjCExternallyRetainedAttr::getSpelling() const { |
||
20427 | switch (getAttributeSpellingListIndex()) { |
||
20428 | default: |
||
20429 | llvm_unreachable("Unknown attribute spelling!"); |
||
20430 | return "(No spelling)"; |
||
20431 | case 0: |
||
20432 | return "objc_externally_retained"; |
||
20433 | case 1: |
||
20434 | return "objc_externally_retained"; |
||
20435 | case 2: |
||
20436 | return "objc_externally_retained"; |
||
20437 | } |
||
20438 | } |
||
20439 | |||
20440 | |||
20441 | // ObjCGCAttr implementation |
||
20442 | |||
20443 | ObjCGCAttr *ObjCGCAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) { |
||
20444 | auto *A = new (Ctx) ObjCGCAttr(Ctx, CommonInfo, Kind); |
||
20445 | A->setImplicit(true); |
||
20446 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20447 | A->setAttributeSpellingListIndex(0); |
||
20448 | return A; |
||
20449 | } |
||
20450 | |||
20451 | ObjCGCAttr *ObjCGCAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) { |
||
20452 | auto *A = new (Ctx) ObjCGCAttr(Ctx, CommonInfo, Kind); |
||
20453 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20454 | A->setAttributeSpellingListIndex(0); |
||
20455 | return A; |
||
20456 | } |
||
20457 | |||
20458 | ObjCGCAttr *ObjCGCAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20459 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20460 | return CreateImplicit(Ctx, Kind, I); |
||
20461 | } |
||
20462 | |||
20463 | ObjCGCAttr *ObjCGCAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20464 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20465 | return Create(Ctx, Kind, I); |
||
20466 | } |
||
20467 | |||
20468 | ObjCGCAttr::ObjCGCAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20469 | , IdentifierInfo * Kind |
||
20470 | ) |
||
20471 | : TypeAttr(Ctx, CommonInfo, attr::ObjCGC, false) |
||
20472 | , kind(Kind) |
||
20473 | { |
||
20474 | } |
||
20475 | |||
20476 | |||
20477 | |||
20478 | ObjCGCAttr *ObjCGCAttr::clone(ASTContext &C) const { |
||
20479 | auto *A = new (C) ObjCGCAttr(C, *this, kind); |
||
20480 | A->Inherited = Inherited; |
||
20481 | A->IsPackExpansion = IsPackExpansion; |
||
20482 | A->setImplicit(Implicit); |
||
20483 | return A; |
||
20484 | } |
||
20485 | |||
20486 | void ObjCGCAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20487 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20488 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20489 | switch (getAttributeSpellingListIndex()) { |
||
20490 | default: |
||
20491 | llvm_unreachable("Unknown attribute spelling!"); |
||
20492 | break; |
||
20493 | case 0 : { |
||
20494 | OS << " __attribute__((objc_gc"; |
||
20495 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
20496 | OS << "" << (getKind() ? getKind()->getName() : "") << ""; |
||
20497 | if (!IsFirstArgument) |
||
20498 | OS << ")"; |
||
20499 | OS << "))"; |
||
20500 | break; |
||
20501 | } |
||
20502 | case 1 : { |
||
20503 | OS << " [[clang::objc_gc"; |
||
20504 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
20505 | OS << "" << (getKind() ? getKind()->getName() : "") << ""; |
||
20506 | if (!IsFirstArgument) |
||
20507 | OS << ")"; |
||
20508 | OS << "]]"; |
||
20509 | break; |
||
20510 | } |
||
20511 | case 2 : { |
||
20512 | OS << " [[clang::objc_gc"; |
||
20513 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
20514 | OS << "" << (getKind() ? getKind()->getName() : "") << ""; |
||
20515 | if (!IsFirstArgument) |
||
20516 | OS << ")"; |
||
20517 | OS << "]]"; |
||
20518 | break; |
||
20519 | } |
||
20520 | } |
||
20521 | } |
||
20522 | |||
20523 | const char *ObjCGCAttr::getSpelling() const { |
||
20524 | switch (getAttributeSpellingListIndex()) { |
||
20525 | default: |
||
20526 | llvm_unreachable("Unknown attribute spelling!"); |
||
20527 | return "(No spelling)"; |
||
20528 | case 0: |
||
20529 | return "objc_gc"; |
||
20530 | case 1: |
||
20531 | return "objc_gc"; |
||
20532 | case 2: |
||
20533 | return "objc_gc"; |
||
20534 | } |
||
20535 | } |
||
20536 | |||
20537 | |||
20538 | // ObjCIndependentClassAttr implementation |
||
20539 | |||
20540 | ObjCIndependentClassAttr *ObjCIndependentClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20541 | auto *A = new (Ctx) ObjCIndependentClassAttr(Ctx, CommonInfo); |
||
20542 | A->setImplicit(true); |
||
20543 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20544 | A->setAttributeSpellingListIndex(0); |
||
20545 | return A; |
||
20546 | } |
||
20547 | |||
20548 | ObjCIndependentClassAttr *ObjCIndependentClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20549 | auto *A = new (Ctx) ObjCIndependentClassAttr(Ctx, CommonInfo); |
||
20550 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20551 | A->setAttributeSpellingListIndex(0); |
||
20552 | return A; |
||
20553 | } |
||
20554 | |||
20555 | ObjCIndependentClassAttr *ObjCIndependentClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20556 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20557 | return CreateImplicit(Ctx, I); |
||
20558 | } |
||
20559 | |||
20560 | ObjCIndependentClassAttr *ObjCIndependentClassAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20561 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20562 | return Create(Ctx, I); |
||
20563 | } |
||
20564 | |||
20565 | ObjCIndependentClassAttr::ObjCIndependentClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20566 | ) |
||
20567 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCIndependentClass, false, false) |
||
20568 | { |
||
20569 | } |
||
20570 | |||
20571 | ObjCIndependentClassAttr *ObjCIndependentClassAttr::clone(ASTContext &C) const { |
||
20572 | auto *A = new (C) ObjCIndependentClassAttr(C, *this); |
||
20573 | A->Inherited = Inherited; |
||
20574 | A->IsPackExpansion = IsPackExpansion; |
||
20575 | A->setImplicit(Implicit); |
||
20576 | return A; |
||
20577 | } |
||
20578 | |||
20579 | void ObjCIndependentClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20580 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20581 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20582 | switch (getAttributeSpellingListIndex()) { |
||
20583 | default: |
||
20584 | llvm_unreachable("Unknown attribute spelling!"); |
||
20585 | break; |
||
20586 | case 0 : { |
||
20587 | OS << " __attribute__((objc_independent_class"; |
||
20588 | OS << "))"; |
||
20589 | break; |
||
20590 | } |
||
20591 | case 1 : { |
||
20592 | OS << " [[clang::objc_independent_class"; |
||
20593 | OS << "]]"; |
||
20594 | break; |
||
20595 | } |
||
20596 | case 2 : { |
||
20597 | OS << " [[clang::objc_independent_class"; |
||
20598 | OS << "]]"; |
||
20599 | break; |
||
20600 | } |
||
20601 | } |
||
20602 | } |
||
20603 | |||
20604 | const char *ObjCIndependentClassAttr::getSpelling() const { |
||
20605 | switch (getAttributeSpellingListIndex()) { |
||
20606 | default: |
||
20607 | llvm_unreachable("Unknown attribute spelling!"); |
||
20608 | return "(No spelling)"; |
||
20609 | case 0: |
||
20610 | return "objc_independent_class"; |
||
20611 | case 1: |
||
20612 | return "objc_independent_class"; |
||
20613 | case 2: |
||
20614 | return "objc_independent_class"; |
||
20615 | } |
||
20616 | } |
||
20617 | |||
20618 | |||
20619 | // ObjCInertUnsafeUnretainedAttr implementation |
||
20620 | |||
20621 | ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20622 | auto *A = new (Ctx) ObjCInertUnsafeUnretainedAttr(Ctx, CommonInfo); |
||
20623 | A->setImplicit(true); |
||
20624 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20625 | A->setAttributeSpellingListIndex(0); |
||
20626 | return A; |
||
20627 | } |
||
20628 | |||
20629 | ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20630 | auto *A = new (Ctx) ObjCInertUnsafeUnretainedAttr(Ctx, CommonInfo); |
||
20631 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20632 | A->setAttributeSpellingListIndex(0); |
||
20633 | return A; |
||
20634 | } |
||
20635 | |||
20636 | ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20637 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20638 | return CreateImplicit(Ctx, I); |
||
20639 | } |
||
20640 | |||
20641 | ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20642 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20643 | return Create(Ctx, I); |
||
20644 | } |
||
20645 | |||
20646 | ObjCInertUnsafeUnretainedAttr::ObjCInertUnsafeUnretainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20647 | ) |
||
20648 | : TypeAttr(Ctx, CommonInfo, attr::ObjCInertUnsafeUnretained, false) |
||
20649 | { |
||
20650 | } |
||
20651 | |||
20652 | ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::clone(ASTContext &C) const { |
||
20653 | auto *A = new (C) ObjCInertUnsafeUnretainedAttr(C, *this); |
||
20654 | A->Inherited = Inherited; |
||
20655 | A->IsPackExpansion = IsPackExpansion; |
||
20656 | A->setImplicit(Implicit); |
||
20657 | return A; |
||
20658 | } |
||
20659 | |||
20660 | void ObjCInertUnsafeUnretainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20661 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20662 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20663 | switch (getAttributeSpellingListIndex()) { |
||
20664 | default: |
||
20665 | llvm_unreachable("Unknown attribute spelling!"); |
||
20666 | break; |
||
20667 | case 0 : { |
||
20668 | OS << " __unsafe_unretained"; |
||
20669 | OS << ""; |
||
20670 | break; |
||
20671 | } |
||
20672 | } |
||
20673 | } |
||
20674 | |||
20675 | const char *ObjCInertUnsafeUnretainedAttr::getSpelling() const { |
||
20676 | switch (getAttributeSpellingListIndex()) { |
||
20677 | default: |
||
20678 | llvm_unreachable("Unknown attribute spelling!"); |
||
20679 | return "(No spelling)"; |
||
20680 | case 0: |
||
20681 | return "__unsafe_unretained"; |
||
20682 | } |
||
20683 | } |
||
20684 | |||
20685 | |||
20686 | // ObjCKindOfAttr implementation |
||
20687 | |||
20688 | ObjCKindOfAttr *ObjCKindOfAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20689 | auto *A = new (Ctx) ObjCKindOfAttr(Ctx, CommonInfo); |
||
20690 | A->setImplicit(true); |
||
20691 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20692 | A->setAttributeSpellingListIndex(0); |
||
20693 | return A; |
||
20694 | } |
||
20695 | |||
20696 | ObjCKindOfAttr *ObjCKindOfAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20697 | auto *A = new (Ctx) ObjCKindOfAttr(Ctx, CommonInfo); |
||
20698 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20699 | A->setAttributeSpellingListIndex(0); |
||
20700 | return A; |
||
20701 | } |
||
20702 | |||
20703 | ObjCKindOfAttr *ObjCKindOfAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20704 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20705 | return CreateImplicit(Ctx, I); |
||
20706 | } |
||
20707 | |||
20708 | ObjCKindOfAttr *ObjCKindOfAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20709 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20710 | return Create(Ctx, I); |
||
20711 | } |
||
20712 | |||
20713 | ObjCKindOfAttr::ObjCKindOfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20714 | ) |
||
20715 | : TypeAttr(Ctx, CommonInfo, attr::ObjCKindOf, false) |
||
20716 | { |
||
20717 | } |
||
20718 | |||
20719 | ObjCKindOfAttr *ObjCKindOfAttr::clone(ASTContext &C) const { |
||
20720 | auto *A = new (C) ObjCKindOfAttr(C, *this); |
||
20721 | A->Inherited = Inherited; |
||
20722 | A->IsPackExpansion = IsPackExpansion; |
||
20723 | A->setImplicit(Implicit); |
||
20724 | return A; |
||
20725 | } |
||
20726 | |||
20727 | void ObjCKindOfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20728 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20729 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20730 | switch (getAttributeSpellingListIndex()) { |
||
20731 | default: |
||
20732 | llvm_unreachable("Unknown attribute spelling!"); |
||
20733 | break; |
||
20734 | case 0 : { |
||
20735 | OS << " __kindof"; |
||
20736 | OS << ""; |
||
20737 | break; |
||
20738 | } |
||
20739 | } |
||
20740 | } |
||
20741 | |||
20742 | const char *ObjCKindOfAttr::getSpelling() const { |
||
20743 | switch (getAttributeSpellingListIndex()) { |
||
20744 | default: |
||
20745 | llvm_unreachable("Unknown attribute spelling!"); |
||
20746 | return "(No spelling)"; |
||
20747 | case 0: |
||
20748 | return "__kindof"; |
||
20749 | } |
||
20750 | } |
||
20751 | |||
20752 | |||
20753 | // ObjCMethodFamilyAttr implementation |
||
20754 | |||
20755 | ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::CreateImplicit(ASTContext &Ctx, FamilyKind Family, const AttributeCommonInfo &CommonInfo) { |
||
20756 | auto *A = new (Ctx) ObjCMethodFamilyAttr(Ctx, CommonInfo, Family); |
||
20757 | A->setImplicit(true); |
||
20758 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20759 | A->setAttributeSpellingListIndex(0); |
||
20760 | return A; |
||
20761 | } |
||
20762 | |||
20763 | ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::Create(ASTContext &Ctx, FamilyKind Family, const AttributeCommonInfo &CommonInfo) { |
||
20764 | auto *A = new (Ctx) ObjCMethodFamilyAttr(Ctx, CommonInfo, Family); |
||
20765 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20766 | A->setAttributeSpellingListIndex(0); |
||
20767 | return A; |
||
20768 | } |
||
20769 | |||
20770 | ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::CreateImplicit(ASTContext &Ctx, FamilyKind Family, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20771 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20772 | return CreateImplicit(Ctx, Family, I); |
||
20773 | } |
||
20774 | |||
20775 | ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::Create(ASTContext &Ctx, FamilyKind Family, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20776 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20777 | return Create(Ctx, Family, I); |
||
20778 | } |
||
20779 | |||
20780 | ObjCMethodFamilyAttr::ObjCMethodFamilyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20781 | , FamilyKind Family |
||
20782 | ) |
||
20783 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCMethodFamily, false, false) |
||
20784 | , family(Family) |
||
20785 | { |
||
20786 | } |
||
20787 | |||
20788 | |||
20789 | |||
20790 | bool ObjCMethodFamilyAttr::ConvertStrToFamilyKind(StringRef Val, FamilyKind &Out) { |
||
20791 | std::optional<FamilyKind> R = llvm::StringSwitch<std::optional<FamilyKind>>(Val) |
||
20792 | .Case("none", ObjCMethodFamilyAttr::OMF_None) |
||
20793 | .Case("alloc", ObjCMethodFamilyAttr::OMF_alloc) |
||
20794 | .Case("copy", ObjCMethodFamilyAttr::OMF_copy) |
||
20795 | .Case("init", ObjCMethodFamilyAttr::OMF_init) |
||
20796 | .Case("mutableCopy", ObjCMethodFamilyAttr::OMF_mutableCopy) |
||
20797 | .Case("new", ObjCMethodFamilyAttr::OMF_new) |
||
20798 | .Default(std::optional<FamilyKind>()); |
||
20799 | if (R) { |
||
20800 | Out = *R; |
||
20801 | return true; |
||
20802 | } |
||
20803 | return false; |
||
20804 | } |
||
20805 | |||
20806 | const char *ObjCMethodFamilyAttr::ConvertFamilyKindToStr(FamilyKind Val) { |
||
20807 | switch(Val) { |
||
20808 | case ObjCMethodFamilyAttr::OMF_None: return "none"; |
||
20809 | case ObjCMethodFamilyAttr::OMF_alloc: return "alloc"; |
||
20810 | case ObjCMethodFamilyAttr::OMF_copy: return "copy"; |
||
20811 | case ObjCMethodFamilyAttr::OMF_init: return "init"; |
||
20812 | case ObjCMethodFamilyAttr::OMF_mutableCopy: return "mutableCopy"; |
||
20813 | case ObjCMethodFamilyAttr::OMF_new: return "new"; |
||
20814 | } |
||
20815 | llvm_unreachable("No enumerator with that value"); |
||
20816 | } |
||
20817 | ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::clone(ASTContext &C) const { |
||
20818 | auto *A = new (C) ObjCMethodFamilyAttr(C, *this, family); |
||
20819 | A->Inherited = Inherited; |
||
20820 | A->IsPackExpansion = IsPackExpansion; |
||
20821 | A->setImplicit(Implicit); |
||
20822 | return A; |
||
20823 | } |
||
20824 | |||
20825 | void ObjCMethodFamilyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20826 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20827 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20828 | switch (getAttributeSpellingListIndex()) { |
||
20829 | default: |
||
20830 | llvm_unreachable("Unknown attribute spelling!"); |
||
20831 | break; |
||
20832 | case 0 : { |
||
20833 | OS << " __attribute__((objc_method_family"; |
||
20834 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
20835 | OS << "\"" << ObjCMethodFamilyAttr::ConvertFamilyKindToStr(getFamily()) << "\""; |
||
20836 | if (!IsFirstArgument) |
||
20837 | OS << ")"; |
||
20838 | OS << "))"; |
||
20839 | break; |
||
20840 | } |
||
20841 | case 1 : { |
||
20842 | OS << " [[clang::objc_method_family"; |
||
20843 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
20844 | OS << "\"" << ObjCMethodFamilyAttr::ConvertFamilyKindToStr(getFamily()) << "\""; |
||
20845 | if (!IsFirstArgument) |
||
20846 | OS << ")"; |
||
20847 | OS << "]]"; |
||
20848 | break; |
||
20849 | } |
||
20850 | case 2 : { |
||
20851 | OS << " [[clang::objc_method_family"; |
||
20852 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
20853 | OS << "\"" << ObjCMethodFamilyAttr::ConvertFamilyKindToStr(getFamily()) << "\""; |
||
20854 | if (!IsFirstArgument) |
||
20855 | OS << ")"; |
||
20856 | OS << "]]"; |
||
20857 | break; |
||
20858 | } |
||
20859 | } |
||
20860 | } |
||
20861 | |||
20862 | const char *ObjCMethodFamilyAttr::getSpelling() const { |
||
20863 | switch (getAttributeSpellingListIndex()) { |
||
20864 | default: |
||
20865 | llvm_unreachable("Unknown attribute spelling!"); |
||
20866 | return "(No spelling)"; |
||
20867 | case 0: |
||
20868 | return "objc_method_family"; |
||
20869 | case 1: |
||
20870 | return "objc_method_family"; |
||
20871 | case 2: |
||
20872 | return "objc_method_family"; |
||
20873 | } |
||
20874 | } |
||
20875 | |||
20876 | |||
20877 | // ObjCNSObjectAttr implementation |
||
20878 | |||
20879 | ObjCNSObjectAttr *ObjCNSObjectAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20880 | auto *A = new (Ctx) ObjCNSObjectAttr(Ctx, CommonInfo); |
||
20881 | A->setImplicit(true); |
||
20882 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20883 | A->setAttributeSpellingListIndex(0); |
||
20884 | return A; |
||
20885 | } |
||
20886 | |||
20887 | ObjCNSObjectAttr *ObjCNSObjectAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20888 | auto *A = new (Ctx) ObjCNSObjectAttr(Ctx, CommonInfo); |
||
20889 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20890 | A->setAttributeSpellingListIndex(0); |
||
20891 | return A; |
||
20892 | } |
||
20893 | |||
20894 | ObjCNSObjectAttr *ObjCNSObjectAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20895 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20896 | return CreateImplicit(Ctx, I); |
||
20897 | } |
||
20898 | |||
20899 | ObjCNSObjectAttr *ObjCNSObjectAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20900 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20901 | return Create(Ctx, I); |
||
20902 | } |
||
20903 | |||
20904 | ObjCNSObjectAttr::ObjCNSObjectAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20905 | ) |
||
20906 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCNSObject, false, false) |
||
20907 | { |
||
20908 | } |
||
20909 | |||
20910 | ObjCNSObjectAttr *ObjCNSObjectAttr::clone(ASTContext &C) const { |
||
20911 | auto *A = new (C) ObjCNSObjectAttr(C, *this); |
||
20912 | A->Inherited = Inherited; |
||
20913 | A->IsPackExpansion = IsPackExpansion; |
||
20914 | A->setImplicit(Implicit); |
||
20915 | return A; |
||
20916 | } |
||
20917 | |||
20918 | void ObjCNSObjectAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
20919 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
20920 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
20921 | switch (getAttributeSpellingListIndex()) { |
||
20922 | default: |
||
20923 | llvm_unreachable("Unknown attribute spelling!"); |
||
20924 | break; |
||
20925 | case 0 : { |
||
20926 | OS << " __attribute__((NSObject"; |
||
20927 | OS << "))"; |
||
20928 | break; |
||
20929 | } |
||
20930 | case 1 : { |
||
20931 | OS << " [[clang::NSObject"; |
||
20932 | OS << "]]"; |
||
20933 | break; |
||
20934 | } |
||
20935 | case 2 : { |
||
20936 | OS << " [[clang::NSObject"; |
||
20937 | OS << "]]"; |
||
20938 | break; |
||
20939 | } |
||
20940 | } |
||
20941 | } |
||
20942 | |||
20943 | const char *ObjCNSObjectAttr::getSpelling() const { |
||
20944 | switch (getAttributeSpellingListIndex()) { |
||
20945 | default: |
||
20946 | llvm_unreachable("Unknown attribute spelling!"); |
||
20947 | return "(No spelling)"; |
||
20948 | case 0: |
||
20949 | return "NSObject"; |
||
20950 | case 1: |
||
20951 | return "NSObject"; |
||
20952 | case 2: |
||
20953 | return "NSObject"; |
||
20954 | } |
||
20955 | } |
||
20956 | |||
20957 | |||
20958 | // ObjCNonLazyClassAttr implementation |
||
20959 | |||
20960 | ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20961 | auto *A = new (Ctx) ObjCNonLazyClassAttr(Ctx, CommonInfo); |
||
20962 | A->setImplicit(true); |
||
20963 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20964 | A->setAttributeSpellingListIndex(0); |
||
20965 | return A; |
||
20966 | } |
||
20967 | |||
20968 | ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
20969 | auto *A = new (Ctx) ObjCNonLazyClassAttr(Ctx, CommonInfo); |
||
20970 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
20971 | A->setAttributeSpellingListIndex(0); |
||
20972 | return A; |
||
20973 | } |
||
20974 | |||
20975 | ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20976 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20977 | return CreateImplicit(Ctx, I); |
||
20978 | } |
||
20979 | |||
20980 | ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
20981 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
20982 | return Create(Ctx, I); |
||
20983 | } |
||
20984 | |||
20985 | ObjCNonLazyClassAttr::ObjCNonLazyClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
20986 | ) |
||
20987 | : Attr(Ctx, CommonInfo, attr::ObjCNonLazyClass, false) |
||
20988 | { |
||
20989 | } |
||
20990 | |||
20991 | ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::clone(ASTContext &C) const { |
||
20992 | auto *A = new (C) ObjCNonLazyClassAttr(C, *this); |
||
20993 | A->Inherited = Inherited; |
||
20994 | A->IsPackExpansion = IsPackExpansion; |
||
20995 | A->setImplicit(Implicit); |
||
20996 | return A; |
||
20997 | } |
||
20998 | |||
20999 | void ObjCNonLazyClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21000 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21001 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21002 | switch (getAttributeSpellingListIndex()) { |
||
21003 | default: |
||
21004 | llvm_unreachable("Unknown attribute spelling!"); |
||
21005 | break; |
||
21006 | case 0 : { |
||
21007 | OS << " __attribute__((objc_nonlazy_class"; |
||
21008 | OS << "))"; |
||
21009 | break; |
||
21010 | } |
||
21011 | case 1 : { |
||
21012 | OS << " [[clang::objc_nonlazy_class"; |
||
21013 | OS << "]]"; |
||
21014 | break; |
||
21015 | } |
||
21016 | case 2 : { |
||
21017 | OS << " [[clang::objc_nonlazy_class"; |
||
21018 | OS << "]]"; |
||
21019 | break; |
||
21020 | } |
||
21021 | } |
||
21022 | } |
||
21023 | |||
21024 | const char *ObjCNonLazyClassAttr::getSpelling() const { |
||
21025 | switch (getAttributeSpellingListIndex()) { |
||
21026 | default: |
||
21027 | llvm_unreachable("Unknown attribute spelling!"); |
||
21028 | return "(No spelling)"; |
||
21029 | case 0: |
||
21030 | return "objc_nonlazy_class"; |
||
21031 | case 1: |
||
21032 | return "objc_nonlazy_class"; |
||
21033 | case 2: |
||
21034 | return "objc_nonlazy_class"; |
||
21035 | } |
||
21036 | } |
||
21037 | |||
21038 | |||
21039 | // ObjCNonRuntimeProtocolAttr implementation |
||
21040 | |||
21041 | ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21042 | auto *A = new (Ctx) ObjCNonRuntimeProtocolAttr(Ctx, CommonInfo); |
||
21043 | A->setImplicit(true); |
||
21044 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21045 | A->setAttributeSpellingListIndex(0); |
||
21046 | return A; |
||
21047 | } |
||
21048 | |||
21049 | ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21050 | auto *A = new (Ctx) ObjCNonRuntimeProtocolAttr(Ctx, CommonInfo); |
||
21051 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21052 | A->setAttributeSpellingListIndex(0); |
||
21053 | return A; |
||
21054 | } |
||
21055 | |||
21056 | ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21057 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21058 | return CreateImplicit(Ctx, I); |
||
21059 | } |
||
21060 | |||
21061 | ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21062 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21063 | return Create(Ctx, I); |
||
21064 | } |
||
21065 | |||
21066 | ObjCNonRuntimeProtocolAttr::ObjCNonRuntimeProtocolAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21067 | ) |
||
21068 | : Attr(Ctx, CommonInfo, attr::ObjCNonRuntimeProtocol, false) |
||
21069 | { |
||
21070 | } |
||
21071 | |||
21072 | ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::clone(ASTContext &C) const { |
||
21073 | auto *A = new (C) ObjCNonRuntimeProtocolAttr(C, *this); |
||
21074 | A->Inherited = Inherited; |
||
21075 | A->IsPackExpansion = IsPackExpansion; |
||
21076 | A->setImplicit(Implicit); |
||
21077 | return A; |
||
21078 | } |
||
21079 | |||
21080 | void ObjCNonRuntimeProtocolAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21081 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21082 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21083 | switch (getAttributeSpellingListIndex()) { |
||
21084 | default: |
||
21085 | llvm_unreachable("Unknown attribute spelling!"); |
||
21086 | break; |
||
21087 | case 0 : { |
||
21088 | OS << " __attribute__((objc_non_runtime_protocol"; |
||
21089 | OS << "))"; |
||
21090 | break; |
||
21091 | } |
||
21092 | case 1 : { |
||
21093 | OS << " [[clang::objc_non_runtime_protocol"; |
||
21094 | OS << "]]"; |
||
21095 | break; |
||
21096 | } |
||
21097 | case 2 : { |
||
21098 | OS << " [[clang::objc_non_runtime_protocol"; |
||
21099 | OS << "]]"; |
||
21100 | break; |
||
21101 | } |
||
21102 | } |
||
21103 | } |
||
21104 | |||
21105 | const char *ObjCNonRuntimeProtocolAttr::getSpelling() const { |
||
21106 | switch (getAttributeSpellingListIndex()) { |
||
21107 | default: |
||
21108 | llvm_unreachable("Unknown attribute spelling!"); |
||
21109 | return "(No spelling)"; |
||
21110 | case 0: |
||
21111 | return "objc_non_runtime_protocol"; |
||
21112 | case 1: |
||
21113 | return "objc_non_runtime_protocol"; |
||
21114 | case 2: |
||
21115 | return "objc_non_runtime_protocol"; |
||
21116 | } |
||
21117 | } |
||
21118 | |||
21119 | |||
21120 | // ObjCOwnershipAttr implementation |
||
21121 | |||
21122 | ObjCOwnershipAttr *ObjCOwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) { |
||
21123 | auto *A = new (Ctx) ObjCOwnershipAttr(Ctx, CommonInfo, Kind); |
||
21124 | A->setImplicit(true); |
||
21125 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21126 | A->setAttributeSpellingListIndex(0); |
||
21127 | return A; |
||
21128 | } |
||
21129 | |||
21130 | ObjCOwnershipAttr *ObjCOwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) { |
||
21131 | auto *A = new (Ctx) ObjCOwnershipAttr(Ctx, CommonInfo, Kind); |
||
21132 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21133 | A->setAttributeSpellingListIndex(0); |
||
21134 | return A; |
||
21135 | } |
||
21136 | |||
21137 | ObjCOwnershipAttr *ObjCOwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21138 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21139 | return CreateImplicit(Ctx, Kind, I); |
||
21140 | } |
||
21141 | |||
21142 | ObjCOwnershipAttr *ObjCOwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21143 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21144 | return Create(Ctx, Kind, I); |
||
21145 | } |
||
21146 | |||
21147 | ObjCOwnershipAttr::ObjCOwnershipAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21148 | , IdentifierInfo * Kind |
||
21149 | ) |
||
21150 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCOwnership, false, false) |
||
21151 | , kind(Kind) |
||
21152 | { |
||
21153 | } |
||
21154 | |||
21155 | |||
21156 | |||
21157 | ObjCOwnershipAttr *ObjCOwnershipAttr::clone(ASTContext &C) const { |
||
21158 | auto *A = new (C) ObjCOwnershipAttr(C, *this, kind); |
||
21159 | A->Inherited = Inherited; |
||
21160 | A->IsPackExpansion = IsPackExpansion; |
||
21161 | A->setImplicit(Implicit); |
||
21162 | return A; |
||
21163 | } |
||
21164 | |||
21165 | void ObjCOwnershipAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21166 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21167 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21168 | switch (getAttributeSpellingListIndex()) { |
||
21169 | default: |
||
21170 | llvm_unreachable("Unknown attribute spelling!"); |
||
21171 | break; |
||
21172 | case 0 : { |
||
21173 | OS << " __attribute__((objc_ownership"; |
||
21174 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
21175 | OS << "" << (getKind() ? getKind()->getName() : "") << ""; |
||
21176 | if (!IsFirstArgument) |
||
21177 | OS << ")"; |
||
21178 | OS << "))"; |
||
21179 | break; |
||
21180 | } |
||
21181 | case 1 : { |
||
21182 | OS << " [[clang::objc_ownership"; |
||
21183 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
21184 | OS << "" << (getKind() ? getKind()->getName() : "") << ""; |
||
21185 | if (!IsFirstArgument) |
||
21186 | OS << ")"; |
||
21187 | OS << "]]"; |
||
21188 | break; |
||
21189 | } |
||
21190 | case 2 : { |
||
21191 | OS << " [[clang::objc_ownership"; |
||
21192 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
21193 | OS << "" << (getKind() ? getKind()->getName() : "") << ""; |
||
21194 | if (!IsFirstArgument) |
||
21195 | OS << ")"; |
||
21196 | OS << "]]"; |
||
21197 | break; |
||
21198 | } |
||
21199 | } |
||
21200 | } |
||
21201 | |||
21202 | const char *ObjCOwnershipAttr::getSpelling() const { |
||
21203 | switch (getAttributeSpellingListIndex()) { |
||
21204 | default: |
||
21205 | llvm_unreachable("Unknown attribute spelling!"); |
||
21206 | return "(No spelling)"; |
||
21207 | case 0: |
||
21208 | return "objc_ownership"; |
||
21209 | case 1: |
||
21210 | return "objc_ownership"; |
||
21211 | case 2: |
||
21212 | return "objc_ownership"; |
||
21213 | } |
||
21214 | } |
||
21215 | |||
21216 | |||
21217 | // ObjCPreciseLifetimeAttr implementation |
||
21218 | |||
21219 | ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21220 | auto *A = new (Ctx) ObjCPreciseLifetimeAttr(Ctx, CommonInfo); |
||
21221 | A->setImplicit(true); |
||
21222 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21223 | A->setAttributeSpellingListIndex(0); |
||
21224 | return A; |
||
21225 | } |
||
21226 | |||
21227 | ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21228 | auto *A = new (Ctx) ObjCPreciseLifetimeAttr(Ctx, CommonInfo); |
||
21229 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21230 | A->setAttributeSpellingListIndex(0); |
||
21231 | return A; |
||
21232 | } |
||
21233 | |||
21234 | ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21235 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21236 | return CreateImplicit(Ctx, I); |
||
21237 | } |
||
21238 | |||
21239 | ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21240 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21241 | return Create(Ctx, I); |
||
21242 | } |
||
21243 | |||
21244 | ObjCPreciseLifetimeAttr::ObjCPreciseLifetimeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21245 | ) |
||
21246 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCPreciseLifetime, false, false) |
||
21247 | { |
||
21248 | } |
||
21249 | |||
21250 | ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::clone(ASTContext &C) const { |
||
21251 | auto *A = new (C) ObjCPreciseLifetimeAttr(C, *this); |
||
21252 | A->Inherited = Inherited; |
||
21253 | A->IsPackExpansion = IsPackExpansion; |
||
21254 | A->setImplicit(Implicit); |
||
21255 | return A; |
||
21256 | } |
||
21257 | |||
21258 | void ObjCPreciseLifetimeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21259 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21260 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21261 | switch (getAttributeSpellingListIndex()) { |
||
21262 | default: |
||
21263 | llvm_unreachable("Unknown attribute spelling!"); |
||
21264 | break; |
||
21265 | case 0 : { |
||
21266 | OS << " __attribute__((objc_precise_lifetime"; |
||
21267 | OS << "))"; |
||
21268 | break; |
||
21269 | } |
||
21270 | case 1 : { |
||
21271 | OS << " [[clang::objc_precise_lifetime"; |
||
21272 | OS << "]]"; |
||
21273 | break; |
||
21274 | } |
||
21275 | case 2 : { |
||
21276 | OS << " [[clang::objc_precise_lifetime"; |
||
21277 | OS << "]]"; |
||
21278 | break; |
||
21279 | } |
||
21280 | } |
||
21281 | } |
||
21282 | |||
21283 | const char *ObjCPreciseLifetimeAttr::getSpelling() const { |
||
21284 | switch (getAttributeSpellingListIndex()) { |
||
21285 | default: |
||
21286 | llvm_unreachable("Unknown attribute spelling!"); |
||
21287 | return "(No spelling)"; |
||
21288 | case 0: |
||
21289 | return "objc_precise_lifetime"; |
||
21290 | case 1: |
||
21291 | return "objc_precise_lifetime"; |
||
21292 | case 2: |
||
21293 | return "objc_precise_lifetime"; |
||
21294 | } |
||
21295 | } |
||
21296 | |||
21297 | |||
21298 | // ObjCRequiresPropertyDefsAttr implementation |
||
21299 | |||
21300 | ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21301 | auto *A = new (Ctx) ObjCRequiresPropertyDefsAttr(Ctx, CommonInfo); |
||
21302 | A->setImplicit(true); |
||
21303 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21304 | A->setAttributeSpellingListIndex(0); |
||
21305 | return A; |
||
21306 | } |
||
21307 | |||
21308 | ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21309 | auto *A = new (Ctx) ObjCRequiresPropertyDefsAttr(Ctx, CommonInfo); |
||
21310 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21311 | A->setAttributeSpellingListIndex(0); |
||
21312 | return A; |
||
21313 | } |
||
21314 | |||
21315 | ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21316 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21317 | return CreateImplicit(Ctx, I); |
||
21318 | } |
||
21319 | |||
21320 | ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21321 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21322 | return Create(Ctx, I); |
||
21323 | } |
||
21324 | |||
21325 | ObjCRequiresPropertyDefsAttr::ObjCRequiresPropertyDefsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21326 | ) |
||
21327 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCRequiresPropertyDefs, false, false) |
||
21328 | { |
||
21329 | } |
||
21330 | |||
21331 | ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::clone(ASTContext &C) const { |
||
21332 | auto *A = new (C) ObjCRequiresPropertyDefsAttr(C, *this); |
||
21333 | A->Inherited = Inherited; |
||
21334 | A->IsPackExpansion = IsPackExpansion; |
||
21335 | A->setImplicit(Implicit); |
||
21336 | return A; |
||
21337 | } |
||
21338 | |||
21339 | void ObjCRequiresPropertyDefsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21340 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21341 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21342 | switch (getAttributeSpellingListIndex()) { |
||
21343 | default: |
||
21344 | llvm_unreachable("Unknown attribute spelling!"); |
||
21345 | break; |
||
21346 | case 0 : { |
||
21347 | OS << " __attribute__((objc_requires_property_definitions"; |
||
21348 | OS << "))"; |
||
21349 | break; |
||
21350 | } |
||
21351 | case 1 : { |
||
21352 | OS << " [[clang::objc_requires_property_definitions"; |
||
21353 | OS << "]]"; |
||
21354 | break; |
||
21355 | } |
||
21356 | case 2 : { |
||
21357 | OS << " [[clang::objc_requires_property_definitions"; |
||
21358 | OS << "]]"; |
||
21359 | break; |
||
21360 | } |
||
21361 | } |
||
21362 | } |
||
21363 | |||
21364 | const char *ObjCRequiresPropertyDefsAttr::getSpelling() const { |
||
21365 | switch (getAttributeSpellingListIndex()) { |
||
21366 | default: |
||
21367 | llvm_unreachable("Unknown attribute spelling!"); |
||
21368 | return "(No spelling)"; |
||
21369 | case 0: |
||
21370 | return "objc_requires_property_definitions"; |
||
21371 | case 1: |
||
21372 | return "objc_requires_property_definitions"; |
||
21373 | case 2: |
||
21374 | return "objc_requires_property_definitions"; |
||
21375 | } |
||
21376 | } |
||
21377 | |||
21378 | |||
21379 | // ObjCRequiresSuperAttr implementation |
||
21380 | |||
21381 | ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21382 | auto *A = new (Ctx) ObjCRequiresSuperAttr(Ctx, CommonInfo); |
||
21383 | A->setImplicit(true); |
||
21384 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21385 | A->setAttributeSpellingListIndex(0); |
||
21386 | return A; |
||
21387 | } |
||
21388 | |||
21389 | ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21390 | auto *A = new (Ctx) ObjCRequiresSuperAttr(Ctx, CommonInfo); |
||
21391 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21392 | A->setAttributeSpellingListIndex(0); |
||
21393 | return A; |
||
21394 | } |
||
21395 | |||
21396 | ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21397 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21398 | return CreateImplicit(Ctx, I); |
||
21399 | } |
||
21400 | |||
21401 | ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21402 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21403 | return Create(Ctx, I); |
||
21404 | } |
||
21405 | |||
21406 | ObjCRequiresSuperAttr::ObjCRequiresSuperAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21407 | ) |
||
21408 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCRequiresSuper, false, false) |
||
21409 | { |
||
21410 | } |
||
21411 | |||
21412 | ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::clone(ASTContext &C) const { |
||
21413 | auto *A = new (C) ObjCRequiresSuperAttr(C, *this); |
||
21414 | A->Inherited = Inherited; |
||
21415 | A->IsPackExpansion = IsPackExpansion; |
||
21416 | A->setImplicit(Implicit); |
||
21417 | return A; |
||
21418 | } |
||
21419 | |||
21420 | void ObjCRequiresSuperAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21421 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21422 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21423 | switch (getAttributeSpellingListIndex()) { |
||
21424 | default: |
||
21425 | llvm_unreachable("Unknown attribute spelling!"); |
||
21426 | break; |
||
21427 | case 0 : { |
||
21428 | OS << " __attribute__((objc_requires_super"; |
||
21429 | OS << "))"; |
||
21430 | break; |
||
21431 | } |
||
21432 | case 1 : { |
||
21433 | OS << " [[clang::objc_requires_super"; |
||
21434 | OS << "]]"; |
||
21435 | break; |
||
21436 | } |
||
21437 | case 2 : { |
||
21438 | OS << " [[clang::objc_requires_super"; |
||
21439 | OS << "]]"; |
||
21440 | break; |
||
21441 | } |
||
21442 | } |
||
21443 | } |
||
21444 | |||
21445 | const char *ObjCRequiresSuperAttr::getSpelling() const { |
||
21446 | switch (getAttributeSpellingListIndex()) { |
||
21447 | default: |
||
21448 | llvm_unreachable("Unknown attribute spelling!"); |
||
21449 | return "(No spelling)"; |
||
21450 | case 0: |
||
21451 | return "objc_requires_super"; |
||
21452 | case 1: |
||
21453 | return "objc_requires_super"; |
||
21454 | case 2: |
||
21455 | return "objc_requires_super"; |
||
21456 | } |
||
21457 | } |
||
21458 | |||
21459 | |||
21460 | // ObjCReturnsInnerPointerAttr implementation |
||
21461 | |||
21462 | ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21463 | auto *A = new (Ctx) ObjCReturnsInnerPointerAttr(Ctx, CommonInfo); |
||
21464 | A->setImplicit(true); |
||
21465 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21466 | A->setAttributeSpellingListIndex(0); |
||
21467 | return A; |
||
21468 | } |
||
21469 | |||
21470 | ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21471 | auto *A = new (Ctx) ObjCReturnsInnerPointerAttr(Ctx, CommonInfo); |
||
21472 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21473 | A->setAttributeSpellingListIndex(0); |
||
21474 | return A; |
||
21475 | } |
||
21476 | |||
21477 | ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21478 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21479 | return CreateImplicit(Ctx, I); |
||
21480 | } |
||
21481 | |||
21482 | ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21483 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21484 | return Create(Ctx, I); |
||
21485 | } |
||
21486 | |||
21487 | ObjCReturnsInnerPointerAttr::ObjCReturnsInnerPointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21488 | ) |
||
21489 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCReturnsInnerPointer, false, false) |
||
21490 | { |
||
21491 | } |
||
21492 | |||
21493 | ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::clone(ASTContext &C) const { |
||
21494 | auto *A = new (C) ObjCReturnsInnerPointerAttr(C, *this); |
||
21495 | A->Inherited = Inherited; |
||
21496 | A->IsPackExpansion = IsPackExpansion; |
||
21497 | A->setImplicit(Implicit); |
||
21498 | return A; |
||
21499 | } |
||
21500 | |||
21501 | void ObjCReturnsInnerPointerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21502 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21503 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21504 | switch (getAttributeSpellingListIndex()) { |
||
21505 | default: |
||
21506 | llvm_unreachable("Unknown attribute spelling!"); |
||
21507 | break; |
||
21508 | case 0 : { |
||
21509 | OS << " __attribute__((objc_returns_inner_pointer"; |
||
21510 | OS << "))"; |
||
21511 | break; |
||
21512 | } |
||
21513 | case 1 : { |
||
21514 | OS << " [[clang::objc_returns_inner_pointer"; |
||
21515 | OS << "]]"; |
||
21516 | break; |
||
21517 | } |
||
21518 | case 2 : { |
||
21519 | OS << " [[clang::objc_returns_inner_pointer"; |
||
21520 | OS << "]]"; |
||
21521 | break; |
||
21522 | } |
||
21523 | } |
||
21524 | } |
||
21525 | |||
21526 | const char *ObjCReturnsInnerPointerAttr::getSpelling() const { |
||
21527 | switch (getAttributeSpellingListIndex()) { |
||
21528 | default: |
||
21529 | llvm_unreachable("Unknown attribute spelling!"); |
||
21530 | return "(No spelling)"; |
||
21531 | case 0: |
||
21532 | return "objc_returns_inner_pointer"; |
||
21533 | case 1: |
||
21534 | return "objc_returns_inner_pointer"; |
||
21535 | case 2: |
||
21536 | return "objc_returns_inner_pointer"; |
||
21537 | } |
||
21538 | } |
||
21539 | |||
21540 | |||
21541 | // ObjCRootClassAttr implementation |
||
21542 | |||
21543 | ObjCRootClassAttr *ObjCRootClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21544 | auto *A = new (Ctx) ObjCRootClassAttr(Ctx, CommonInfo); |
||
21545 | A->setImplicit(true); |
||
21546 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21547 | A->setAttributeSpellingListIndex(0); |
||
21548 | return A; |
||
21549 | } |
||
21550 | |||
21551 | ObjCRootClassAttr *ObjCRootClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21552 | auto *A = new (Ctx) ObjCRootClassAttr(Ctx, CommonInfo); |
||
21553 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21554 | A->setAttributeSpellingListIndex(0); |
||
21555 | return A; |
||
21556 | } |
||
21557 | |||
21558 | ObjCRootClassAttr *ObjCRootClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21559 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21560 | return CreateImplicit(Ctx, I); |
||
21561 | } |
||
21562 | |||
21563 | ObjCRootClassAttr *ObjCRootClassAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21564 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21565 | return Create(Ctx, I); |
||
21566 | } |
||
21567 | |||
21568 | ObjCRootClassAttr::ObjCRootClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21569 | ) |
||
21570 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCRootClass, false, false) |
||
21571 | { |
||
21572 | } |
||
21573 | |||
21574 | ObjCRootClassAttr *ObjCRootClassAttr::clone(ASTContext &C) const { |
||
21575 | auto *A = new (C) ObjCRootClassAttr(C, *this); |
||
21576 | A->Inherited = Inherited; |
||
21577 | A->IsPackExpansion = IsPackExpansion; |
||
21578 | A->setImplicit(Implicit); |
||
21579 | return A; |
||
21580 | } |
||
21581 | |||
21582 | void ObjCRootClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21583 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21584 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21585 | switch (getAttributeSpellingListIndex()) { |
||
21586 | default: |
||
21587 | llvm_unreachable("Unknown attribute spelling!"); |
||
21588 | break; |
||
21589 | case 0 : { |
||
21590 | OS << " __attribute__((objc_root_class"; |
||
21591 | OS << "))"; |
||
21592 | break; |
||
21593 | } |
||
21594 | case 1 : { |
||
21595 | OS << " [[clang::objc_root_class"; |
||
21596 | OS << "]]"; |
||
21597 | break; |
||
21598 | } |
||
21599 | case 2 : { |
||
21600 | OS << " [[clang::objc_root_class"; |
||
21601 | OS << "]]"; |
||
21602 | break; |
||
21603 | } |
||
21604 | } |
||
21605 | } |
||
21606 | |||
21607 | const char *ObjCRootClassAttr::getSpelling() const { |
||
21608 | switch (getAttributeSpellingListIndex()) { |
||
21609 | default: |
||
21610 | llvm_unreachable("Unknown attribute spelling!"); |
||
21611 | return "(No spelling)"; |
||
21612 | case 0: |
||
21613 | return "objc_root_class"; |
||
21614 | case 1: |
||
21615 | return "objc_root_class"; |
||
21616 | case 2: |
||
21617 | return "objc_root_class"; |
||
21618 | } |
||
21619 | } |
||
21620 | |||
21621 | |||
21622 | // ObjCRuntimeNameAttr implementation |
||
21623 | |||
21624 | ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef MetadataName, const AttributeCommonInfo &CommonInfo) { |
||
21625 | auto *A = new (Ctx) ObjCRuntimeNameAttr(Ctx, CommonInfo, MetadataName); |
||
21626 | A->setImplicit(true); |
||
21627 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21628 | A->setAttributeSpellingListIndex(0); |
||
21629 | return A; |
||
21630 | } |
||
21631 | |||
21632 | ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::Create(ASTContext &Ctx, llvm::StringRef MetadataName, const AttributeCommonInfo &CommonInfo) { |
||
21633 | auto *A = new (Ctx) ObjCRuntimeNameAttr(Ctx, CommonInfo, MetadataName); |
||
21634 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21635 | A->setAttributeSpellingListIndex(0); |
||
21636 | return A; |
||
21637 | } |
||
21638 | |||
21639 | ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef MetadataName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21640 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21641 | return CreateImplicit(Ctx, MetadataName, I); |
||
21642 | } |
||
21643 | |||
21644 | ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::Create(ASTContext &Ctx, llvm::StringRef MetadataName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21645 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21646 | return Create(Ctx, MetadataName, I); |
||
21647 | } |
||
21648 | |||
21649 | ObjCRuntimeNameAttr::ObjCRuntimeNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21650 | , llvm::StringRef MetadataName |
||
21651 | ) |
||
21652 | : Attr(Ctx, CommonInfo, attr::ObjCRuntimeName, false) |
||
21653 | , metadataNameLength(MetadataName.size()),metadataName(new (Ctx, 1) char[metadataNameLength]) |
||
21654 | { |
||
21655 | if (!MetadataName.empty()) |
||
21656 | std::memcpy(metadataName, MetadataName.data(), metadataNameLength); |
||
21657 | } |
||
21658 | |||
21659 | |||
21660 | |||
21661 | ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::clone(ASTContext &C) const { |
||
21662 | auto *A = new (C) ObjCRuntimeNameAttr(C, *this, getMetadataName()); |
||
21663 | A->Inherited = Inherited; |
||
21664 | A->IsPackExpansion = IsPackExpansion; |
||
21665 | A->setImplicit(Implicit); |
||
21666 | return A; |
||
21667 | } |
||
21668 | |||
21669 | void ObjCRuntimeNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21670 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21671 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21672 | switch (getAttributeSpellingListIndex()) { |
||
21673 | default: |
||
21674 | llvm_unreachable("Unknown attribute spelling!"); |
||
21675 | break; |
||
21676 | case 0 : { |
||
21677 | OS << " __attribute__((objc_runtime_name"; |
||
21678 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
21679 | OS << "\"" << getMetadataName() << "\""; |
||
21680 | if (!IsFirstArgument) |
||
21681 | OS << ")"; |
||
21682 | OS << "))"; |
||
21683 | break; |
||
21684 | } |
||
21685 | case 1 : { |
||
21686 | OS << " [[clang::objc_runtime_name"; |
||
21687 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
21688 | OS << "\"" << getMetadataName() << "\""; |
||
21689 | if (!IsFirstArgument) |
||
21690 | OS << ")"; |
||
21691 | OS << "]]"; |
||
21692 | break; |
||
21693 | } |
||
21694 | case 2 : { |
||
21695 | OS << " [[clang::objc_runtime_name"; |
||
21696 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
21697 | OS << "\"" << getMetadataName() << "\""; |
||
21698 | if (!IsFirstArgument) |
||
21699 | OS << ")"; |
||
21700 | OS << "]]"; |
||
21701 | break; |
||
21702 | } |
||
21703 | } |
||
21704 | } |
||
21705 | |||
21706 | const char *ObjCRuntimeNameAttr::getSpelling() const { |
||
21707 | switch (getAttributeSpellingListIndex()) { |
||
21708 | default: |
||
21709 | llvm_unreachable("Unknown attribute spelling!"); |
||
21710 | return "(No spelling)"; |
||
21711 | case 0: |
||
21712 | return "objc_runtime_name"; |
||
21713 | case 1: |
||
21714 | return "objc_runtime_name"; |
||
21715 | case 2: |
||
21716 | return "objc_runtime_name"; |
||
21717 | } |
||
21718 | } |
||
21719 | |||
21720 | |||
21721 | // ObjCRuntimeVisibleAttr implementation |
||
21722 | |||
21723 | ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21724 | auto *A = new (Ctx) ObjCRuntimeVisibleAttr(Ctx, CommonInfo); |
||
21725 | A->setImplicit(true); |
||
21726 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21727 | A->setAttributeSpellingListIndex(0); |
||
21728 | return A; |
||
21729 | } |
||
21730 | |||
21731 | ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21732 | auto *A = new (Ctx) ObjCRuntimeVisibleAttr(Ctx, CommonInfo); |
||
21733 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21734 | A->setAttributeSpellingListIndex(0); |
||
21735 | return A; |
||
21736 | } |
||
21737 | |||
21738 | ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21739 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21740 | return CreateImplicit(Ctx, I); |
||
21741 | } |
||
21742 | |||
21743 | ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21744 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21745 | return Create(Ctx, I); |
||
21746 | } |
||
21747 | |||
21748 | ObjCRuntimeVisibleAttr::ObjCRuntimeVisibleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21749 | ) |
||
21750 | : Attr(Ctx, CommonInfo, attr::ObjCRuntimeVisible, false) |
||
21751 | { |
||
21752 | } |
||
21753 | |||
21754 | ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::clone(ASTContext &C) const { |
||
21755 | auto *A = new (C) ObjCRuntimeVisibleAttr(C, *this); |
||
21756 | A->Inherited = Inherited; |
||
21757 | A->IsPackExpansion = IsPackExpansion; |
||
21758 | A->setImplicit(Implicit); |
||
21759 | return A; |
||
21760 | } |
||
21761 | |||
21762 | void ObjCRuntimeVisibleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21763 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21764 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21765 | switch (getAttributeSpellingListIndex()) { |
||
21766 | default: |
||
21767 | llvm_unreachable("Unknown attribute spelling!"); |
||
21768 | break; |
||
21769 | case 0 : { |
||
21770 | OS << " __attribute__((objc_runtime_visible"; |
||
21771 | OS << "))"; |
||
21772 | break; |
||
21773 | } |
||
21774 | case 1 : { |
||
21775 | OS << " [[clang::objc_runtime_visible"; |
||
21776 | OS << "]]"; |
||
21777 | break; |
||
21778 | } |
||
21779 | case 2 : { |
||
21780 | OS << " [[clang::objc_runtime_visible"; |
||
21781 | OS << "]]"; |
||
21782 | break; |
||
21783 | } |
||
21784 | } |
||
21785 | } |
||
21786 | |||
21787 | const char *ObjCRuntimeVisibleAttr::getSpelling() const { |
||
21788 | switch (getAttributeSpellingListIndex()) { |
||
21789 | default: |
||
21790 | llvm_unreachable("Unknown attribute spelling!"); |
||
21791 | return "(No spelling)"; |
||
21792 | case 0: |
||
21793 | return "objc_runtime_visible"; |
||
21794 | case 1: |
||
21795 | return "objc_runtime_visible"; |
||
21796 | case 2: |
||
21797 | return "objc_runtime_visible"; |
||
21798 | } |
||
21799 | } |
||
21800 | |||
21801 | |||
21802 | // ObjCSubclassingRestrictedAttr implementation |
||
21803 | |||
21804 | ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21805 | auto *A = new (Ctx) ObjCSubclassingRestrictedAttr(Ctx, CommonInfo); |
||
21806 | A->setImplicit(true); |
||
21807 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21808 | A->setAttributeSpellingListIndex(0); |
||
21809 | return A; |
||
21810 | } |
||
21811 | |||
21812 | ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21813 | auto *A = new (Ctx) ObjCSubclassingRestrictedAttr(Ctx, CommonInfo); |
||
21814 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21815 | A->setAttributeSpellingListIndex(0); |
||
21816 | return A; |
||
21817 | } |
||
21818 | |||
21819 | ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21820 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21821 | return CreateImplicit(Ctx, I); |
||
21822 | } |
||
21823 | |||
21824 | ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
21825 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
21826 | return Create(Ctx, I); |
||
21827 | } |
||
21828 | |||
21829 | ObjCSubclassingRestrictedAttr::ObjCSubclassingRestrictedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21830 | ) |
||
21831 | : InheritableAttr(Ctx, CommonInfo, attr::ObjCSubclassingRestricted, false, false) |
||
21832 | { |
||
21833 | } |
||
21834 | |||
21835 | ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::clone(ASTContext &C) const { |
||
21836 | auto *A = new (C) ObjCSubclassingRestrictedAttr(C, *this); |
||
21837 | A->Inherited = Inherited; |
||
21838 | A->IsPackExpansion = IsPackExpansion; |
||
21839 | A->setImplicit(Implicit); |
||
21840 | return A; |
||
21841 | } |
||
21842 | |||
21843 | void ObjCSubclassingRestrictedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21844 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21845 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21846 | switch (getAttributeSpellingListIndex()) { |
||
21847 | default: |
||
21848 | llvm_unreachable("Unknown attribute spelling!"); |
||
21849 | break; |
||
21850 | case 0 : { |
||
21851 | OS << " __attribute__((objc_subclassing_restricted"; |
||
21852 | OS << "))"; |
||
21853 | break; |
||
21854 | } |
||
21855 | case 1 : { |
||
21856 | OS << " [[clang::objc_subclassing_restricted"; |
||
21857 | OS << "]]"; |
||
21858 | break; |
||
21859 | } |
||
21860 | case 2 : { |
||
21861 | OS << " [[clang::objc_subclassing_restricted"; |
||
21862 | OS << "]]"; |
||
21863 | break; |
||
21864 | } |
||
21865 | } |
||
21866 | } |
||
21867 | |||
21868 | const char *ObjCSubclassingRestrictedAttr::getSpelling() const { |
||
21869 | switch (getAttributeSpellingListIndex()) { |
||
21870 | default: |
||
21871 | llvm_unreachable("Unknown attribute spelling!"); |
||
21872 | return "(No spelling)"; |
||
21873 | case 0: |
||
21874 | return "objc_subclassing_restricted"; |
||
21875 | case 1: |
||
21876 | return "objc_subclassing_restricted"; |
||
21877 | case 2: |
||
21878 | return "objc_subclassing_restricted"; |
||
21879 | } |
||
21880 | } |
||
21881 | |||
21882 | |||
21883 | // OpenCLAccessAttr implementation |
||
21884 | |||
21885 | OpenCLAccessAttr *OpenCLAccessAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21886 | auto *A = new (Ctx) OpenCLAccessAttr(Ctx, CommonInfo); |
||
21887 | A->setImplicit(true); |
||
21888 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
21889 | A->setAttributeSpellingListIndex(0); |
||
21890 | return A; |
||
21891 | } |
||
21892 | |||
21893 | OpenCLAccessAttr *OpenCLAccessAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21894 | auto *A = new (Ctx) OpenCLAccessAttr(Ctx, CommonInfo); |
||
21895 | return A; |
||
21896 | } |
||
21897 | |||
21898 | OpenCLAccessAttr *OpenCLAccessAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLAccessAttr::Spelling S) { |
||
21899 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
21900 | return CreateImplicit(Ctx, I); |
||
21901 | } |
||
21902 | |||
21903 | OpenCLAccessAttr *OpenCLAccessAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLAccessAttr::Spelling S) { |
||
21904 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
21905 | return Create(Ctx, I); |
||
21906 | } |
||
21907 | |||
21908 | OpenCLAccessAttr::OpenCLAccessAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
21909 | ) |
||
21910 | : Attr(Ctx, CommonInfo, attr::OpenCLAccess, false) |
||
21911 | { |
||
21912 | } |
||
21913 | |||
21914 | OpenCLAccessAttr::Spelling OpenCLAccessAttr::getSemanticSpelling() const { |
||
21915 | switch (getAttributeSpellingListIndex()) { |
||
21916 | default: llvm_unreachable("Unknown spelling list index"); |
||
21917 | case 0: return Keyword_read_only; |
||
21918 | case 1: return Keyword_read_only; |
||
21919 | case 2: return Keyword_write_only; |
||
21920 | case 3: return Keyword_write_only; |
||
21921 | case 4: return Keyword_read_write; |
||
21922 | case 5: return Keyword_read_write; |
||
21923 | } |
||
21924 | } |
||
21925 | OpenCLAccessAttr *OpenCLAccessAttr::clone(ASTContext &C) const { |
||
21926 | auto *A = new (C) OpenCLAccessAttr(C, *this); |
||
21927 | A->Inherited = Inherited; |
||
21928 | A->IsPackExpansion = IsPackExpansion; |
||
21929 | A->setImplicit(Implicit); |
||
21930 | return A; |
||
21931 | } |
||
21932 | |||
21933 | void OpenCLAccessAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
21934 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
21935 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
21936 | switch (getAttributeSpellingListIndex()) { |
||
21937 | default: |
||
21938 | llvm_unreachable("Unknown attribute spelling!"); |
||
21939 | break; |
||
21940 | case 0 : { |
||
21941 | OS << " __read_only"; |
||
21942 | OS << ""; |
||
21943 | break; |
||
21944 | } |
||
21945 | case 1 : { |
||
21946 | OS << " read_only"; |
||
21947 | OS << ""; |
||
21948 | break; |
||
21949 | } |
||
21950 | case 2 : { |
||
21951 | OS << " __write_only"; |
||
21952 | OS << ""; |
||
21953 | break; |
||
21954 | } |
||
21955 | case 3 : { |
||
21956 | OS << " write_only"; |
||
21957 | OS << ""; |
||
21958 | break; |
||
21959 | } |
||
21960 | case 4 : { |
||
21961 | OS << " __read_write"; |
||
21962 | OS << ""; |
||
21963 | break; |
||
21964 | } |
||
21965 | case 5 : { |
||
21966 | OS << " read_write"; |
||
21967 | OS << ""; |
||
21968 | break; |
||
21969 | } |
||
21970 | } |
||
21971 | } |
||
21972 | |||
21973 | const char *OpenCLAccessAttr::getSpelling() const { |
||
21974 | switch (getAttributeSpellingListIndex()) { |
||
21975 | default: |
||
21976 | llvm_unreachable("Unknown attribute spelling!"); |
||
21977 | return "(No spelling)"; |
||
21978 | case 0: |
||
21979 | return "__read_only"; |
||
21980 | case 1: |
||
21981 | return "read_only"; |
||
21982 | case 2: |
||
21983 | return "__write_only"; |
||
21984 | case 3: |
||
21985 | return "write_only"; |
||
21986 | case 4: |
||
21987 | return "__read_write"; |
||
21988 | case 5: |
||
21989 | return "read_write"; |
||
21990 | } |
||
21991 | } |
||
21992 | |||
21993 | |||
21994 | // OpenCLConstantAddressSpaceAttr implementation |
||
21995 | |||
21996 | OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
21997 | auto *A = new (Ctx) OpenCLConstantAddressSpaceAttr(Ctx, CommonInfo); |
||
21998 | A->setImplicit(true); |
||
21999 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22000 | A->setAttributeSpellingListIndex(0); |
||
22001 | return A; |
||
22002 | } |
||
22003 | |||
22004 | OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22005 | auto *A = new (Ctx) OpenCLConstantAddressSpaceAttr(Ctx, CommonInfo); |
||
22006 | return A; |
||
22007 | } |
||
22008 | |||
22009 | OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLConstantAddressSpaceAttr::Spelling S) { |
||
22010 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22011 | return CreateImplicit(Ctx, I); |
||
22012 | } |
||
22013 | |||
22014 | OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLConstantAddressSpaceAttr::Spelling S) { |
||
22015 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22016 | return Create(Ctx, I); |
||
22017 | } |
||
22018 | |||
22019 | OpenCLConstantAddressSpaceAttr::OpenCLConstantAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22020 | ) |
||
22021 | : TypeAttr(Ctx, CommonInfo, attr::OpenCLConstantAddressSpace, false) |
||
22022 | { |
||
22023 | } |
||
22024 | |||
22025 | OpenCLConstantAddressSpaceAttr::Spelling OpenCLConstantAddressSpaceAttr::getSemanticSpelling() const { |
||
22026 | switch (getAttributeSpellingListIndex()) { |
||
22027 | default: llvm_unreachable("Unknown spelling list index"); |
||
22028 | case 0: return Keyword_constant; |
||
22029 | case 1: return Keyword_constant; |
||
22030 | case 2: return GNU_opencl_constant; |
||
22031 | case 3: return CXX11_clang_opencl_constant; |
||
22032 | case 4: return C2x_clang_opencl_constant; |
||
22033 | } |
||
22034 | } |
||
22035 | OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::clone(ASTContext &C) const { |
||
22036 | auto *A = new (C) OpenCLConstantAddressSpaceAttr(C, *this); |
||
22037 | A->Inherited = Inherited; |
||
22038 | A->IsPackExpansion = IsPackExpansion; |
||
22039 | A->setImplicit(Implicit); |
||
22040 | return A; |
||
22041 | } |
||
22042 | |||
22043 | void OpenCLConstantAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22044 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22045 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22046 | switch (getAttributeSpellingListIndex()) { |
||
22047 | default: |
||
22048 | llvm_unreachable("Unknown attribute spelling!"); |
||
22049 | break; |
||
22050 | case 0 : { |
||
22051 | OS << " __constant"; |
||
22052 | OS << ""; |
||
22053 | break; |
||
22054 | } |
||
22055 | case 1 : { |
||
22056 | OS << " constant"; |
||
22057 | OS << ""; |
||
22058 | break; |
||
22059 | } |
||
22060 | case 2 : { |
||
22061 | OS << " __attribute__((opencl_constant"; |
||
22062 | OS << "))"; |
||
22063 | break; |
||
22064 | } |
||
22065 | case 3 : { |
||
22066 | OS << " [[clang::opencl_constant"; |
||
22067 | OS << "]]"; |
||
22068 | break; |
||
22069 | } |
||
22070 | case 4 : { |
||
22071 | OS << " [[clang::opencl_constant"; |
||
22072 | OS << "]]"; |
||
22073 | break; |
||
22074 | } |
||
22075 | } |
||
22076 | } |
||
22077 | |||
22078 | const char *OpenCLConstantAddressSpaceAttr::getSpelling() const { |
||
22079 | switch (getAttributeSpellingListIndex()) { |
||
22080 | default: |
||
22081 | llvm_unreachable("Unknown attribute spelling!"); |
||
22082 | return "(No spelling)"; |
||
22083 | case 0: |
||
22084 | return "__constant"; |
||
22085 | case 1: |
||
22086 | return "constant"; |
||
22087 | case 2: |
||
22088 | return "opencl_constant"; |
||
22089 | case 3: |
||
22090 | return "opencl_constant"; |
||
22091 | case 4: |
||
22092 | return "opencl_constant"; |
||
22093 | } |
||
22094 | } |
||
22095 | |||
22096 | |||
22097 | // OpenCLGenericAddressSpaceAttr implementation |
||
22098 | |||
22099 | OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22100 | auto *A = new (Ctx) OpenCLGenericAddressSpaceAttr(Ctx, CommonInfo); |
||
22101 | A->setImplicit(true); |
||
22102 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22103 | A->setAttributeSpellingListIndex(0); |
||
22104 | return A; |
||
22105 | } |
||
22106 | |||
22107 | OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22108 | auto *A = new (Ctx) OpenCLGenericAddressSpaceAttr(Ctx, CommonInfo); |
||
22109 | return A; |
||
22110 | } |
||
22111 | |||
22112 | OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLGenericAddressSpaceAttr::Spelling S) { |
||
22113 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22114 | return CreateImplicit(Ctx, I); |
||
22115 | } |
||
22116 | |||
22117 | OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLGenericAddressSpaceAttr::Spelling S) { |
||
22118 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22119 | return Create(Ctx, I); |
||
22120 | } |
||
22121 | |||
22122 | OpenCLGenericAddressSpaceAttr::OpenCLGenericAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22123 | ) |
||
22124 | : TypeAttr(Ctx, CommonInfo, attr::OpenCLGenericAddressSpace, false) |
||
22125 | { |
||
22126 | } |
||
22127 | |||
22128 | OpenCLGenericAddressSpaceAttr::Spelling OpenCLGenericAddressSpaceAttr::getSemanticSpelling() const { |
||
22129 | switch (getAttributeSpellingListIndex()) { |
||
22130 | default: llvm_unreachable("Unknown spelling list index"); |
||
22131 | case 0: return Keyword_generic; |
||
22132 | case 1: return Keyword_generic; |
||
22133 | case 2: return GNU_opencl_generic; |
||
22134 | case 3: return CXX11_clang_opencl_generic; |
||
22135 | case 4: return C2x_clang_opencl_generic; |
||
22136 | } |
||
22137 | } |
||
22138 | OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::clone(ASTContext &C) const { |
||
22139 | auto *A = new (C) OpenCLGenericAddressSpaceAttr(C, *this); |
||
22140 | A->Inherited = Inherited; |
||
22141 | A->IsPackExpansion = IsPackExpansion; |
||
22142 | A->setImplicit(Implicit); |
||
22143 | return A; |
||
22144 | } |
||
22145 | |||
22146 | void OpenCLGenericAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22147 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22148 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22149 | switch (getAttributeSpellingListIndex()) { |
||
22150 | default: |
||
22151 | llvm_unreachable("Unknown attribute spelling!"); |
||
22152 | break; |
||
22153 | case 0 : { |
||
22154 | OS << " __generic"; |
||
22155 | OS << ""; |
||
22156 | break; |
||
22157 | } |
||
22158 | case 1 : { |
||
22159 | OS << " generic"; |
||
22160 | OS << ""; |
||
22161 | break; |
||
22162 | } |
||
22163 | case 2 : { |
||
22164 | OS << " __attribute__((opencl_generic"; |
||
22165 | OS << "))"; |
||
22166 | break; |
||
22167 | } |
||
22168 | case 3 : { |
||
22169 | OS << " [[clang::opencl_generic"; |
||
22170 | OS << "]]"; |
||
22171 | break; |
||
22172 | } |
||
22173 | case 4 : { |
||
22174 | OS << " [[clang::opencl_generic"; |
||
22175 | OS << "]]"; |
||
22176 | break; |
||
22177 | } |
||
22178 | } |
||
22179 | } |
||
22180 | |||
22181 | const char *OpenCLGenericAddressSpaceAttr::getSpelling() const { |
||
22182 | switch (getAttributeSpellingListIndex()) { |
||
22183 | default: |
||
22184 | llvm_unreachable("Unknown attribute spelling!"); |
||
22185 | return "(No spelling)"; |
||
22186 | case 0: |
||
22187 | return "__generic"; |
||
22188 | case 1: |
||
22189 | return "generic"; |
||
22190 | case 2: |
||
22191 | return "opencl_generic"; |
||
22192 | case 3: |
||
22193 | return "opencl_generic"; |
||
22194 | case 4: |
||
22195 | return "opencl_generic"; |
||
22196 | } |
||
22197 | } |
||
22198 | |||
22199 | |||
22200 | // OpenCLGlobalAddressSpaceAttr implementation |
||
22201 | |||
22202 | OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22203 | auto *A = new (Ctx) OpenCLGlobalAddressSpaceAttr(Ctx, CommonInfo); |
||
22204 | A->setImplicit(true); |
||
22205 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22206 | A->setAttributeSpellingListIndex(0); |
||
22207 | return A; |
||
22208 | } |
||
22209 | |||
22210 | OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22211 | auto *A = new (Ctx) OpenCLGlobalAddressSpaceAttr(Ctx, CommonInfo); |
||
22212 | return A; |
||
22213 | } |
||
22214 | |||
22215 | OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLGlobalAddressSpaceAttr::Spelling S) { |
||
22216 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22217 | return CreateImplicit(Ctx, I); |
||
22218 | } |
||
22219 | |||
22220 | OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLGlobalAddressSpaceAttr::Spelling S) { |
||
22221 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22222 | return Create(Ctx, I); |
||
22223 | } |
||
22224 | |||
22225 | OpenCLGlobalAddressSpaceAttr::OpenCLGlobalAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22226 | ) |
||
22227 | : TypeAttr(Ctx, CommonInfo, attr::OpenCLGlobalAddressSpace, false) |
||
22228 | { |
||
22229 | } |
||
22230 | |||
22231 | OpenCLGlobalAddressSpaceAttr::Spelling OpenCLGlobalAddressSpaceAttr::getSemanticSpelling() const { |
||
22232 | switch (getAttributeSpellingListIndex()) { |
||
22233 | default: llvm_unreachable("Unknown spelling list index"); |
||
22234 | case 0: return Keyword_global; |
||
22235 | case 1: return Keyword_global; |
||
22236 | case 2: return GNU_opencl_global; |
||
22237 | case 3: return CXX11_clang_opencl_global; |
||
22238 | case 4: return C2x_clang_opencl_global; |
||
22239 | } |
||
22240 | } |
||
22241 | OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::clone(ASTContext &C) const { |
||
22242 | auto *A = new (C) OpenCLGlobalAddressSpaceAttr(C, *this); |
||
22243 | A->Inherited = Inherited; |
||
22244 | A->IsPackExpansion = IsPackExpansion; |
||
22245 | A->setImplicit(Implicit); |
||
22246 | return A; |
||
22247 | } |
||
22248 | |||
22249 | void OpenCLGlobalAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22250 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22251 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22252 | switch (getAttributeSpellingListIndex()) { |
||
22253 | default: |
||
22254 | llvm_unreachable("Unknown attribute spelling!"); |
||
22255 | break; |
||
22256 | case 0 : { |
||
22257 | OS << " __global"; |
||
22258 | OS << ""; |
||
22259 | break; |
||
22260 | } |
||
22261 | case 1 : { |
||
22262 | OS << " global"; |
||
22263 | OS << ""; |
||
22264 | break; |
||
22265 | } |
||
22266 | case 2 : { |
||
22267 | OS << " __attribute__((opencl_global"; |
||
22268 | OS << "))"; |
||
22269 | break; |
||
22270 | } |
||
22271 | case 3 : { |
||
22272 | OS << " [[clang::opencl_global"; |
||
22273 | OS << "]]"; |
||
22274 | break; |
||
22275 | } |
||
22276 | case 4 : { |
||
22277 | OS << " [[clang::opencl_global"; |
||
22278 | OS << "]]"; |
||
22279 | break; |
||
22280 | } |
||
22281 | } |
||
22282 | } |
||
22283 | |||
22284 | const char *OpenCLGlobalAddressSpaceAttr::getSpelling() const { |
||
22285 | switch (getAttributeSpellingListIndex()) { |
||
22286 | default: |
||
22287 | llvm_unreachable("Unknown attribute spelling!"); |
||
22288 | return "(No spelling)"; |
||
22289 | case 0: |
||
22290 | return "__global"; |
||
22291 | case 1: |
||
22292 | return "global"; |
||
22293 | case 2: |
||
22294 | return "opencl_global"; |
||
22295 | case 3: |
||
22296 | return "opencl_global"; |
||
22297 | case 4: |
||
22298 | return "opencl_global"; |
||
22299 | } |
||
22300 | } |
||
22301 | |||
22302 | |||
22303 | // OpenCLGlobalDeviceAddressSpaceAttr implementation |
||
22304 | |||
22305 | OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22306 | auto *A = new (Ctx) OpenCLGlobalDeviceAddressSpaceAttr(Ctx, CommonInfo); |
||
22307 | A->setImplicit(true); |
||
22308 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22309 | A->setAttributeSpellingListIndex(0); |
||
22310 | return A; |
||
22311 | } |
||
22312 | |||
22313 | OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22314 | auto *A = new (Ctx) OpenCLGlobalDeviceAddressSpaceAttr(Ctx, CommonInfo); |
||
22315 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22316 | A->setAttributeSpellingListIndex(0); |
||
22317 | return A; |
||
22318 | } |
||
22319 | |||
22320 | OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22321 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22322 | return CreateImplicit(Ctx, I); |
||
22323 | } |
||
22324 | |||
22325 | OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22326 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22327 | return Create(Ctx, I); |
||
22328 | } |
||
22329 | |||
22330 | OpenCLGlobalDeviceAddressSpaceAttr::OpenCLGlobalDeviceAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22331 | ) |
||
22332 | : TypeAttr(Ctx, CommonInfo, attr::OpenCLGlobalDeviceAddressSpace, false) |
||
22333 | { |
||
22334 | } |
||
22335 | |||
22336 | OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::clone(ASTContext &C) const { |
||
22337 | auto *A = new (C) OpenCLGlobalDeviceAddressSpaceAttr(C, *this); |
||
22338 | A->Inherited = Inherited; |
||
22339 | A->IsPackExpansion = IsPackExpansion; |
||
22340 | A->setImplicit(Implicit); |
||
22341 | return A; |
||
22342 | } |
||
22343 | |||
22344 | void OpenCLGlobalDeviceAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22345 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22346 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22347 | switch (getAttributeSpellingListIndex()) { |
||
22348 | default: |
||
22349 | llvm_unreachable("Unknown attribute spelling!"); |
||
22350 | break; |
||
22351 | case 0 : { |
||
22352 | OS << " __attribute__((opencl_global_device"; |
||
22353 | OS << "))"; |
||
22354 | break; |
||
22355 | } |
||
22356 | case 1 : { |
||
22357 | OS << " [[clang::opencl_global_device"; |
||
22358 | OS << "]]"; |
||
22359 | break; |
||
22360 | } |
||
22361 | case 2 : { |
||
22362 | OS << " [[clang::opencl_global_device"; |
||
22363 | OS << "]]"; |
||
22364 | break; |
||
22365 | } |
||
22366 | } |
||
22367 | } |
||
22368 | |||
22369 | const char *OpenCLGlobalDeviceAddressSpaceAttr::getSpelling() const { |
||
22370 | switch (getAttributeSpellingListIndex()) { |
||
22371 | default: |
||
22372 | llvm_unreachable("Unknown attribute spelling!"); |
||
22373 | return "(No spelling)"; |
||
22374 | case 0: |
||
22375 | return "opencl_global_device"; |
||
22376 | case 1: |
||
22377 | return "opencl_global_device"; |
||
22378 | case 2: |
||
22379 | return "opencl_global_device"; |
||
22380 | } |
||
22381 | } |
||
22382 | |||
22383 | |||
22384 | // OpenCLGlobalHostAddressSpaceAttr implementation |
||
22385 | |||
22386 | OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22387 | auto *A = new (Ctx) OpenCLGlobalHostAddressSpaceAttr(Ctx, CommonInfo); |
||
22388 | A->setImplicit(true); |
||
22389 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22390 | A->setAttributeSpellingListIndex(0); |
||
22391 | return A; |
||
22392 | } |
||
22393 | |||
22394 | OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22395 | auto *A = new (Ctx) OpenCLGlobalHostAddressSpaceAttr(Ctx, CommonInfo); |
||
22396 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22397 | A->setAttributeSpellingListIndex(0); |
||
22398 | return A; |
||
22399 | } |
||
22400 | |||
22401 | OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22402 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22403 | return CreateImplicit(Ctx, I); |
||
22404 | } |
||
22405 | |||
22406 | OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22407 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22408 | return Create(Ctx, I); |
||
22409 | } |
||
22410 | |||
22411 | OpenCLGlobalHostAddressSpaceAttr::OpenCLGlobalHostAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22412 | ) |
||
22413 | : TypeAttr(Ctx, CommonInfo, attr::OpenCLGlobalHostAddressSpace, false) |
||
22414 | { |
||
22415 | } |
||
22416 | |||
22417 | OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::clone(ASTContext &C) const { |
||
22418 | auto *A = new (C) OpenCLGlobalHostAddressSpaceAttr(C, *this); |
||
22419 | A->Inherited = Inherited; |
||
22420 | A->IsPackExpansion = IsPackExpansion; |
||
22421 | A->setImplicit(Implicit); |
||
22422 | return A; |
||
22423 | } |
||
22424 | |||
22425 | void OpenCLGlobalHostAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22426 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22427 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22428 | switch (getAttributeSpellingListIndex()) { |
||
22429 | default: |
||
22430 | llvm_unreachable("Unknown attribute spelling!"); |
||
22431 | break; |
||
22432 | case 0 : { |
||
22433 | OS << " __attribute__((opencl_global_host"; |
||
22434 | OS << "))"; |
||
22435 | break; |
||
22436 | } |
||
22437 | case 1 : { |
||
22438 | OS << " [[clang::opencl_global_host"; |
||
22439 | OS << "]]"; |
||
22440 | break; |
||
22441 | } |
||
22442 | case 2 : { |
||
22443 | OS << " [[clang::opencl_global_host"; |
||
22444 | OS << "]]"; |
||
22445 | break; |
||
22446 | } |
||
22447 | } |
||
22448 | } |
||
22449 | |||
22450 | const char *OpenCLGlobalHostAddressSpaceAttr::getSpelling() const { |
||
22451 | switch (getAttributeSpellingListIndex()) { |
||
22452 | default: |
||
22453 | llvm_unreachable("Unknown attribute spelling!"); |
||
22454 | return "(No spelling)"; |
||
22455 | case 0: |
||
22456 | return "opencl_global_host"; |
||
22457 | case 1: |
||
22458 | return "opencl_global_host"; |
||
22459 | case 2: |
||
22460 | return "opencl_global_host"; |
||
22461 | } |
||
22462 | } |
||
22463 | |||
22464 | |||
22465 | // OpenCLIntelReqdSubGroupSizeAttr implementation |
||
22466 | |||
22467 | OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned SubGroupSize, const AttributeCommonInfo &CommonInfo) { |
||
22468 | auto *A = new (Ctx) OpenCLIntelReqdSubGroupSizeAttr(Ctx, CommonInfo, SubGroupSize); |
||
22469 | A->setImplicit(true); |
||
22470 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22471 | A->setAttributeSpellingListIndex(0); |
||
22472 | return A; |
||
22473 | } |
||
22474 | |||
22475 | OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::Create(ASTContext &Ctx, unsigned SubGroupSize, const AttributeCommonInfo &CommonInfo) { |
||
22476 | auto *A = new (Ctx) OpenCLIntelReqdSubGroupSizeAttr(Ctx, CommonInfo, SubGroupSize); |
||
22477 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22478 | A->setAttributeSpellingListIndex(0); |
||
22479 | return A; |
||
22480 | } |
||
22481 | |||
22482 | OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned SubGroupSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22483 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22484 | return CreateImplicit(Ctx, SubGroupSize, I); |
||
22485 | } |
||
22486 | |||
22487 | OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::Create(ASTContext &Ctx, unsigned SubGroupSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22488 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22489 | return Create(Ctx, SubGroupSize, I); |
||
22490 | } |
||
22491 | |||
22492 | OpenCLIntelReqdSubGroupSizeAttr::OpenCLIntelReqdSubGroupSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22493 | , unsigned SubGroupSize |
||
22494 | ) |
||
22495 | : InheritableAttr(Ctx, CommonInfo, attr::OpenCLIntelReqdSubGroupSize, false, false) |
||
22496 | , subGroupSize(SubGroupSize) |
||
22497 | { |
||
22498 | } |
||
22499 | |||
22500 | |||
22501 | |||
22502 | OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::clone(ASTContext &C) const { |
||
22503 | auto *A = new (C) OpenCLIntelReqdSubGroupSizeAttr(C, *this, subGroupSize); |
||
22504 | A->Inherited = Inherited; |
||
22505 | A->IsPackExpansion = IsPackExpansion; |
||
22506 | A->setImplicit(Implicit); |
||
22507 | return A; |
||
22508 | } |
||
22509 | |||
22510 | void OpenCLIntelReqdSubGroupSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22511 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22512 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22513 | switch (getAttributeSpellingListIndex()) { |
||
22514 | default: |
||
22515 | llvm_unreachable("Unknown attribute spelling!"); |
||
22516 | break; |
||
22517 | case 0 : { |
||
22518 | OS << " __attribute__((intel_reqd_sub_group_size"; |
||
22519 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
22520 | OS << "" << getSubGroupSize() << ""; |
||
22521 | if (!IsFirstArgument) |
||
22522 | OS << ")"; |
||
22523 | OS << "))"; |
||
22524 | break; |
||
22525 | } |
||
22526 | } |
||
22527 | } |
||
22528 | |||
22529 | const char *OpenCLIntelReqdSubGroupSizeAttr::getSpelling() const { |
||
22530 | switch (getAttributeSpellingListIndex()) { |
||
22531 | default: |
||
22532 | llvm_unreachable("Unknown attribute spelling!"); |
||
22533 | return "(No spelling)"; |
||
22534 | case 0: |
||
22535 | return "intel_reqd_sub_group_size"; |
||
22536 | } |
||
22537 | } |
||
22538 | |||
22539 | |||
22540 | // OpenCLKernelAttr implementation |
||
22541 | |||
22542 | OpenCLKernelAttr *OpenCLKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22543 | auto *A = new (Ctx) OpenCLKernelAttr(Ctx, CommonInfo); |
||
22544 | A->setImplicit(true); |
||
22545 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22546 | A->setAttributeSpellingListIndex(0); |
||
22547 | return A; |
||
22548 | } |
||
22549 | |||
22550 | OpenCLKernelAttr *OpenCLKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22551 | auto *A = new (Ctx) OpenCLKernelAttr(Ctx, CommonInfo); |
||
22552 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22553 | A->setAttributeSpellingListIndex(0); |
||
22554 | return A; |
||
22555 | } |
||
22556 | |||
22557 | OpenCLKernelAttr *OpenCLKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22558 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22559 | return CreateImplicit(Ctx, I); |
||
22560 | } |
||
22561 | |||
22562 | OpenCLKernelAttr *OpenCLKernelAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22563 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22564 | return Create(Ctx, I); |
||
22565 | } |
||
22566 | |||
22567 | OpenCLKernelAttr::OpenCLKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22568 | ) |
||
22569 | : InheritableAttr(Ctx, CommonInfo, attr::OpenCLKernel, false, false) |
||
22570 | { |
||
22571 | } |
||
22572 | |||
22573 | OpenCLKernelAttr *OpenCLKernelAttr::clone(ASTContext &C) const { |
||
22574 | auto *A = new (C) OpenCLKernelAttr(C, *this); |
||
22575 | A->Inherited = Inherited; |
||
22576 | A->IsPackExpansion = IsPackExpansion; |
||
22577 | A->setImplicit(Implicit); |
||
22578 | return A; |
||
22579 | } |
||
22580 | |||
22581 | void OpenCLKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22582 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22583 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22584 | switch (getAttributeSpellingListIndex()) { |
||
22585 | default: |
||
22586 | llvm_unreachable("Unknown attribute spelling!"); |
||
22587 | break; |
||
22588 | case 0 : { |
||
22589 | OS << " __kernel"; |
||
22590 | OS << ""; |
||
22591 | break; |
||
22592 | } |
||
22593 | case 1 : { |
||
22594 | OS << " kernel"; |
||
22595 | OS << ""; |
||
22596 | break; |
||
22597 | } |
||
22598 | } |
||
22599 | } |
||
22600 | |||
22601 | const char *OpenCLKernelAttr::getSpelling() const { |
||
22602 | switch (getAttributeSpellingListIndex()) { |
||
22603 | default: |
||
22604 | llvm_unreachable("Unknown attribute spelling!"); |
||
22605 | return "(No spelling)"; |
||
22606 | case 0: |
||
22607 | return "__kernel"; |
||
22608 | case 1: |
||
22609 | return "kernel"; |
||
22610 | } |
||
22611 | } |
||
22612 | |||
22613 | |||
22614 | // OpenCLLocalAddressSpaceAttr implementation |
||
22615 | |||
22616 | OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22617 | auto *A = new (Ctx) OpenCLLocalAddressSpaceAttr(Ctx, CommonInfo); |
||
22618 | A->setImplicit(true); |
||
22619 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22620 | A->setAttributeSpellingListIndex(0); |
||
22621 | return A; |
||
22622 | } |
||
22623 | |||
22624 | OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22625 | auto *A = new (Ctx) OpenCLLocalAddressSpaceAttr(Ctx, CommonInfo); |
||
22626 | return A; |
||
22627 | } |
||
22628 | |||
22629 | OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLLocalAddressSpaceAttr::Spelling S) { |
||
22630 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22631 | return CreateImplicit(Ctx, I); |
||
22632 | } |
||
22633 | |||
22634 | OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLLocalAddressSpaceAttr::Spelling S) { |
||
22635 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22636 | return Create(Ctx, I); |
||
22637 | } |
||
22638 | |||
22639 | OpenCLLocalAddressSpaceAttr::OpenCLLocalAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22640 | ) |
||
22641 | : TypeAttr(Ctx, CommonInfo, attr::OpenCLLocalAddressSpace, false) |
||
22642 | { |
||
22643 | } |
||
22644 | |||
22645 | OpenCLLocalAddressSpaceAttr::Spelling OpenCLLocalAddressSpaceAttr::getSemanticSpelling() const { |
||
22646 | switch (getAttributeSpellingListIndex()) { |
||
22647 | default: llvm_unreachable("Unknown spelling list index"); |
||
22648 | case 0: return Keyword_local; |
||
22649 | case 1: return Keyword_local; |
||
22650 | case 2: return GNU_opencl_local; |
||
22651 | case 3: return CXX11_clang_opencl_local; |
||
22652 | case 4: return C2x_clang_opencl_local; |
||
22653 | } |
||
22654 | } |
||
22655 | OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::clone(ASTContext &C) const { |
||
22656 | auto *A = new (C) OpenCLLocalAddressSpaceAttr(C, *this); |
||
22657 | A->Inherited = Inherited; |
||
22658 | A->IsPackExpansion = IsPackExpansion; |
||
22659 | A->setImplicit(Implicit); |
||
22660 | return A; |
||
22661 | } |
||
22662 | |||
22663 | void OpenCLLocalAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22664 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22665 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22666 | switch (getAttributeSpellingListIndex()) { |
||
22667 | default: |
||
22668 | llvm_unreachable("Unknown attribute spelling!"); |
||
22669 | break; |
||
22670 | case 0 : { |
||
22671 | OS << " __local"; |
||
22672 | OS << ""; |
||
22673 | break; |
||
22674 | } |
||
22675 | case 1 : { |
||
22676 | OS << " local"; |
||
22677 | OS << ""; |
||
22678 | break; |
||
22679 | } |
||
22680 | case 2 : { |
||
22681 | OS << " __attribute__((opencl_local"; |
||
22682 | OS << "))"; |
||
22683 | break; |
||
22684 | } |
||
22685 | case 3 : { |
||
22686 | OS << " [[clang::opencl_local"; |
||
22687 | OS << "]]"; |
||
22688 | break; |
||
22689 | } |
||
22690 | case 4 : { |
||
22691 | OS << " [[clang::opencl_local"; |
||
22692 | OS << "]]"; |
||
22693 | break; |
||
22694 | } |
||
22695 | } |
||
22696 | } |
||
22697 | |||
22698 | const char *OpenCLLocalAddressSpaceAttr::getSpelling() const { |
||
22699 | switch (getAttributeSpellingListIndex()) { |
||
22700 | default: |
||
22701 | llvm_unreachable("Unknown attribute spelling!"); |
||
22702 | return "(No spelling)"; |
||
22703 | case 0: |
||
22704 | return "__local"; |
||
22705 | case 1: |
||
22706 | return "local"; |
||
22707 | case 2: |
||
22708 | return "opencl_local"; |
||
22709 | case 3: |
||
22710 | return "opencl_local"; |
||
22711 | case 4: |
||
22712 | return "opencl_local"; |
||
22713 | } |
||
22714 | } |
||
22715 | |||
22716 | |||
22717 | // OpenCLPrivateAddressSpaceAttr implementation |
||
22718 | |||
22719 | OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22720 | auto *A = new (Ctx) OpenCLPrivateAddressSpaceAttr(Ctx, CommonInfo); |
||
22721 | A->setImplicit(true); |
||
22722 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22723 | A->setAttributeSpellingListIndex(0); |
||
22724 | return A; |
||
22725 | } |
||
22726 | |||
22727 | OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22728 | auto *A = new (Ctx) OpenCLPrivateAddressSpaceAttr(Ctx, CommonInfo); |
||
22729 | return A; |
||
22730 | } |
||
22731 | |||
22732 | OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLPrivateAddressSpaceAttr::Spelling S) { |
||
22733 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22734 | return CreateImplicit(Ctx, I); |
||
22735 | } |
||
22736 | |||
22737 | OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OpenCLPrivateAddressSpaceAttr::Spelling S) { |
||
22738 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
22739 | return Create(Ctx, I); |
||
22740 | } |
||
22741 | |||
22742 | OpenCLPrivateAddressSpaceAttr::OpenCLPrivateAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22743 | ) |
||
22744 | : TypeAttr(Ctx, CommonInfo, attr::OpenCLPrivateAddressSpace, false) |
||
22745 | { |
||
22746 | } |
||
22747 | |||
22748 | OpenCLPrivateAddressSpaceAttr::Spelling OpenCLPrivateAddressSpaceAttr::getSemanticSpelling() const { |
||
22749 | switch (getAttributeSpellingListIndex()) { |
||
22750 | default: llvm_unreachable("Unknown spelling list index"); |
||
22751 | case 0: return Keyword_private; |
||
22752 | case 1: return Keyword_private; |
||
22753 | case 2: return GNU_opencl_private; |
||
22754 | case 3: return CXX11_clang_opencl_private; |
||
22755 | case 4: return C2x_clang_opencl_private; |
||
22756 | } |
||
22757 | } |
||
22758 | OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::clone(ASTContext &C) const { |
||
22759 | auto *A = new (C) OpenCLPrivateAddressSpaceAttr(C, *this); |
||
22760 | A->Inherited = Inherited; |
||
22761 | A->IsPackExpansion = IsPackExpansion; |
||
22762 | A->setImplicit(Implicit); |
||
22763 | return A; |
||
22764 | } |
||
22765 | |||
22766 | void OpenCLPrivateAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22767 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22768 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22769 | switch (getAttributeSpellingListIndex()) { |
||
22770 | default: |
||
22771 | llvm_unreachable("Unknown attribute spelling!"); |
||
22772 | break; |
||
22773 | case 0 : { |
||
22774 | OS << " __private"; |
||
22775 | OS << ""; |
||
22776 | break; |
||
22777 | } |
||
22778 | case 1 : { |
||
22779 | OS << " private"; |
||
22780 | OS << ""; |
||
22781 | break; |
||
22782 | } |
||
22783 | case 2 : { |
||
22784 | OS << " __attribute__((opencl_private"; |
||
22785 | OS << "))"; |
||
22786 | break; |
||
22787 | } |
||
22788 | case 3 : { |
||
22789 | OS << " [[clang::opencl_private"; |
||
22790 | OS << "]]"; |
||
22791 | break; |
||
22792 | } |
||
22793 | case 4 : { |
||
22794 | OS << " [[clang::opencl_private"; |
||
22795 | OS << "]]"; |
||
22796 | break; |
||
22797 | } |
||
22798 | } |
||
22799 | } |
||
22800 | |||
22801 | const char *OpenCLPrivateAddressSpaceAttr::getSpelling() const { |
||
22802 | switch (getAttributeSpellingListIndex()) { |
||
22803 | default: |
||
22804 | llvm_unreachable("Unknown attribute spelling!"); |
||
22805 | return "(No spelling)"; |
||
22806 | case 0: |
||
22807 | return "__private"; |
||
22808 | case 1: |
||
22809 | return "private"; |
||
22810 | case 2: |
||
22811 | return "opencl_private"; |
||
22812 | case 3: |
||
22813 | return "opencl_private"; |
||
22814 | case 4: |
||
22815 | return "opencl_private"; |
||
22816 | } |
||
22817 | } |
||
22818 | |||
22819 | |||
22820 | // OpenCLUnrollHintAttr implementation |
||
22821 | |||
22822 | OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::CreateImplicit(ASTContext &Ctx, unsigned UnrollHint, const AttributeCommonInfo &CommonInfo) { |
||
22823 | auto *A = new (Ctx) OpenCLUnrollHintAttr(Ctx, CommonInfo, UnrollHint); |
||
22824 | A->setImplicit(true); |
||
22825 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22826 | A->setAttributeSpellingListIndex(0); |
||
22827 | return A; |
||
22828 | } |
||
22829 | |||
22830 | OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::Create(ASTContext &Ctx, unsigned UnrollHint, const AttributeCommonInfo &CommonInfo) { |
||
22831 | auto *A = new (Ctx) OpenCLUnrollHintAttr(Ctx, CommonInfo, UnrollHint); |
||
22832 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22833 | A->setAttributeSpellingListIndex(0); |
||
22834 | return A; |
||
22835 | } |
||
22836 | |||
22837 | OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::CreateImplicit(ASTContext &Ctx, unsigned UnrollHint, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22838 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22839 | return CreateImplicit(Ctx, UnrollHint, I); |
||
22840 | } |
||
22841 | |||
22842 | OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::Create(ASTContext &Ctx, unsigned UnrollHint, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22843 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22844 | return Create(Ctx, UnrollHint, I); |
||
22845 | } |
||
22846 | |||
22847 | OpenCLUnrollHintAttr::OpenCLUnrollHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22848 | , unsigned UnrollHint |
||
22849 | ) |
||
22850 | : StmtAttr(Ctx, CommonInfo, attr::OpenCLUnrollHint, false) |
||
22851 | , unrollHint(UnrollHint) |
||
22852 | { |
||
22853 | } |
||
22854 | |||
22855 | OpenCLUnrollHintAttr::OpenCLUnrollHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22856 | ) |
||
22857 | : StmtAttr(Ctx, CommonInfo, attr::OpenCLUnrollHint, false) |
||
22858 | , unrollHint() |
||
22859 | { |
||
22860 | } |
||
22861 | |||
22862 | |||
22863 | |||
22864 | OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::clone(ASTContext &C) const { |
||
22865 | auto *A = new (C) OpenCLUnrollHintAttr(C, *this, unrollHint); |
||
22866 | A->Inherited = Inherited; |
||
22867 | A->IsPackExpansion = IsPackExpansion; |
||
22868 | A->setImplicit(Implicit); |
||
22869 | return A; |
||
22870 | } |
||
22871 | |||
22872 | void OpenCLUnrollHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22873 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22874 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22875 | switch (getAttributeSpellingListIndex()) { |
||
22876 | default: |
||
22877 | llvm_unreachable("Unknown attribute spelling!"); |
||
22878 | break; |
||
22879 | case 0 : { |
||
22880 | OS << " __attribute__((opencl_unroll_hint"; |
||
22881 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
22882 | OS << "" << getUnrollHint() << ""; |
||
22883 | if (!IsFirstArgument) |
||
22884 | OS << ")"; |
||
22885 | OS << "))"; |
||
22886 | break; |
||
22887 | } |
||
22888 | } |
||
22889 | } |
||
22890 | |||
22891 | const char *OpenCLUnrollHintAttr::getSpelling() const { |
||
22892 | switch (getAttributeSpellingListIndex()) { |
||
22893 | default: |
||
22894 | llvm_unreachable("Unknown attribute spelling!"); |
||
22895 | return "(No spelling)"; |
||
22896 | case 0: |
||
22897 | return "opencl_unroll_hint"; |
||
22898 | } |
||
22899 | } |
||
22900 | |||
22901 | |||
22902 | // OptimizeNoneAttr implementation |
||
22903 | |||
22904 | OptimizeNoneAttr *OptimizeNoneAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22905 | auto *A = new (Ctx) OptimizeNoneAttr(Ctx, CommonInfo); |
||
22906 | A->setImplicit(true); |
||
22907 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22908 | A->setAttributeSpellingListIndex(0); |
||
22909 | return A; |
||
22910 | } |
||
22911 | |||
22912 | OptimizeNoneAttr *OptimizeNoneAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22913 | auto *A = new (Ctx) OptimizeNoneAttr(Ctx, CommonInfo); |
||
22914 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22915 | A->setAttributeSpellingListIndex(0); |
||
22916 | return A; |
||
22917 | } |
||
22918 | |||
22919 | OptimizeNoneAttr *OptimizeNoneAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22920 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22921 | return CreateImplicit(Ctx, I); |
||
22922 | } |
||
22923 | |||
22924 | OptimizeNoneAttr *OptimizeNoneAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
22925 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
22926 | return Create(Ctx, I); |
||
22927 | } |
||
22928 | |||
22929 | OptimizeNoneAttr::OptimizeNoneAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
22930 | ) |
||
22931 | : InheritableAttr(Ctx, CommonInfo, attr::OptimizeNone, false, false) |
||
22932 | { |
||
22933 | } |
||
22934 | |||
22935 | OptimizeNoneAttr *OptimizeNoneAttr::clone(ASTContext &C) const { |
||
22936 | auto *A = new (C) OptimizeNoneAttr(C, *this); |
||
22937 | A->Inherited = Inherited; |
||
22938 | A->IsPackExpansion = IsPackExpansion; |
||
22939 | A->setImplicit(Implicit); |
||
22940 | return A; |
||
22941 | } |
||
22942 | |||
22943 | void OptimizeNoneAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
22944 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
22945 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
22946 | switch (getAttributeSpellingListIndex()) { |
||
22947 | default: |
||
22948 | llvm_unreachable("Unknown attribute spelling!"); |
||
22949 | break; |
||
22950 | case 0 : { |
||
22951 | OS << " __attribute__((optnone"; |
||
22952 | OS << "))"; |
||
22953 | break; |
||
22954 | } |
||
22955 | case 1 : { |
||
22956 | OS << " [[clang::optnone"; |
||
22957 | OS << "]]"; |
||
22958 | break; |
||
22959 | } |
||
22960 | case 2 : { |
||
22961 | OS << " [[clang::optnone"; |
||
22962 | OS << "]]"; |
||
22963 | break; |
||
22964 | } |
||
22965 | } |
||
22966 | } |
||
22967 | |||
22968 | const char *OptimizeNoneAttr::getSpelling() const { |
||
22969 | switch (getAttributeSpellingListIndex()) { |
||
22970 | default: |
||
22971 | llvm_unreachable("Unknown attribute spelling!"); |
||
22972 | return "(No spelling)"; |
||
22973 | case 0: |
||
22974 | return "optnone"; |
||
22975 | case 1: |
||
22976 | return "optnone"; |
||
22977 | case 2: |
||
22978 | return "optnone"; |
||
22979 | } |
||
22980 | } |
||
22981 | |||
22982 | |||
22983 | // OverloadableAttr implementation |
||
22984 | |||
22985 | OverloadableAttr *OverloadableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22986 | auto *A = new (Ctx) OverloadableAttr(Ctx, CommonInfo); |
||
22987 | A->setImplicit(true); |
||
22988 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22989 | A->setAttributeSpellingListIndex(0); |
||
22990 | return A; |
||
22991 | } |
||
22992 | |||
22993 | OverloadableAttr *OverloadableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
22994 | auto *A = new (Ctx) OverloadableAttr(Ctx, CommonInfo); |
||
22995 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
22996 | A->setAttributeSpellingListIndex(0); |
||
22997 | return A; |
||
22998 | } |
||
22999 | |||
23000 | OverloadableAttr *OverloadableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23001 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23002 | return CreateImplicit(Ctx, I); |
||
23003 | } |
||
23004 | |||
23005 | OverloadableAttr *OverloadableAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23006 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23007 | return Create(Ctx, I); |
||
23008 | } |
||
23009 | |||
23010 | OverloadableAttr::OverloadableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23011 | ) |
||
23012 | : Attr(Ctx, CommonInfo, attr::Overloadable, false) |
||
23013 | { |
||
23014 | } |
||
23015 | |||
23016 | OverloadableAttr *OverloadableAttr::clone(ASTContext &C) const { |
||
23017 | auto *A = new (C) OverloadableAttr(C, *this); |
||
23018 | A->Inherited = Inherited; |
||
23019 | A->IsPackExpansion = IsPackExpansion; |
||
23020 | A->setImplicit(Implicit); |
||
23021 | return A; |
||
23022 | } |
||
23023 | |||
23024 | void OverloadableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
23025 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
23026 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
23027 | switch (getAttributeSpellingListIndex()) { |
||
23028 | default: |
||
23029 | llvm_unreachable("Unknown attribute spelling!"); |
||
23030 | break; |
||
23031 | case 0 : { |
||
23032 | OS << " __attribute__((overloadable"; |
||
23033 | OS << "))"; |
||
23034 | break; |
||
23035 | } |
||
23036 | case 1 : { |
||
23037 | OS << " [[clang::overloadable"; |
||
23038 | OS << "]]"; |
||
23039 | break; |
||
23040 | } |
||
23041 | case 2 : { |
||
23042 | OS << " [[clang::overloadable"; |
||
23043 | OS << "]]"; |
||
23044 | break; |
||
23045 | } |
||
23046 | } |
||
23047 | } |
||
23048 | |||
23049 | const char *OverloadableAttr::getSpelling() const { |
||
23050 | switch (getAttributeSpellingListIndex()) { |
||
23051 | default: |
||
23052 | llvm_unreachable("Unknown attribute spelling!"); |
||
23053 | return "(No spelling)"; |
||
23054 | case 0: |
||
23055 | return "overloadable"; |
||
23056 | case 1: |
||
23057 | return "overloadable"; |
||
23058 | case 2: |
||
23059 | return "overloadable"; |
||
23060 | } |
||
23061 | } |
||
23062 | |||
23063 | |||
23064 | // OverrideAttr implementation |
||
23065 | |||
23066 | OverrideAttr *OverrideAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
23067 | auto *A = new (Ctx) OverrideAttr(Ctx, CommonInfo); |
||
23068 | A->setImplicit(true); |
||
23069 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23070 | A->setAttributeSpellingListIndex(0); |
||
23071 | return A; |
||
23072 | } |
||
23073 | |||
23074 | OverrideAttr *OverrideAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
23075 | auto *A = new (Ctx) OverrideAttr(Ctx, CommonInfo); |
||
23076 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23077 | A->setAttributeSpellingListIndex(0); |
||
23078 | return A; |
||
23079 | } |
||
23080 | |||
23081 | OverrideAttr *OverrideAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23082 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23083 | return CreateImplicit(Ctx, I); |
||
23084 | } |
||
23085 | |||
23086 | OverrideAttr *OverrideAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23087 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23088 | return Create(Ctx, I); |
||
23089 | } |
||
23090 | |||
23091 | OverrideAttr::OverrideAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23092 | ) |
||
23093 | : InheritableAttr(Ctx, CommonInfo, attr::Override, false, false) |
||
23094 | { |
||
23095 | } |
||
23096 | |||
23097 | OverrideAttr *OverrideAttr::clone(ASTContext &C) const { |
||
23098 | auto *A = new (C) OverrideAttr(C, *this); |
||
23099 | A->Inherited = Inherited; |
||
23100 | A->IsPackExpansion = IsPackExpansion; |
||
23101 | A->setImplicit(Implicit); |
||
23102 | return A; |
||
23103 | } |
||
23104 | |||
23105 | void OverrideAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
23106 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
23107 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
23108 | switch (getAttributeSpellingListIndex()) { |
||
23109 | default: |
||
23110 | llvm_unreachable("Unknown attribute spelling!"); |
||
23111 | break; |
||
23112 | case 0 : { |
||
23113 | OS << " override"; |
||
23114 | OS << ""; |
||
23115 | break; |
||
23116 | } |
||
23117 | } |
||
23118 | } |
||
23119 | |||
23120 | const char *OverrideAttr::getSpelling() const { |
||
23121 | switch (getAttributeSpellingListIndex()) { |
||
23122 | default: |
||
23123 | llvm_unreachable("Unknown attribute spelling!"); |
||
23124 | return "(No spelling)"; |
||
23125 | case 0: |
||
23126 | return "override"; |
||
23127 | } |
||
23128 | } |
||
23129 | |||
23130 | |||
23131 | // OwnerAttr implementation |
||
23132 | |||
23133 | OwnerAttr *OwnerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) { |
||
23134 | auto *A = new (Ctx) OwnerAttr(Ctx, CommonInfo, DerefType); |
||
23135 | A->setImplicit(true); |
||
23136 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23137 | A->setAttributeSpellingListIndex(0); |
||
23138 | return A; |
||
23139 | } |
||
23140 | |||
23141 | OwnerAttr *OwnerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) { |
||
23142 | auto *A = new (Ctx) OwnerAttr(Ctx, CommonInfo, DerefType); |
||
23143 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23144 | A->setAttributeSpellingListIndex(0); |
||
23145 | return A; |
||
23146 | } |
||
23147 | |||
23148 | OwnerAttr *OwnerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23149 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23150 | return CreateImplicit(Ctx, DerefType, I); |
||
23151 | } |
||
23152 | |||
23153 | OwnerAttr *OwnerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23154 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23155 | return Create(Ctx, DerefType, I); |
||
23156 | } |
||
23157 | |||
23158 | OwnerAttr::OwnerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23159 | , TypeSourceInfo * DerefType |
||
23160 | ) |
||
23161 | : InheritableAttr(Ctx, CommonInfo, attr::Owner, false, false) |
||
23162 | , derefType(DerefType) |
||
23163 | { |
||
23164 | } |
||
23165 | |||
23166 | OwnerAttr::OwnerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23167 | ) |
||
23168 | : InheritableAttr(Ctx, CommonInfo, attr::Owner, false, false) |
||
23169 | , derefType() |
||
23170 | { |
||
23171 | } |
||
23172 | |||
23173 | |||
23174 | |||
23175 | OwnerAttr *OwnerAttr::clone(ASTContext &C) const { |
||
23176 | auto *A = new (C) OwnerAttr(C, *this, derefType); |
||
23177 | A->Inherited = Inherited; |
||
23178 | A->IsPackExpansion = IsPackExpansion; |
||
23179 | A->setImplicit(Implicit); |
||
23180 | return A; |
||
23181 | } |
||
23182 | |||
23183 | void OwnerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
23184 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
23185 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
23186 | switch (getAttributeSpellingListIndex()) { |
||
23187 | default: |
||
23188 | llvm_unreachable("Unknown attribute spelling!"); |
||
23189 | break; |
||
23190 | case 0 : { |
||
23191 | OS << " [[gsl::Owner"; |
||
23192 | if (!getDerefTypeLoc()) |
||
23193 | ++TrailingOmittedArgs; |
||
23194 | if (!(!getDerefTypeLoc())) { |
||
23195 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23196 | OS << "" << getDerefType().getAsString() << ""; |
||
23197 | } |
||
23198 | if (!IsFirstArgument) |
||
23199 | OS << ")"; |
||
23200 | OS << "]]"; |
||
23201 | break; |
||
23202 | } |
||
23203 | } |
||
23204 | } |
||
23205 | |||
23206 | const char *OwnerAttr::getSpelling() const { |
||
23207 | switch (getAttributeSpellingListIndex()) { |
||
23208 | default: |
||
23209 | llvm_unreachable("Unknown attribute spelling!"); |
||
23210 | return "(No spelling)"; |
||
23211 | case 0: |
||
23212 | return "Owner"; |
||
23213 | } |
||
23214 | } |
||
23215 | |||
23216 | |||
23217 | // OwnershipAttr implementation |
||
23218 | |||
23219 | OwnershipAttr *OwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
23220 | auto *A = new (Ctx) OwnershipAttr(Ctx, CommonInfo, Module, Args, ArgsSize); |
||
23221 | A->setImplicit(true); |
||
23222 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23223 | A->setAttributeSpellingListIndex(0); |
||
23224 | return A; |
||
23225 | } |
||
23226 | |||
23227 | OwnershipAttr *OwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
23228 | auto *A = new (Ctx) OwnershipAttr(Ctx, CommonInfo, Module, Args, ArgsSize); |
||
23229 | return A; |
||
23230 | } |
||
23231 | |||
23232 | OwnershipAttr *OwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OwnershipAttr::Spelling S) { |
||
23233 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
23234 | return CreateImplicit(Ctx, Module, Args, ArgsSize, I); |
||
23235 | } |
||
23236 | |||
23237 | OwnershipAttr *OwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, OwnershipAttr::Spelling S) { |
||
23238 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
23239 | return Create(Ctx, Module, Args, ArgsSize, I); |
||
23240 | } |
||
23241 | |||
23242 | OwnershipAttr::OwnershipAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23243 | , IdentifierInfo * Module |
||
23244 | , ParamIdx *Args, unsigned ArgsSize |
||
23245 | ) |
||
23246 | : InheritableAttr(Ctx, CommonInfo, attr::Ownership, false, false) |
||
23247 | , module(Module) |
||
23248 | , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size]) |
||
23249 | { |
||
23250 | std::copy(Args, Args + args_Size, args_); |
||
23251 | } |
||
23252 | |||
23253 | OwnershipAttr::OwnershipAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23254 | , IdentifierInfo * Module |
||
23255 | ) |
||
23256 | : InheritableAttr(Ctx, CommonInfo, attr::Ownership, false, false) |
||
23257 | , module(Module) |
||
23258 | , args_Size(0), args_(nullptr) |
||
23259 | { |
||
23260 | } |
||
23261 | |||
23262 | OwnershipAttr::Spelling OwnershipAttr::getSemanticSpelling() const { |
||
23263 | switch (getAttributeSpellingListIndex()) { |
||
23264 | default: llvm_unreachable("Unknown spelling list index"); |
||
23265 | case 0: return GNU_ownership_holds; |
||
23266 | case 1: return CXX11_clang_ownership_holds; |
||
23267 | case 2: return C2x_clang_ownership_holds; |
||
23268 | case 3: return GNU_ownership_returns; |
||
23269 | case 4: return CXX11_clang_ownership_returns; |
||
23270 | case 5: return C2x_clang_ownership_returns; |
||
23271 | case 6: return GNU_ownership_takes; |
||
23272 | case 7: return CXX11_clang_ownership_takes; |
||
23273 | case 8: return C2x_clang_ownership_takes; |
||
23274 | } |
||
23275 | } |
||
23276 | |||
23277 | |||
23278 | |||
23279 | |||
23280 | OwnershipAttr *OwnershipAttr::clone(ASTContext &C) const { |
||
23281 | auto *A = new (C) OwnershipAttr(C, *this, module, args_, args_Size); |
||
23282 | A->Inherited = Inherited; |
||
23283 | A->IsPackExpansion = IsPackExpansion; |
||
23284 | A->setImplicit(Implicit); |
||
23285 | return A; |
||
23286 | } |
||
23287 | |||
23288 | void OwnershipAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
23289 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
23290 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
23291 | switch (getAttributeSpellingListIndex()) { |
||
23292 | default: |
||
23293 | llvm_unreachable("Unknown attribute spelling!"); |
||
23294 | break; |
||
23295 | case 0 : { |
||
23296 | OS << " __attribute__((ownership_holds"; |
||
23297 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23298 | OS << "" << (getModule() ? getModule()->getName() : "") << ""; |
||
23299 | OS << ""; |
||
23300 | for (const auto &Val : args()) { |
||
23301 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23302 | OS << Val.getSourceIndex(); |
||
23303 | } |
||
23304 | OS << ""; |
||
23305 | if (!IsFirstArgument) |
||
23306 | OS << ")"; |
||
23307 | OS << "))"; |
||
23308 | break; |
||
23309 | } |
||
23310 | case 1 : { |
||
23311 | OS << " [[clang::ownership_holds"; |
||
23312 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23313 | OS << "" << (getModule() ? getModule()->getName() : "") << ""; |
||
23314 | OS << ""; |
||
23315 | for (const auto &Val : args()) { |
||
23316 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23317 | OS << Val.getSourceIndex(); |
||
23318 | } |
||
23319 | OS << ""; |
||
23320 | if (!IsFirstArgument) |
||
23321 | OS << ")"; |
||
23322 | OS << "]]"; |
||
23323 | break; |
||
23324 | } |
||
23325 | case 2 : { |
||
23326 | OS << " [[clang::ownership_holds"; |
||
23327 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23328 | OS << "" << (getModule() ? getModule()->getName() : "") << ""; |
||
23329 | OS << ""; |
||
23330 | for (const auto &Val : args()) { |
||
23331 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23332 | OS << Val.getSourceIndex(); |
||
23333 | } |
||
23334 | OS << ""; |
||
23335 | if (!IsFirstArgument) |
||
23336 | OS << ")"; |
||
23337 | OS << "]]"; |
||
23338 | break; |
||
23339 | } |
||
23340 | case 3 : { |
||
23341 | OS << " __attribute__((ownership_returns"; |
||
23342 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23343 | OS << "" << (getModule() ? getModule()->getName() : "") << ""; |
||
23344 | OS << ""; |
||
23345 | for (const auto &Val : args()) { |
||
23346 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23347 | OS << Val.getSourceIndex(); |
||
23348 | } |
||
23349 | OS << ""; |
||
23350 | if (!IsFirstArgument) |
||
23351 | OS << ")"; |
||
23352 | OS << "))"; |
||
23353 | break; |
||
23354 | } |
||
23355 | case 4 : { |
||
23356 | OS << " [[clang::ownership_returns"; |
||
23357 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23358 | OS << "" << (getModule() ? getModule()->getName() : "") << ""; |
||
23359 | OS << ""; |
||
23360 | for (const auto &Val : args()) { |
||
23361 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23362 | OS << Val.getSourceIndex(); |
||
23363 | } |
||
23364 | OS << ""; |
||
23365 | if (!IsFirstArgument) |
||
23366 | OS << ")"; |
||
23367 | OS << "]]"; |
||
23368 | break; |
||
23369 | } |
||
23370 | case 5 : { |
||
23371 | OS << " [[clang::ownership_returns"; |
||
23372 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23373 | OS << "" << (getModule() ? getModule()->getName() : "") << ""; |
||
23374 | OS << ""; |
||
23375 | for (const auto &Val : args()) { |
||
23376 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23377 | OS << Val.getSourceIndex(); |
||
23378 | } |
||
23379 | OS << ""; |
||
23380 | if (!IsFirstArgument) |
||
23381 | OS << ")"; |
||
23382 | OS << "]]"; |
||
23383 | break; |
||
23384 | } |
||
23385 | case 6 : { |
||
23386 | OS << " __attribute__((ownership_takes"; |
||
23387 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23388 | OS << "" << (getModule() ? getModule()->getName() : "") << ""; |
||
23389 | OS << ""; |
||
23390 | for (const auto &Val : args()) { |
||
23391 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23392 | OS << Val.getSourceIndex(); |
||
23393 | } |
||
23394 | OS << ""; |
||
23395 | if (!IsFirstArgument) |
||
23396 | OS << ")"; |
||
23397 | OS << "))"; |
||
23398 | break; |
||
23399 | } |
||
23400 | case 7 : { |
||
23401 | OS << " [[clang::ownership_takes"; |
||
23402 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23403 | OS << "" << (getModule() ? getModule()->getName() : "") << ""; |
||
23404 | OS << ""; |
||
23405 | for (const auto &Val : args()) { |
||
23406 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23407 | OS << Val.getSourceIndex(); |
||
23408 | } |
||
23409 | OS << ""; |
||
23410 | if (!IsFirstArgument) |
||
23411 | OS << ")"; |
||
23412 | OS << "]]"; |
||
23413 | break; |
||
23414 | } |
||
23415 | case 8 : { |
||
23416 | OS << " [[clang::ownership_takes"; |
||
23417 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23418 | OS << "" << (getModule() ? getModule()->getName() : "") << ""; |
||
23419 | OS << ""; |
||
23420 | for (const auto &Val : args()) { |
||
23421 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23422 | OS << Val.getSourceIndex(); |
||
23423 | } |
||
23424 | OS << ""; |
||
23425 | if (!IsFirstArgument) |
||
23426 | OS << ")"; |
||
23427 | OS << "]]"; |
||
23428 | break; |
||
23429 | } |
||
23430 | } |
||
23431 | } |
||
23432 | |||
23433 | const char *OwnershipAttr::getSpelling() const { |
||
23434 | switch (getAttributeSpellingListIndex()) { |
||
23435 | default: |
||
23436 | llvm_unreachable("Unknown attribute spelling!"); |
||
23437 | return "(No spelling)"; |
||
23438 | case 0: |
||
23439 | return "ownership_holds"; |
||
23440 | case 1: |
||
23441 | return "ownership_holds"; |
||
23442 | case 2: |
||
23443 | return "ownership_holds"; |
||
23444 | case 3: |
||
23445 | return "ownership_returns"; |
||
23446 | case 4: |
||
23447 | return "ownership_returns"; |
||
23448 | case 5: |
||
23449 | return "ownership_returns"; |
||
23450 | case 6: |
||
23451 | return "ownership_takes"; |
||
23452 | case 7: |
||
23453 | return "ownership_takes"; |
||
23454 | case 8: |
||
23455 | return "ownership_takes"; |
||
23456 | } |
||
23457 | } |
||
23458 | |||
23459 | |||
23460 | // PackedAttr implementation |
||
23461 | |||
23462 | PackedAttr *PackedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
23463 | auto *A = new (Ctx) PackedAttr(Ctx, CommonInfo); |
||
23464 | A->setImplicit(true); |
||
23465 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23466 | A->setAttributeSpellingListIndex(0); |
||
23467 | return A; |
||
23468 | } |
||
23469 | |||
23470 | PackedAttr *PackedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
23471 | auto *A = new (Ctx) PackedAttr(Ctx, CommonInfo); |
||
23472 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23473 | A->setAttributeSpellingListIndex(0); |
||
23474 | return A; |
||
23475 | } |
||
23476 | |||
23477 | PackedAttr *PackedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23478 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23479 | return CreateImplicit(Ctx, I); |
||
23480 | } |
||
23481 | |||
23482 | PackedAttr *PackedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23483 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23484 | return Create(Ctx, I); |
||
23485 | } |
||
23486 | |||
23487 | PackedAttr::PackedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23488 | ) |
||
23489 | : InheritableAttr(Ctx, CommonInfo, attr::Packed, false, false) |
||
23490 | { |
||
23491 | } |
||
23492 | |||
23493 | PackedAttr *PackedAttr::clone(ASTContext &C) const { |
||
23494 | auto *A = new (C) PackedAttr(C, *this); |
||
23495 | A->Inherited = Inherited; |
||
23496 | A->IsPackExpansion = IsPackExpansion; |
||
23497 | A->setImplicit(Implicit); |
||
23498 | return A; |
||
23499 | } |
||
23500 | |||
23501 | void PackedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
23502 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
23503 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
23504 | switch (getAttributeSpellingListIndex()) { |
||
23505 | default: |
||
23506 | llvm_unreachable("Unknown attribute spelling!"); |
||
23507 | break; |
||
23508 | case 0 : { |
||
23509 | OS << " __attribute__((packed"; |
||
23510 | OS << "))"; |
||
23511 | break; |
||
23512 | } |
||
23513 | case 1 : { |
||
23514 | OS << " [[gnu::packed"; |
||
23515 | OS << "]]"; |
||
23516 | break; |
||
23517 | } |
||
23518 | case 2 : { |
||
23519 | OS << " [[gnu::packed"; |
||
23520 | OS << "]]"; |
||
23521 | break; |
||
23522 | } |
||
23523 | } |
||
23524 | } |
||
23525 | |||
23526 | const char *PackedAttr::getSpelling() const { |
||
23527 | switch (getAttributeSpellingListIndex()) { |
||
23528 | default: |
||
23529 | llvm_unreachable("Unknown attribute spelling!"); |
||
23530 | return "(No spelling)"; |
||
23531 | case 0: |
||
23532 | return "packed"; |
||
23533 | case 1: |
||
23534 | return "packed"; |
||
23535 | case 2: |
||
23536 | return "packed"; |
||
23537 | } |
||
23538 | } |
||
23539 | |||
23540 | |||
23541 | // ParamTypestateAttr implementation |
||
23542 | |||
23543 | ParamTypestateAttr *ParamTypestateAttr::CreateImplicit(ASTContext &Ctx, ConsumedState ParamState, const AttributeCommonInfo &CommonInfo) { |
||
23544 | auto *A = new (Ctx) ParamTypestateAttr(Ctx, CommonInfo, ParamState); |
||
23545 | A->setImplicit(true); |
||
23546 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23547 | A->setAttributeSpellingListIndex(0); |
||
23548 | return A; |
||
23549 | } |
||
23550 | |||
23551 | ParamTypestateAttr *ParamTypestateAttr::Create(ASTContext &Ctx, ConsumedState ParamState, const AttributeCommonInfo &CommonInfo) { |
||
23552 | auto *A = new (Ctx) ParamTypestateAttr(Ctx, CommonInfo, ParamState); |
||
23553 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23554 | A->setAttributeSpellingListIndex(0); |
||
23555 | return A; |
||
23556 | } |
||
23557 | |||
23558 | ParamTypestateAttr *ParamTypestateAttr::CreateImplicit(ASTContext &Ctx, ConsumedState ParamState, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23559 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23560 | return CreateImplicit(Ctx, ParamState, I); |
||
23561 | } |
||
23562 | |||
23563 | ParamTypestateAttr *ParamTypestateAttr::Create(ASTContext &Ctx, ConsumedState ParamState, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23564 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23565 | return Create(Ctx, ParamState, I); |
||
23566 | } |
||
23567 | |||
23568 | ParamTypestateAttr::ParamTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23569 | , ConsumedState ParamState |
||
23570 | ) |
||
23571 | : InheritableAttr(Ctx, CommonInfo, attr::ParamTypestate, false, false) |
||
23572 | , paramState(ParamState) |
||
23573 | { |
||
23574 | } |
||
23575 | |||
23576 | |||
23577 | |||
23578 | bool ParamTypestateAttr::ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) { |
||
23579 | std::optional<ConsumedState> R = llvm::StringSwitch<std::optional<ConsumedState>>(Val) |
||
23580 | .Case("unknown", ParamTypestateAttr::Unknown) |
||
23581 | .Case("consumed", ParamTypestateAttr::Consumed) |
||
23582 | .Case("unconsumed", ParamTypestateAttr::Unconsumed) |
||
23583 | .Default(std::optional<ConsumedState>()); |
||
23584 | if (R) { |
||
23585 | Out = *R; |
||
23586 | return true; |
||
23587 | } |
||
23588 | return false; |
||
23589 | } |
||
23590 | |||
23591 | const char *ParamTypestateAttr::ConvertConsumedStateToStr(ConsumedState Val) { |
||
23592 | switch(Val) { |
||
23593 | case ParamTypestateAttr::Unknown: return "unknown"; |
||
23594 | case ParamTypestateAttr::Consumed: return "consumed"; |
||
23595 | case ParamTypestateAttr::Unconsumed: return "unconsumed"; |
||
23596 | } |
||
23597 | llvm_unreachable("No enumerator with that value"); |
||
23598 | } |
||
23599 | ParamTypestateAttr *ParamTypestateAttr::clone(ASTContext &C) const { |
||
23600 | auto *A = new (C) ParamTypestateAttr(C, *this, paramState); |
||
23601 | A->Inherited = Inherited; |
||
23602 | A->IsPackExpansion = IsPackExpansion; |
||
23603 | A->setImplicit(Implicit); |
||
23604 | return A; |
||
23605 | } |
||
23606 | |||
23607 | void ParamTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
23608 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
23609 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
23610 | switch (getAttributeSpellingListIndex()) { |
||
23611 | default: |
||
23612 | llvm_unreachable("Unknown attribute spelling!"); |
||
23613 | break; |
||
23614 | case 0 : { |
||
23615 | OS << " __attribute__((param_typestate"; |
||
23616 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23617 | OS << "\"" << ParamTypestateAttr::ConvertConsumedStateToStr(getParamState()) << "\""; |
||
23618 | if (!IsFirstArgument) |
||
23619 | OS << ")"; |
||
23620 | OS << "))"; |
||
23621 | break; |
||
23622 | } |
||
23623 | case 1 : { |
||
23624 | OS << " [[clang::param_typestate"; |
||
23625 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23626 | OS << "\"" << ParamTypestateAttr::ConvertConsumedStateToStr(getParamState()) << "\""; |
||
23627 | if (!IsFirstArgument) |
||
23628 | OS << ")"; |
||
23629 | OS << "]]"; |
||
23630 | break; |
||
23631 | } |
||
23632 | } |
||
23633 | } |
||
23634 | |||
23635 | const char *ParamTypestateAttr::getSpelling() const { |
||
23636 | switch (getAttributeSpellingListIndex()) { |
||
23637 | default: |
||
23638 | llvm_unreachable("Unknown attribute spelling!"); |
||
23639 | return "(No spelling)"; |
||
23640 | case 0: |
||
23641 | return "param_typestate"; |
||
23642 | case 1: |
||
23643 | return "param_typestate"; |
||
23644 | } |
||
23645 | } |
||
23646 | |||
23647 | |||
23648 | // PascalAttr implementation |
||
23649 | |||
23650 | PascalAttr *PascalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
23651 | auto *A = new (Ctx) PascalAttr(Ctx, CommonInfo); |
||
23652 | A->setImplicit(true); |
||
23653 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23654 | A->setAttributeSpellingListIndex(0); |
||
23655 | return A; |
||
23656 | } |
||
23657 | |||
23658 | PascalAttr *PascalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
23659 | auto *A = new (Ctx) PascalAttr(Ctx, CommonInfo); |
||
23660 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23661 | A->setAttributeSpellingListIndex(0); |
||
23662 | return A; |
||
23663 | } |
||
23664 | |||
23665 | PascalAttr *PascalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23666 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23667 | return CreateImplicit(Ctx, I); |
||
23668 | } |
||
23669 | |||
23670 | PascalAttr *PascalAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23671 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23672 | return Create(Ctx, I); |
||
23673 | } |
||
23674 | |||
23675 | PascalAttr::PascalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23676 | ) |
||
23677 | : InheritableAttr(Ctx, CommonInfo, attr::Pascal, false, false) |
||
23678 | { |
||
23679 | } |
||
23680 | |||
23681 | PascalAttr *PascalAttr::clone(ASTContext &C) const { |
||
23682 | auto *A = new (C) PascalAttr(C, *this); |
||
23683 | A->Inherited = Inherited; |
||
23684 | A->IsPackExpansion = IsPackExpansion; |
||
23685 | A->setImplicit(Implicit); |
||
23686 | return A; |
||
23687 | } |
||
23688 | |||
23689 | void PascalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
23690 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
23691 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
23692 | switch (getAttributeSpellingListIndex()) { |
||
23693 | default: |
||
23694 | llvm_unreachable("Unknown attribute spelling!"); |
||
23695 | break; |
||
23696 | case 0 : { |
||
23697 | OS << " __attribute__((pascal"; |
||
23698 | OS << "))"; |
||
23699 | break; |
||
23700 | } |
||
23701 | case 1 : { |
||
23702 | OS << " [[clang::pascal"; |
||
23703 | OS << "]]"; |
||
23704 | break; |
||
23705 | } |
||
23706 | case 2 : { |
||
23707 | OS << " [[clang::pascal"; |
||
23708 | OS << "]]"; |
||
23709 | break; |
||
23710 | } |
||
23711 | case 3 : { |
||
23712 | OS << " __pascal"; |
||
23713 | OS << ""; |
||
23714 | break; |
||
23715 | } |
||
23716 | case 4 : { |
||
23717 | OS << " _pascal"; |
||
23718 | OS << ""; |
||
23719 | break; |
||
23720 | } |
||
23721 | } |
||
23722 | } |
||
23723 | |||
23724 | const char *PascalAttr::getSpelling() const { |
||
23725 | switch (getAttributeSpellingListIndex()) { |
||
23726 | default: |
||
23727 | llvm_unreachable("Unknown attribute spelling!"); |
||
23728 | return "(No spelling)"; |
||
23729 | case 0: |
||
23730 | return "pascal"; |
||
23731 | case 1: |
||
23732 | return "pascal"; |
||
23733 | case 2: |
||
23734 | return "pascal"; |
||
23735 | case 3: |
||
23736 | return "__pascal"; |
||
23737 | case 4: |
||
23738 | return "_pascal"; |
||
23739 | } |
||
23740 | } |
||
23741 | |||
23742 | |||
23743 | // PassObjectSizeAttr implementation |
||
23744 | |||
23745 | PassObjectSizeAttr *PassObjectSizeAttr::CreateImplicit(ASTContext &Ctx, int Type, const AttributeCommonInfo &CommonInfo) { |
||
23746 | auto *A = new (Ctx) PassObjectSizeAttr(Ctx, CommonInfo, Type); |
||
23747 | A->setImplicit(true); |
||
23748 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23749 | A->setAttributeSpellingListIndex(0); |
||
23750 | return A; |
||
23751 | } |
||
23752 | |||
23753 | PassObjectSizeAttr *PassObjectSizeAttr::Create(ASTContext &Ctx, int Type, const AttributeCommonInfo &CommonInfo) { |
||
23754 | auto *A = new (Ctx) PassObjectSizeAttr(Ctx, CommonInfo, Type); |
||
23755 | return A; |
||
23756 | } |
||
23757 | |||
23758 | PassObjectSizeAttr *PassObjectSizeAttr::CreateImplicit(ASTContext &Ctx, int Type, SourceRange Range, AttributeCommonInfo::Syntax Syntax, PassObjectSizeAttr::Spelling S) { |
||
23759 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
23760 | return CreateImplicit(Ctx, Type, I); |
||
23761 | } |
||
23762 | |||
23763 | PassObjectSizeAttr *PassObjectSizeAttr::Create(ASTContext &Ctx, int Type, SourceRange Range, AttributeCommonInfo::Syntax Syntax, PassObjectSizeAttr::Spelling S) { |
||
23764 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
23765 | return Create(Ctx, Type, I); |
||
23766 | } |
||
23767 | |||
23768 | PassObjectSizeAttr::PassObjectSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23769 | , int Type |
||
23770 | ) |
||
23771 | : InheritableParamAttr(Ctx, CommonInfo, attr::PassObjectSize, false, false) |
||
23772 | , type(Type) |
||
23773 | { |
||
23774 | } |
||
23775 | |||
23776 | PassObjectSizeAttr::Spelling PassObjectSizeAttr::getSemanticSpelling() const { |
||
23777 | switch (getAttributeSpellingListIndex()) { |
||
23778 | default: llvm_unreachable("Unknown spelling list index"); |
||
23779 | case 0: return GNU_pass_object_size; |
||
23780 | case 1: return CXX11_clang_pass_object_size; |
||
23781 | case 2: return C2x_clang_pass_object_size; |
||
23782 | case 3: return GNU_pass_dynamic_object_size; |
||
23783 | case 4: return CXX11_clang_pass_dynamic_object_size; |
||
23784 | case 5: return C2x_clang_pass_dynamic_object_size; |
||
23785 | } |
||
23786 | } |
||
23787 | |||
23788 | |||
23789 | PassObjectSizeAttr *PassObjectSizeAttr::clone(ASTContext &C) const { |
||
23790 | auto *A = new (C) PassObjectSizeAttr(C, *this, type); |
||
23791 | A->Inherited = Inherited; |
||
23792 | A->IsPackExpansion = IsPackExpansion; |
||
23793 | A->setImplicit(Implicit); |
||
23794 | return A; |
||
23795 | } |
||
23796 | |||
23797 | void PassObjectSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
23798 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
23799 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
23800 | switch (getAttributeSpellingListIndex()) { |
||
23801 | default: |
||
23802 | llvm_unreachable("Unknown attribute spelling!"); |
||
23803 | break; |
||
23804 | case 0 : { |
||
23805 | OS << " __attribute__((pass_object_size"; |
||
23806 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23807 | OS << "" << getType() << ""; |
||
23808 | if (!IsFirstArgument) |
||
23809 | OS << ")"; |
||
23810 | OS << "))"; |
||
23811 | break; |
||
23812 | } |
||
23813 | case 1 : { |
||
23814 | OS << " [[clang::pass_object_size"; |
||
23815 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23816 | OS << "" << getType() << ""; |
||
23817 | if (!IsFirstArgument) |
||
23818 | OS << ")"; |
||
23819 | OS << "]]"; |
||
23820 | break; |
||
23821 | } |
||
23822 | case 2 : { |
||
23823 | OS << " [[clang::pass_object_size"; |
||
23824 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23825 | OS << "" << getType() << ""; |
||
23826 | if (!IsFirstArgument) |
||
23827 | OS << ")"; |
||
23828 | OS << "]]"; |
||
23829 | break; |
||
23830 | } |
||
23831 | case 3 : { |
||
23832 | OS << " __attribute__((pass_dynamic_object_size"; |
||
23833 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23834 | OS << "" << getType() << ""; |
||
23835 | if (!IsFirstArgument) |
||
23836 | OS << ")"; |
||
23837 | OS << "))"; |
||
23838 | break; |
||
23839 | } |
||
23840 | case 4 : { |
||
23841 | OS << " [[clang::pass_dynamic_object_size"; |
||
23842 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23843 | OS << "" << getType() << ""; |
||
23844 | if (!IsFirstArgument) |
||
23845 | OS << ")"; |
||
23846 | OS << "]]"; |
||
23847 | break; |
||
23848 | } |
||
23849 | case 5 : { |
||
23850 | OS << " [[clang::pass_dynamic_object_size"; |
||
23851 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23852 | OS << "" << getType() << ""; |
||
23853 | if (!IsFirstArgument) |
||
23854 | OS << ")"; |
||
23855 | OS << "]]"; |
||
23856 | break; |
||
23857 | } |
||
23858 | } |
||
23859 | } |
||
23860 | |||
23861 | const char *PassObjectSizeAttr::getSpelling() const { |
||
23862 | switch (getAttributeSpellingListIndex()) { |
||
23863 | default: |
||
23864 | llvm_unreachable("Unknown attribute spelling!"); |
||
23865 | return "(No spelling)"; |
||
23866 | case 0: |
||
23867 | return "pass_object_size"; |
||
23868 | case 1: |
||
23869 | return "pass_object_size"; |
||
23870 | case 2: |
||
23871 | return "pass_object_size"; |
||
23872 | case 3: |
||
23873 | return "pass_dynamic_object_size"; |
||
23874 | case 4: |
||
23875 | return "pass_dynamic_object_size"; |
||
23876 | case 5: |
||
23877 | return "pass_dynamic_object_size"; |
||
23878 | } |
||
23879 | } |
||
23880 | |||
23881 | |||
23882 | // PatchableFunctionEntryAttr implementation |
||
23883 | |||
23884 | PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::CreateImplicit(ASTContext &Ctx, unsigned Count, int Offset, const AttributeCommonInfo &CommonInfo) { |
||
23885 | auto *A = new (Ctx) PatchableFunctionEntryAttr(Ctx, CommonInfo, Count, Offset); |
||
23886 | A->setImplicit(true); |
||
23887 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23888 | A->setAttributeSpellingListIndex(0); |
||
23889 | return A; |
||
23890 | } |
||
23891 | |||
23892 | PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::Create(ASTContext &Ctx, unsigned Count, int Offset, const AttributeCommonInfo &CommonInfo) { |
||
23893 | auto *A = new (Ctx) PatchableFunctionEntryAttr(Ctx, CommonInfo, Count, Offset); |
||
23894 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
23895 | A->setAttributeSpellingListIndex(0); |
||
23896 | return A; |
||
23897 | } |
||
23898 | |||
23899 | PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::CreateImplicit(ASTContext &Ctx, unsigned Count, int Offset, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23900 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23901 | return CreateImplicit(Ctx, Count, Offset, I); |
||
23902 | } |
||
23903 | |||
23904 | PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::Create(ASTContext &Ctx, unsigned Count, int Offset, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
23905 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
23906 | return Create(Ctx, Count, Offset, I); |
||
23907 | } |
||
23908 | |||
23909 | PatchableFunctionEntryAttr::PatchableFunctionEntryAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23910 | , unsigned Count |
||
23911 | , int Offset |
||
23912 | ) |
||
23913 | : InheritableAttr(Ctx, CommonInfo, attr::PatchableFunctionEntry, false, false) |
||
23914 | , count(Count) |
||
23915 | , offset(Offset) |
||
23916 | { |
||
23917 | } |
||
23918 | |||
23919 | PatchableFunctionEntryAttr::PatchableFunctionEntryAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
23920 | , unsigned Count |
||
23921 | ) |
||
23922 | : InheritableAttr(Ctx, CommonInfo, attr::PatchableFunctionEntry, false, false) |
||
23923 | , count(Count) |
||
23924 | , offset() |
||
23925 | { |
||
23926 | } |
||
23927 | |||
23928 | |||
23929 | |||
23930 | |||
23931 | |||
23932 | PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::clone(ASTContext &C) const { |
||
23933 | auto *A = new (C) PatchableFunctionEntryAttr(C, *this, count, offset); |
||
23934 | A->Inherited = Inherited; |
||
23935 | A->IsPackExpansion = IsPackExpansion; |
||
23936 | A->setImplicit(Implicit); |
||
23937 | return A; |
||
23938 | } |
||
23939 | |||
23940 | void PatchableFunctionEntryAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
23941 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
23942 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
23943 | switch (getAttributeSpellingListIndex()) { |
||
23944 | default: |
||
23945 | llvm_unreachable("Unknown attribute spelling!"); |
||
23946 | break; |
||
23947 | case 0 : { |
||
23948 | OS << " __attribute__((patchable_function_entry"; |
||
23949 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23950 | OS << "" << getCount() << ""; |
||
23951 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23952 | OS << "" << getOffset() << ""; |
||
23953 | if (!IsFirstArgument) |
||
23954 | OS << ")"; |
||
23955 | OS << "))"; |
||
23956 | break; |
||
23957 | } |
||
23958 | case 1 : { |
||
23959 | OS << " [[gnu::patchable_function_entry"; |
||
23960 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23961 | OS << "" << getCount() << ""; |
||
23962 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23963 | OS << "" << getOffset() << ""; |
||
23964 | if (!IsFirstArgument) |
||
23965 | OS << ")"; |
||
23966 | OS << "]]"; |
||
23967 | break; |
||
23968 | } |
||
23969 | case 2 : { |
||
23970 | OS << " [[gnu::patchable_function_entry"; |
||
23971 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23972 | OS << "" << getCount() << ""; |
||
23973 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
23974 | OS << "" << getOffset() << ""; |
||
23975 | if (!IsFirstArgument) |
||
23976 | OS << ")"; |
||
23977 | OS << "]]"; |
||
23978 | break; |
||
23979 | } |
||
23980 | } |
||
23981 | } |
||
23982 | |||
23983 | const char *PatchableFunctionEntryAttr::getSpelling() const { |
||
23984 | switch (getAttributeSpellingListIndex()) { |
||
23985 | default: |
||
23986 | llvm_unreachable("Unknown attribute spelling!"); |
||
23987 | return "(No spelling)"; |
||
23988 | case 0: |
||
23989 | return "patchable_function_entry"; |
||
23990 | case 1: |
||
23991 | return "patchable_function_entry"; |
||
23992 | case 2: |
||
23993 | return "patchable_function_entry"; |
||
23994 | } |
||
23995 | } |
||
23996 | |||
23997 | |||
23998 | // PcsAttr implementation |
||
23999 | |||
24000 | PcsAttr *PcsAttr::CreateImplicit(ASTContext &Ctx, PCSType PCS, const AttributeCommonInfo &CommonInfo) { |
||
24001 | auto *A = new (Ctx) PcsAttr(Ctx, CommonInfo, PCS); |
||
24002 | A->setImplicit(true); |
||
24003 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24004 | A->setAttributeSpellingListIndex(0); |
||
24005 | return A; |
||
24006 | } |
||
24007 | |||
24008 | PcsAttr *PcsAttr::Create(ASTContext &Ctx, PCSType PCS, const AttributeCommonInfo &CommonInfo) { |
||
24009 | auto *A = new (Ctx) PcsAttr(Ctx, CommonInfo, PCS); |
||
24010 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24011 | A->setAttributeSpellingListIndex(0); |
||
24012 | return A; |
||
24013 | } |
||
24014 | |||
24015 | PcsAttr *PcsAttr::CreateImplicit(ASTContext &Ctx, PCSType PCS, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24016 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24017 | return CreateImplicit(Ctx, PCS, I); |
||
24018 | } |
||
24019 | |||
24020 | PcsAttr *PcsAttr::Create(ASTContext &Ctx, PCSType PCS, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24021 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24022 | return Create(Ctx, PCS, I); |
||
24023 | } |
||
24024 | |||
24025 | PcsAttr::PcsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24026 | , PCSType PCS |
||
24027 | ) |
||
24028 | : InheritableAttr(Ctx, CommonInfo, attr::Pcs, false, false) |
||
24029 | , pCS(PCS) |
||
24030 | { |
||
24031 | } |
||
24032 | |||
24033 | |||
24034 | |||
24035 | bool PcsAttr::ConvertStrToPCSType(StringRef Val, PCSType &Out) { |
||
24036 | std::optional<PCSType> R = llvm::StringSwitch<std::optional<PCSType>>(Val) |
||
24037 | .Case("aapcs", PcsAttr::AAPCS) |
||
24038 | .Case("aapcs-vfp", PcsAttr::AAPCS_VFP) |
||
24039 | .Default(std::optional<PCSType>()); |
||
24040 | if (R) { |
||
24041 | Out = *R; |
||
24042 | return true; |
||
24043 | } |
||
24044 | return false; |
||
24045 | } |
||
24046 | |||
24047 | const char *PcsAttr::ConvertPCSTypeToStr(PCSType Val) { |
||
24048 | switch(Val) { |
||
24049 | case PcsAttr::AAPCS: return "aapcs"; |
||
24050 | case PcsAttr::AAPCS_VFP: return "aapcs-vfp"; |
||
24051 | } |
||
24052 | llvm_unreachable("No enumerator with that value"); |
||
24053 | } |
||
24054 | PcsAttr *PcsAttr::clone(ASTContext &C) const { |
||
24055 | auto *A = new (C) PcsAttr(C, *this, pCS); |
||
24056 | A->Inherited = Inherited; |
||
24057 | A->IsPackExpansion = IsPackExpansion; |
||
24058 | A->setImplicit(Implicit); |
||
24059 | return A; |
||
24060 | } |
||
24061 | |||
24062 | void PcsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24063 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
24064 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
24065 | switch (getAttributeSpellingListIndex()) { |
||
24066 | default: |
||
24067 | llvm_unreachable("Unknown attribute spelling!"); |
||
24068 | break; |
||
24069 | case 0 : { |
||
24070 | OS << " __attribute__((pcs"; |
||
24071 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
24072 | OS << "\"" << PcsAttr::ConvertPCSTypeToStr(getPCS()) << "\""; |
||
24073 | if (!IsFirstArgument) |
||
24074 | OS << ")"; |
||
24075 | OS << "))"; |
||
24076 | break; |
||
24077 | } |
||
24078 | case 1 : { |
||
24079 | OS << " [[gnu::pcs"; |
||
24080 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
24081 | OS << "\"" << PcsAttr::ConvertPCSTypeToStr(getPCS()) << "\""; |
||
24082 | if (!IsFirstArgument) |
||
24083 | OS << ")"; |
||
24084 | OS << "]]"; |
||
24085 | break; |
||
24086 | } |
||
24087 | case 2 : { |
||
24088 | OS << " [[gnu::pcs"; |
||
24089 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
24090 | OS << "\"" << PcsAttr::ConvertPCSTypeToStr(getPCS()) << "\""; |
||
24091 | if (!IsFirstArgument) |
||
24092 | OS << ")"; |
||
24093 | OS << "]]"; |
||
24094 | break; |
||
24095 | } |
||
24096 | } |
||
24097 | } |
||
24098 | |||
24099 | const char *PcsAttr::getSpelling() const { |
||
24100 | switch (getAttributeSpellingListIndex()) { |
||
24101 | default: |
||
24102 | llvm_unreachable("Unknown attribute spelling!"); |
||
24103 | return "(No spelling)"; |
||
24104 | case 0: |
||
24105 | return "pcs"; |
||
24106 | case 1: |
||
24107 | return "pcs"; |
||
24108 | case 2: |
||
24109 | return "pcs"; |
||
24110 | } |
||
24111 | } |
||
24112 | |||
24113 | |||
24114 | // PointerAttr implementation |
||
24115 | |||
24116 | PointerAttr *PointerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) { |
||
24117 | auto *A = new (Ctx) PointerAttr(Ctx, CommonInfo, DerefType); |
||
24118 | A->setImplicit(true); |
||
24119 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24120 | A->setAttributeSpellingListIndex(0); |
||
24121 | return A; |
||
24122 | } |
||
24123 | |||
24124 | PointerAttr *PointerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) { |
||
24125 | auto *A = new (Ctx) PointerAttr(Ctx, CommonInfo, DerefType); |
||
24126 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24127 | A->setAttributeSpellingListIndex(0); |
||
24128 | return A; |
||
24129 | } |
||
24130 | |||
24131 | PointerAttr *PointerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24132 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24133 | return CreateImplicit(Ctx, DerefType, I); |
||
24134 | } |
||
24135 | |||
24136 | PointerAttr *PointerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24137 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24138 | return Create(Ctx, DerefType, I); |
||
24139 | } |
||
24140 | |||
24141 | PointerAttr::PointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24142 | , TypeSourceInfo * DerefType |
||
24143 | ) |
||
24144 | : InheritableAttr(Ctx, CommonInfo, attr::Pointer, false, false) |
||
24145 | , derefType(DerefType) |
||
24146 | { |
||
24147 | } |
||
24148 | |||
24149 | PointerAttr::PointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24150 | ) |
||
24151 | : InheritableAttr(Ctx, CommonInfo, attr::Pointer, false, false) |
||
24152 | , derefType() |
||
24153 | { |
||
24154 | } |
||
24155 | |||
24156 | |||
24157 | |||
24158 | PointerAttr *PointerAttr::clone(ASTContext &C) const { |
||
24159 | auto *A = new (C) PointerAttr(C, *this, derefType); |
||
24160 | A->Inherited = Inherited; |
||
24161 | A->IsPackExpansion = IsPackExpansion; |
||
24162 | A->setImplicit(Implicit); |
||
24163 | return A; |
||
24164 | } |
||
24165 | |||
24166 | void PointerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24167 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
24168 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
24169 | switch (getAttributeSpellingListIndex()) { |
||
24170 | default: |
||
24171 | llvm_unreachable("Unknown attribute spelling!"); |
||
24172 | break; |
||
24173 | case 0 : { |
||
24174 | OS << " [[gsl::Pointer"; |
||
24175 | if (!getDerefTypeLoc()) |
||
24176 | ++TrailingOmittedArgs; |
||
24177 | if (!(!getDerefTypeLoc())) { |
||
24178 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
24179 | OS << "" << getDerefType().getAsString() << ""; |
||
24180 | } |
||
24181 | if (!IsFirstArgument) |
||
24182 | OS << ")"; |
||
24183 | OS << "]]"; |
||
24184 | break; |
||
24185 | } |
||
24186 | } |
||
24187 | } |
||
24188 | |||
24189 | const char *PointerAttr::getSpelling() const { |
||
24190 | switch (getAttributeSpellingListIndex()) { |
||
24191 | default: |
||
24192 | llvm_unreachable("Unknown attribute spelling!"); |
||
24193 | return "(No spelling)"; |
||
24194 | case 0: |
||
24195 | return "Pointer"; |
||
24196 | } |
||
24197 | } |
||
24198 | |||
24199 | |||
24200 | // PragmaClangBSSSectionAttr implementation |
||
24201 | |||
24202 | PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24203 | auto *A = new (Ctx) PragmaClangBSSSectionAttr(Ctx, CommonInfo, Name); |
||
24204 | A->setImplicit(true); |
||
24205 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24206 | A->setAttributeSpellingListIndex(0); |
||
24207 | return A; |
||
24208 | } |
||
24209 | |||
24210 | PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24211 | auto *A = new (Ctx) PragmaClangBSSSectionAttr(Ctx, CommonInfo, Name); |
||
24212 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24213 | A->setAttributeSpellingListIndex(0); |
||
24214 | return A; |
||
24215 | } |
||
24216 | |||
24217 | PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24218 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24219 | return CreateImplicit(Ctx, Name, I); |
||
24220 | } |
||
24221 | |||
24222 | PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24223 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24224 | return Create(Ctx, Name, I); |
||
24225 | } |
||
24226 | |||
24227 | PragmaClangBSSSectionAttr::PragmaClangBSSSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24228 | , llvm::StringRef Name |
||
24229 | ) |
||
24230 | : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangBSSSection, false, false) |
||
24231 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
24232 | { |
||
24233 | if (!Name.empty()) |
||
24234 | std::memcpy(name, Name.data(), nameLength); |
||
24235 | } |
||
24236 | |||
24237 | |||
24238 | |||
24239 | PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::clone(ASTContext &C) const { |
||
24240 | auto *A = new (C) PragmaClangBSSSectionAttr(C, *this, getName()); |
||
24241 | A->Inherited = Inherited; |
||
24242 | A->IsPackExpansion = IsPackExpansion; |
||
24243 | A->setImplicit(Implicit); |
||
24244 | return A; |
||
24245 | } |
||
24246 | |||
24247 | void PragmaClangBSSSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24248 | } |
||
24249 | |||
24250 | const char *PragmaClangBSSSectionAttr::getSpelling() const { |
||
24251 | return "(No spelling)"; |
||
24252 | } |
||
24253 | |||
24254 | |||
24255 | // PragmaClangDataSectionAttr implementation |
||
24256 | |||
24257 | PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24258 | auto *A = new (Ctx) PragmaClangDataSectionAttr(Ctx, CommonInfo, Name); |
||
24259 | A->setImplicit(true); |
||
24260 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24261 | A->setAttributeSpellingListIndex(0); |
||
24262 | return A; |
||
24263 | } |
||
24264 | |||
24265 | PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24266 | auto *A = new (Ctx) PragmaClangDataSectionAttr(Ctx, CommonInfo, Name); |
||
24267 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24268 | A->setAttributeSpellingListIndex(0); |
||
24269 | return A; |
||
24270 | } |
||
24271 | |||
24272 | PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24273 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24274 | return CreateImplicit(Ctx, Name, I); |
||
24275 | } |
||
24276 | |||
24277 | PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24278 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24279 | return Create(Ctx, Name, I); |
||
24280 | } |
||
24281 | |||
24282 | PragmaClangDataSectionAttr::PragmaClangDataSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24283 | , llvm::StringRef Name |
||
24284 | ) |
||
24285 | : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangDataSection, false, false) |
||
24286 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
24287 | { |
||
24288 | if (!Name.empty()) |
||
24289 | std::memcpy(name, Name.data(), nameLength); |
||
24290 | } |
||
24291 | |||
24292 | |||
24293 | |||
24294 | PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::clone(ASTContext &C) const { |
||
24295 | auto *A = new (C) PragmaClangDataSectionAttr(C, *this, getName()); |
||
24296 | A->Inherited = Inherited; |
||
24297 | A->IsPackExpansion = IsPackExpansion; |
||
24298 | A->setImplicit(Implicit); |
||
24299 | return A; |
||
24300 | } |
||
24301 | |||
24302 | void PragmaClangDataSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24303 | } |
||
24304 | |||
24305 | const char *PragmaClangDataSectionAttr::getSpelling() const { |
||
24306 | return "(No spelling)"; |
||
24307 | } |
||
24308 | |||
24309 | |||
24310 | // PragmaClangRelroSectionAttr implementation |
||
24311 | |||
24312 | PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24313 | auto *A = new (Ctx) PragmaClangRelroSectionAttr(Ctx, CommonInfo, Name); |
||
24314 | A->setImplicit(true); |
||
24315 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24316 | A->setAttributeSpellingListIndex(0); |
||
24317 | return A; |
||
24318 | } |
||
24319 | |||
24320 | PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24321 | auto *A = new (Ctx) PragmaClangRelroSectionAttr(Ctx, CommonInfo, Name); |
||
24322 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24323 | A->setAttributeSpellingListIndex(0); |
||
24324 | return A; |
||
24325 | } |
||
24326 | |||
24327 | PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24328 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24329 | return CreateImplicit(Ctx, Name, I); |
||
24330 | } |
||
24331 | |||
24332 | PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24333 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24334 | return Create(Ctx, Name, I); |
||
24335 | } |
||
24336 | |||
24337 | PragmaClangRelroSectionAttr::PragmaClangRelroSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24338 | , llvm::StringRef Name |
||
24339 | ) |
||
24340 | : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangRelroSection, false, false) |
||
24341 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
24342 | { |
||
24343 | if (!Name.empty()) |
||
24344 | std::memcpy(name, Name.data(), nameLength); |
||
24345 | } |
||
24346 | |||
24347 | |||
24348 | |||
24349 | PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::clone(ASTContext &C) const { |
||
24350 | auto *A = new (C) PragmaClangRelroSectionAttr(C, *this, getName()); |
||
24351 | A->Inherited = Inherited; |
||
24352 | A->IsPackExpansion = IsPackExpansion; |
||
24353 | A->setImplicit(Implicit); |
||
24354 | return A; |
||
24355 | } |
||
24356 | |||
24357 | void PragmaClangRelroSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24358 | } |
||
24359 | |||
24360 | const char *PragmaClangRelroSectionAttr::getSpelling() const { |
||
24361 | return "(No spelling)"; |
||
24362 | } |
||
24363 | |||
24364 | |||
24365 | // PragmaClangRodataSectionAttr implementation |
||
24366 | |||
24367 | PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24368 | auto *A = new (Ctx) PragmaClangRodataSectionAttr(Ctx, CommonInfo, Name); |
||
24369 | A->setImplicit(true); |
||
24370 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24371 | A->setAttributeSpellingListIndex(0); |
||
24372 | return A; |
||
24373 | } |
||
24374 | |||
24375 | PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24376 | auto *A = new (Ctx) PragmaClangRodataSectionAttr(Ctx, CommonInfo, Name); |
||
24377 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24378 | A->setAttributeSpellingListIndex(0); |
||
24379 | return A; |
||
24380 | } |
||
24381 | |||
24382 | PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24383 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24384 | return CreateImplicit(Ctx, Name, I); |
||
24385 | } |
||
24386 | |||
24387 | PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24388 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24389 | return Create(Ctx, Name, I); |
||
24390 | } |
||
24391 | |||
24392 | PragmaClangRodataSectionAttr::PragmaClangRodataSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24393 | , llvm::StringRef Name |
||
24394 | ) |
||
24395 | : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangRodataSection, false, false) |
||
24396 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
24397 | { |
||
24398 | if (!Name.empty()) |
||
24399 | std::memcpy(name, Name.data(), nameLength); |
||
24400 | } |
||
24401 | |||
24402 | |||
24403 | |||
24404 | PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::clone(ASTContext &C) const { |
||
24405 | auto *A = new (C) PragmaClangRodataSectionAttr(C, *this, getName()); |
||
24406 | A->Inherited = Inherited; |
||
24407 | A->IsPackExpansion = IsPackExpansion; |
||
24408 | A->setImplicit(Implicit); |
||
24409 | return A; |
||
24410 | } |
||
24411 | |||
24412 | void PragmaClangRodataSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24413 | } |
||
24414 | |||
24415 | const char *PragmaClangRodataSectionAttr::getSpelling() const { |
||
24416 | return "(No spelling)"; |
||
24417 | } |
||
24418 | |||
24419 | |||
24420 | // PragmaClangTextSectionAttr implementation |
||
24421 | |||
24422 | PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24423 | auto *A = new (Ctx) PragmaClangTextSectionAttr(Ctx, CommonInfo, Name); |
||
24424 | A->setImplicit(true); |
||
24425 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24426 | A->setAttributeSpellingListIndex(0); |
||
24427 | return A; |
||
24428 | } |
||
24429 | |||
24430 | PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
24431 | auto *A = new (Ctx) PragmaClangTextSectionAttr(Ctx, CommonInfo, Name); |
||
24432 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24433 | A->setAttributeSpellingListIndex(0); |
||
24434 | return A; |
||
24435 | } |
||
24436 | |||
24437 | PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24438 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24439 | return CreateImplicit(Ctx, Name, I); |
||
24440 | } |
||
24441 | |||
24442 | PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24443 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24444 | return Create(Ctx, Name, I); |
||
24445 | } |
||
24446 | |||
24447 | PragmaClangTextSectionAttr::PragmaClangTextSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24448 | , llvm::StringRef Name |
||
24449 | ) |
||
24450 | : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangTextSection, false, false) |
||
24451 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
24452 | { |
||
24453 | if (!Name.empty()) |
||
24454 | std::memcpy(name, Name.data(), nameLength); |
||
24455 | } |
||
24456 | |||
24457 | |||
24458 | |||
24459 | PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::clone(ASTContext &C) const { |
||
24460 | auto *A = new (C) PragmaClangTextSectionAttr(C, *this, getName()); |
||
24461 | A->Inherited = Inherited; |
||
24462 | A->IsPackExpansion = IsPackExpansion; |
||
24463 | A->setImplicit(Implicit); |
||
24464 | return A; |
||
24465 | } |
||
24466 | |||
24467 | void PragmaClangTextSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24468 | } |
||
24469 | |||
24470 | const char *PragmaClangTextSectionAttr::getSpelling() const { |
||
24471 | return "(No spelling)"; |
||
24472 | } |
||
24473 | |||
24474 | |||
24475 | // PreferredNameAttr implementation |
||
24476 | |||
24477 | PreferredNameAttr *PreferredNameAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypedefType, const AttributeCommonInfo &CommonInfo) { |
||
24478 | auto *A = new (Ctx) PreferredNameAttr(Ctx, CommonInfo, TypedefType); |
||
24479 | A->setImplicit(true); |
||
24480 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24481 | A->setAttributeSpellingListIndex(0); |
||
24482 | return A; |
||
24483 | } |
||
24484 | |||
24485 | PreferredNameAttr *PreferredNameAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypedefType, const AttributeCommonInfo &CommonInfo) { |
||
24486 | auto *A = new (Ctx) PreferredNameAttr(Ctx, CommonInfo, TypedefType); |
||
24487 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24488 | A->setAttributeSpellingListIndex(0); |
||
24489 | return A; |
||
24490 | } |
||
24491 | |||
24492 | PreferredNameAttr *PreferredNameAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypedefType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24493 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24494 | return CreateImplicit(Ctx, TypedefType, I); |
||
24495 | } |
||
24496 | |||
24497 | PreferredNameAttr *PreferredNameAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypedefType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24498 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24499 | return Create(Ctx, TypedefType, I); |
||
24500 | } |
||
24501 | |||
24502 | PreferredNameAttr::PreferredNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24503 | , TypeSourceInfo * TypedefType |
||
24504 | ) |
||
24505 | : InheritableAttr(Ctx, CommonInfo, attr::PreferredName, false, true) |
||
24506 | , typedefType(TypedefType) |
||
24507 | { |
||
24508 | } |
||
24509 | |||
24510 | |||
24511 | |||
24512 | PreferredNameAttr *PreferredNameAttr::clone(ASTContext &C) const { |
||
24513 | auto *A = new (C) PreferredNameAttr(C, *this, typedefType); |
||
24514 | A->Inherited = Inherited; |
||
24515 | A->IsPackExpansion = IsPackExpansion; |
||
24516 | A->setImplicit(Implicit); |
||
24517 | return A; |
||
24518 | } |
||
24519 | |||
24520 | void PreferredNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24521 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
24522 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
24523 | switch (getAttributeSpellingListIndex()) { |
||
24524 | default: |
||
24525 | llvm_unreachable("Unknown attribute spelling!"); |
||
24526 | break; |
||
24527 | case 0 : { |
||
24528 | OS << " __attribute__((preferred_name"; |
||
24529 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
24530 | OS << "" << getTypedefType().getAsString() << ""; |
||
24531 | if (!IsFirstArgument) |
||
24532 | OS << ")"; |
||
24533 | OS << "))"; |
||
24534 | break; |
||
24535 | } |
||
24536 | case 1 : { |
||
24537 | OS << " [[clang::preferred_name"; |
||
24538 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
24539 | OS << "" << getTypedefType().getAsString() << ""; |
||
24540 | if (!IsFirstArgument) |
||
24541 | OS << ")"; |
||
24542 | OS << "]]"; |
||
24543 | break; |
||
24544 | } |
||
24545 | } |
||
24546 | } |
||
24547 | |||
24548 | const char *PreferredNameAttr::getSpelling() const { |
||
24549 | switch (getAttributeSpellingListIndex()) { |
||
24550 | default: |
||
24551 | llvm_unreachable("Unknown attribute spelling!"); |
||
24552 | return "(No spelling)"; |
||
24553 | case 0: |
||
24554 | return "preferred_name"; |
||
24555 | case 1: |
||
24556 | return "preferred_name"; |
||
24557 | } |
||
24558 | } |
||
24559 | |||
24560 | |||
24561 | // PreserveAllAttr implementation |
||
24562 | |||
24563 | PreserveAllAttr *PreserveAllAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24564 | auto *A = new (Ctx) PreserveAllAttr(Ctx, CommonInfo); |
||
24565 | A->setImplicit(true); |
||
24566 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24567 | A->setAttributeSpellingListIndex(0); |
||
24568 | return A; |
||
24569 | } |
||
24570 | |||
24571 | PreserveAllAttr *PreserveAllAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24572 | auto *A = new (Ctx) PreserveAllAttr(Ctx, CommonInfo); |
||
24573 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24574 | A->setAttributeSpellingListIndex(0); |
||
24575 | return A; |
||
24576 | } |
||
24577 | |||
24578 | PreserveAllAttr *PreserveAllAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24579 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24580 | return CreateImplicit(Ctx, I); |
||
24581 | } |
||
24582 | |||
24583 | PreserveAllAttr *PreserveAllAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24584 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24585 | return Create(Ctx, I); |
||
24586 | } |
||
24587 | |||
24588 | PreserveAllAttr::PreserveAllAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24589 | ) |
||
24590 | : InheritableAttr(Ctx, CommonInfo, attr::PreserveAll, false, false) |
||
24591 | { |
||
24592 | } |
||
24593 | |||
24594 | PreserveAllAttr *PreserveAllAttr::clone(ASTContext &C) const { |
||
24595 | auto *A = new (C) PreserveAllAttr(C, *this); |
||
24596 | A->Inherited = Inherited; |
||
24597 | A->IsPackExpansion = IsPackExpansion; |
||
24598 | A->setImplicit(Implicit); |
||
24599 | return A; |
||
24600 | } |
||
24601 | |||
24602 | void PreserveAllAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24603 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
24604 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
24605 | switch (getAttributeSpellingListIndex()) { |
||
24606 | default: |
||
24607 | llvm_unreachable("Unknown attribute spelling!"); |
||
24608 | break; |
||
24609 | case 0 : { |
||
24610 | OS << " __attribute__((preserve_all"; |
||
24611 | OS << "))"; |
||
24612 | break; |
||
24613 | } |
||
24614 | case 1 : { |
||
24615 | OS << " [[clang::preserve_all"; |
||
24616 | OS << "]]"; |
||
24617 | break; |
||
24618 | } |
||
24619 | case 2 : { |
||
24620 | OS << " [[clang::preserve_all"; |
||
24621 | OS << "]]"; |
||
24622 | break; |
||
24623 | } |
||
24624 | } |
||
24625 | } |
||
24626 | |||
24627 | const char *PreserveAllAttr::getSpelling() const { |
||
24628 | switch (getAttributeSpellingListIndex()) { |
||
24629 | default: |
||
24630 | llvm_unreachable("Unknown attribute spelling!"); |
||
24631 | return "(No spelling)"; |
||
24632 | case 0: |
||
24633 | return "preserve_all"; |
||
24634 | case 1: |
||
24635 | return "preserve_all"; |
||
24636 | case 2: |
||
24637 | return "preserve_all"; |
||
24638 | } |
||
24639 | } |
||
24640 | |||
24641 | |||
24642 | // PreserveMostAttr implementation |
||
24643 | |||
24644 | PreserveMostAttr *PreserveMostAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24645 | auto *A = new (Ctx) PreserveMostAttr(Ctx, CommonInfo); |
||
24646 | A->setImplicit(true); |
||
24647 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24648 | A->setAttributeSpellingListIndex(0); |
||
24649 | return A; |
||
24650 | } |
||
24651 | |||
24652 | PreserveMostAttr *PreserveMostAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24653 | auto *A = new (Ctx) PreserveMostAttr(Ctx, CommonInfo); |
||
24654 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24655 | A->setAttributeSpellingListIndex(0); |
||
24656 | return A; |
||
24657 | } |
||
24658 | |||
24659 | PreserveMostAttr *PreserveMostAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24660 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24661 | return CreateImplicit(Ctx, I); |
||
24662 | } |
||
24663 | |||
24664 | PreserveMostAttr *PreserveMostAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24665 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24666 | return Create(Ctx, I); |
||
24667 | } |
||
24668 | |||
24669 | PreserveMostAttr::PreserveMostAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24670 | ) |
||
24671 | : InheritableAttr(Ctx, CommonInfo, attr::PreserveMost, false, false) |
||
24672 | { |
||
24673 | } |
||
24674 | |||
24675 | PreserveMostAttr *PreserveMostAttr::clone(ASTContext &C) const { |
||
24676 | auto *A = new (C) PreserveMostAttr(C, *this); |
||
24677 | A->Inherited = Inherited; |
||
24678 | A->IsPackExpansion = IsPackExpansion; |
||
24679 | A->setImplicit(Implicit); |
||
24680 | return A; |
||
24681 | } |
||
24682 | |||
24683 | void PreserveMostAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24684 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
24685 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
24686 | switch (getAttributeSpellingListIndex()) { |
||
24687 | default: |
||
24688 | llvm_unreachable("Unknown attribute spelling!"); |
||
24689 | break; |
||
24690 | case 0 : { |
||
24691 | OS << " __attribute__((preserve_most"; |
||
24692 | OS << "))"; |
||
24693 | break; |
||
24694 | } |
||
24695 | case 1 : { |
||
24696 | OS << " [[clang::preserve_most"; |
||
24697 | OS << "]]"; |
||
24698 | break; |
||
24699 | } |
||
24700 | case 2 : { |
||
24701 | OS << " [[clang::preserve_most"; |
||
24702 | OS << "]]"; |
||
24703 | break; |
||
24704 | } |
||
24705 | } |
||
24706 | } |
||
24707 | |||
24708 | const char *PreserveMostAttr::getSpelling() const { |
||
24709 | switch (getAttributeSpellingListIndex()) { |
||
24710 | default: |
||
24711 | llvm_unreachable("Unknown attribute spelling!"); |
||
24712 | return "(No spelling)"; |
||
24713 | case 0: |
||
24714 | return "preserve_most"; |
||
24715 | case 1: |
||
24716 | return "preserve_most"; |
||
24717 | case 2: |
||
24718 | return "preserve_most"; |
||
24719 | } |
||
24720 | } |
||
24721 | |||
24722 | |||
24723 | // PtGuardedByAttr implementation |
||
24724 | |||
24725 | PtGuardedByAttr *PtGuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { |
||
24726 | auto *A = new (Ctx) PtGuardedByAttr(Ctx, CommonInfo, Arg); |
||
24727 | A->setImplicit(true); |
||
24728 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24729 | A->setAttributeSpellingListIndex(0); |
||
24730 | return A; |
||
24731 | } |
||
24732 | |||
24733 | PtGuardedByAttr *PtGuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { |
||
24734 | auto *A = new (Ctx) PtGuardedByAttr(Ctx, CommonInfo, Arg); |
||
24735 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24736 | A->setAttributeSpellingListIndex(0); |
||
24737 | return A; |
||
24738 | } |
||
24739 | |||
24740 | PtGuardedByAttr *PtGuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24741 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24742 | return CreateImplicit(Ctx, Arg, I); |
||
24743 | } |
||
24744 | |||
24745 | PtGuardedByAttr *PtGuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24746 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24747 | return Create(Ctx, Arg, I); |
||
24748 | } |
||
24749 | |||
24750 | PtGuardedByAttr::PtGuardedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24751 | , Expr * Arg |
||
24752 | ) |
||
24753 | : InheritableAttr(Ctx, CommonInfo, attr::PtGuardedBy, true, true) |
||
24754 | , arg(Arg) |
||
24755 | { |
||
24756 | } |
||
24757 | |||
24758 | |||
24759 | |||
24760 | PtGuardedByAttr *PtGuardedByAttr::clone(ASTContext &C) const { |
||
24761 | auto *A = new (C) PtGuardedByAttr(C, *this, arg); |
||
24762 | A->Inherited = Inherited; |
||
24763 | A->IsPackExpansion = IsPackExpansion; |
||
24764 | A->setImplicit(Implicit); |
||
24765 | return A; |
||
24766 | } |
||
24767 | |||
24768 | void PtGuardedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24769 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
24770 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
24771 | switch (getAttributeSpellingListIndex()) { |
||
24772 | default: |
||
24773 | llvm_unreachable("Unknown attribute spelling!"); |
||
24774 | break; |
||
24775 | case 0 : { |
||
24776 | OS << " __attribute__((pt_guarded_by"; |
||
24777 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
24778 | OS << ""; |
||
24779 | getArg()->printPretty(OS, nullptr, Policy); |
||
24780 | OS << ""; |
||
24781 | if (!IsFirstArgument) |
||
24782 | OS << ")"; |
||
24783 | OS << "))"; |
||
24784 | break; |
||
24785 | } |
||
24786 | } |
||
24787 | } |
||
24788 | |||
24789 | const char *PtGuardedByAttr::getSpelling() const { |
||
24790 | switch (getAttributeSpellingListIndex()) { |
||
24791 | default: |
||
24792 | llvm_unreachable("Unknown attribute spelling!"); |
||
24793 | return "(No spelling)"; |
||
24794 | case 0: |
||
24795 | return "pt_guarded_by"; |
||
24796 | } |
||
24797 | } |
||
24798 | |||
24799 | |||
24800 | // PtGuardedVarAttr implementation |
||
24801 | |||
24802 | PtGuardedVarAttr *PtGuardedVarAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24803 | auto *A = new (Ctx) PtGuardedVarAttr(Ctx, CommonInfo); |
||
24804 | A->setImplicit(true); |
||
24805 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24806 | A->setAttributeSpellingListIndex(0); |
||
24807 | return A; |
||
24808 | } |
||
24809 | |||
24810 | PtGuardedVarAttr *PtGuardedVarAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24811 | auto *A = new (Ctx) PtGuardedVarAttr(Ctx, CommonInfo); |
||
24812 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24813 | A->setAttributeSpellingListIndex(0); |
||
24814 | return A; |
||
24815 | } |
||
24816 | |||
24817 | PtGuardedVarAttr *PtGuardedVarAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24818 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24819 | return CreateImplicit(Ctx, I); |
||
24820 | } |
||
24821 | |||
24822 | PtGuardedVarAttr *PtGuardedVarAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24823 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24824 | return Create(Ctx, I); |
||
24825 | } |
||
24826 | |||
24827 | PtGuardedVarAttr::PtGuardedVarAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24828 | ) |
||
24829 | : InheritableAttr(Ctx, CommonInfo, attr::PtGuardedVar, false, false) |
||
24830 | { |
||
24831 | } |
||
24832 | |||
24833 | PtGuardedVarAttr *PtGuardedVarAttr::clone(ASTContext &C) const { |
||
24834 | auto *A = new (C) PtGuardedVarAttr(C, *this); |
||
24835 | A->Inherited = Inherited; |
||
24836 | A->IsPackExpansion = IsPackExpansion; |
||
24837 | A->setImplicit(Implicit); |
||
24838 | return A; |
||
24839 | } |
||
24840 | |||
24841 | void PtGuardedVarAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24842 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
24843 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
24844 | switch (getAttributeSpellingListIndex()) { |
||
24845 | default: |
||
24846 | llvm_unreachable("Unknown attribute spelling!"); |
||
24847 | break; |
||
24848 | case 0 : { |
||
24849 | OS << " __attribute__((pt_guarded_var"; |
||
24850 | OS << "))"; |
||
24851 | break; |
||
24852 | } |
||
24853 | case 1 : { |
||
24854 | OS << " [[clang::pt_guarded_var"; |
||
24855 | OS << "]]"; |
||
24856 | break; |
||
24857 | } |
||
24858 | } |
||
24859 | } |
||
24860 | |||
24861 | const char *PtGuardedVarAttr::getSpelling() const { |
||
24862 | switch (getAttributeSpellingListIndex()) { |
||
24863 | default: |
||
24864 | llvm_unreachable("Unknown attribute spelling!"); |
||
24865 | return "(No spelling)"; |
||
24866 | case 0: |
||
24867 | return "pt_guarded_var"; |
||
24868 | case 1: |
||
24869 | return "pt_guarded_var"; |
||
24870 | } |
||
24871 | } |
||
24872 | |||
24873 | |||
24874 | // Ptr32Attr implementation |
||
24875 | |||
24876 | Ptr32Attr *Ptr32Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24877 | auto *A = new (Ctx) Ptr32Attr(Ctx, CommonInfo); |
||
24878 | A->setImplicit(true); |
||
24879 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24880 | A->setAttributeSpellingListIndex(0); |
||
24881 | return A; |
||
24882 | } |
||
24883 | |||
24884 | Ptr32Attr *Ptr32Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24885 | auto *A = new (Ctx) Ptr32Attr(Ctx, CommonInfo); |
||
24886 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24887 | A->setAttributeSpellingListIndex(0); |
||
24888 | return A; |
||
24889 | } |
||
24890 | |||
24891 | Ptr32Attr *Ptr32Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24892 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24893 | return CreateImplicit(Ctx, I); |
||
24894 | } |
||
24895 | |||
24896 | Ptr32Attr *Ptr32Attr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24897 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24898 | return Create(Ctx, I); |
||
24899 | } |
||
24900 | |||
24901 | Ptr32Attr::Ptr32Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24902 | ) |
||
24903 | : TypeAttr(Ctx, CommonInfo, attr::Ptr32, false) |
||
24904 | { |
||
24905 | } |
||
24906 | |||
24907 | Ptr32Attr *Ptr32Attr::clone(ASTContext &C) const { |
||
24908 | auto *A = new (C) Ptr32Attr(C, *this); |
||
24909 | A->Inherited = Inherited; |
||
24910 | A->IsPackExpansion = IsPackExpansion; |
||
24911 | A->setImplicit(Implicit); |
||
24912 | return A; |
||
24913 | } |
||
24914 | |||
24915 | void Ptr32Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24916 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
24917 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
24918 | switch (getAttributeSpellingListIndex()) { |
||
24919 | default: |
||
24920 | llvm_unreachable("Unknown attribute spelling!"); |
||
24921 | break; |
||
24922 | case 0 : { |
||
24923 | OS << " __ptr32"; |
||
24924 | OS << ""; |
||
24925 | break; |
||
24926 | } |
||
24927 | } |
||
24928 | } |
||
24929 | |||
24930 | const char *Ptr32Attr::getSpelling() const { |
||
24931 | switch (getAttributeSpellingListIndex()) { |
||
24932 | default: |
||
24933 | llvm_unreachable("Unknown attribute spelling!"); |
||
24934 | return "(No spelling)"; |
||
24935 | case 0: |
||
24936 | return "__ptr32"; |
||
24937 | } |
||
24938 | } |
||
24939 | |||
24940 | |||
24941 | // Ptr64Attr implementation |
||
24942 | |||
24943 | Ptr64Attr *Ptr64Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24944 | auto *A = new (Ctx) Ptr64Attr(Ctx, CommonInfo); |
||
24945 | A->setImplicit(true); |
||
24946 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24947 | A->setAttributeSpellingListIndex(0); |
||
24948 | return A; |
||
24949 | } |
||
24950 | |||
24951 | Ptr64Attr *Ptr64Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
24952 | auto *A = new (Ctx) Ptr64Attr(Ctx, CommonInfo); |
||
24953 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
24954 | A->setAttributeSpellingListIndex(0); |
||
24955 | return A; |
||
24956 | } |
||
24957 | |||
24958 | Ptr64Attr *Ptr64Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24959 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24960 | return CreateImplicit(Ctx, I); |
||
24961 | } |
||
24962 | |||
24963 | Ptr64Attr *Ptr64Attr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
24964 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
24965 | return Create(Ctx, I); |
||
24966 | } |
||
24967 | |||
24968 | Ptr64Attr::Ptr64Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
24969 | ) |
||
24970 | : TypeAttr(Ctx, CommonInfo, attr::Ptr64, false) |
||
24971 | { |
||
24972 | } |
||
24973 | |||
24974 | Ptr64Attr *Ptr64Attr::clone(ASTContext &C) const { |
||
24975 | auto *A = new (C) Ptr64Attr(C, *this); |
||
24976 | A->Inherited = Inherited; |
||
24977 | A->IsPackExpansion = IsPackExpansion; |
||
24978 | A->setImplicit(Implicit); |
||
24979 | return A; |
||
24980 | } |
||
24981 | |||
24982 | void Ptr64Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
24983 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
24984 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
24985 | switch (getAttributeSpellingListIndex()) { |
||
24986 | default: |
||
24987 | llvm_unreachable("Unknown attribute spelling!"); |
||
24988 | break; |
||
24989 | case 0 : { |
||
24990 | OS << " __ptr64"; |
||
24991 | OS << ""; |
||
24992 | break; |
||
24993 | } |
||
24994 | } |
||
24995 | } |
||
24996 | |||
24997 | const char *Ptr64Attr::getSpelling() const { |
||
24998 | switch (getAttributeSpellingListIndex()) { |
||
24999 | default: |
||
25000 | llvm_unreachable("Unknown attribute spelling!"); |
||
25001 | return "(No spelling)"; |
||
25002 | case 0: |
||
25003 | return "__ptr64"; |
||
25004 | } |
||
25005 | } |
||
25006 | |||
25007 | |||
25008 | // PureAttr implementation |
||
25009 | |||
25010 | PureAttr *PureAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25011 | auto *A = new (Ctx) PureAttr(Ctx, CommonInfo); |
||
25012 | A->setImplicit(true); |
||
25013 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25014 | A->setAttributeSpellingListIndex(0); |
||
25015 | return A; |
||
25016 | } |
||
25017 | |||
25018 | PureAttr *PureAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25019 | auto *A = new (Ctx) PureAttr(Ctx, CommonInfo); |
||
25020 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25021 | A->setAttributeSpellingListIndex(0); |
||
25022 | return A; |
||
25023 | } |
||
25024 | |||
25025 | PureAttr *PureAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25026 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25027 | return CreateImplicit(Ctx, I); |
||
25028 | } |
||
25029 | |||
25030 | PureAttr *PureAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25031 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25032 | return Create(Ctx, I); |
||
25033 | } |
||
25034 | |||
25035 | PureAttr::PureAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25036 | ) |
||
25037 | : InheritableAttr(Ctx, CommonInfo, attr::Pure, false, false) |
||
25038 | { |
||
25039 | } |
||
25040 | |||
25041 | PureAttr *PureAttr::clone(ASTContext &C) const { |
||
25042 | auto *A = new (C) PureAttr(C, *this); |
||
25043 | A->Inherited = Inherited; |
||
25044 | A->IsPackExpansion = IsPackExpansion; |
||
25045 | A->setImplicit(Implicit); |
||
25046 | return A; |
||
25047 | } |
||
25048 | |||
25049 | void PureAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25050 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25051 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25052 | switch (getAttributeSpellingListIndex()) { |
||
25053 | default: |
||
25054 | llvm_unreachable("Unknown attribute spelling!"); |
||
25055 | break; |
||
25056 | case 0 : { |
||
25057 | OS << " __attribute__((pure"; |
||
25058 | OS << "))"; |
||
25059 | break; |
||
25060 | } |
||
25061 | case 1 : { |
||
25062 | OS << " [[gnu::pure"; |
||
25063 | OS << "]]"; |
||
25064 | break; |
||
25065 | } |
||
25066 | case 2 : { |
||
25067 | OS << " [[gnu::pure"; |
||
25068 | OS << "]]"; |
||
25069 | break; |
||
25070 | } |
||
25071 | } |
||
25072 | } |
||
25073 | |||
25074 | const char *PureAttr::getSpelling() const { |
||
25075 | switch (getAttributeSpellingListIndex()) { |
||
25076 | default: |
||
25077 | llvm_unreachable("Unknown attribute spelling!"); |
||
25078 | return "(No spelling)"; |
||
25079 | case 0: |
||
25080 | return "pure"; |
||
25081 | case 1: |
||
25082 | return "pure"; |
||
25083 | case 2: |
||
25084 | return "pure"; |
||
25085 | } |
||
25086 | } |
||
25087 | |||
25088 | |||
25089 | // RISCVInterruptAttr implementation |
||
25090 | |||
25091 | RISCVInterruptAttr *RISCVInterruptAttr::CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { |
||
25092 | auto *A = new (Ctx) RISCVInterruptAttr(Ctx, CommonInfo, Interrupt); |
||
25093 | A->setImplicit(true); |
||
25094 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25095 | A->setAttributeSpellingListIndex(0); |
||
25096 | return A; |
||
25097 | } |
||
25098 | |||
25099 | RISCVInterruptAttr *RISCVInterruptAttr::Create(ASTContext &Ctx, InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { |
||
25100 | auto *A = new (Ctx) RISCVInterruptAttr(Ctx, CommonInfo, Interrupt); |
||
25101 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25102 | A->setAttributeSpellingListIndex(0); |
||
25103 | return A; |
||
25104 | } |
||
25105 | |||
25106 | RISCVInterruptAttr *RISCVInterruptAttr::CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25107 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25108 | return CreateImplicit(Ctx, Interrupt, I); |
||
25109 | } |
||
25110 | |||
25111 | RISCVInterruptAttr *RISCVInterruptAttr::Create(ASTContext &Ctx, InterruptType Interrupt, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25112 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25113 | return Create(Ctx, Interrupt, I); |
||
25114 | } |
||
25115 | |||
25116 | RISCVInterruptAttr::RISCVInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25117 | , InterruptType Interrupt |
||
25118 | ) |
||
25119 | : InheritableAttr(Ctx, CommonInfo, attr::RISCVInterrupt, false, false) |
||
25120 | , interrupt(Interrupt) |
||
25121 | { |
||
25122 | } |
||
25123 | |||
25124 | RISCVInterruptAttr::RISCVInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25125 | ) |
||
25126 | : InheritableAttr(Ctx, CommonInfo, attr::RISCVInterrupt, false, false) |
||
25127 | , interrupt(InterruptType(0)) |
||
25128 | { |
||
25129 | } |
||
25130 | |||
25131 | |||
25132 | |||
25133 | bool RISCVInterruptAttr::ConvertStrToInterruptType(StringRef Val, InterruptType &Out) { |
||
25134 | std::optional<InterruptType> R = llvm::StringSwitch<std::optional<InterruptType>>(Val) |
||
25135 | .Case("user", RISCVInterruptAttr::user) |
||
25136 | .Case("supervisor", RISCVInterruptAttr::supervisor) |
||
25137 | .Case("machine", RISCVInterruptAttr::machine) |
||
25138 | .Default(std::optional<InterruptType>()); |
||
25139 | if (R) { |
||
25140 | Out = *R; |
||
25141 | return true; |
||
25142 | } |
||
25143 | return false; |
||
25144 | } |
||
25145 | |||
25146 | const char *RISCVInterruptAttr::ConvertInterruptTypeToStr(InterruptType Val) { |
||
25147 | switch(Val) { |
||
25148 | case RISCVInterruptAttr::user: return "user"; |
||
25149 | case RISCVInterruptAttr::supervisor: return "supervisor"; |
||
25150 | case RISCVInterruptAttr::machine: return "machine"; |
||
25151 | } |
||
25152 | llvm_unreachable("No enumerator with that value"); |
||
25153 | } |
||
25154 | RISCVInterruptAttr *RISCVInterruptAttr::clone(ASTContext &C) const { |
||
25155 | auto *A = new (C) RISCVInterruptAttr(C, *this, interrupt); |
||
25156 | A->Inherited = Inherited; |
||
25157 | A->IsPackExpansion = IsPackExpansion; |
||
25158 | A->setImplicit(Implicit); |
||
25159 | return A; |
||
25160 | } |
||
25161 | |||
25162 | void RISCVInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25163 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25164 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25165 | switch (getAttributeSpellingListIndex()) { |
||
25166 | default: |
||
25167 | llvm_unreachable("Unknown attribute spelling!"); |
||
25168 | break; |
||
25169 | case 0 : { |
||
25170 | OS << " __attribute__((interrupt"; |
||
25171 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25172 | OS << "\"" << RISCVInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; |
||
25173 | if (!IsFirstArgument) |
||
25174 | OS << ")"; |
||
25175 | OS << "))"; |
||
25176 | break; |
||
25177 | } |
||
25178 | case 1 : { |
||
25179 | OS << " [[gnu::interrupt"; |
||
25180 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25181 | OS << "\"" << RISCVInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; |
||
25182 | if (!IsFirstArgument) |
||
25183 | OS << ")"; |
||
25184 | OS << "]]"; |
||
25185 | break; |
||
25186 | } |
||
25187 | case 2 : { |
||
25188 | OS << " [[gnu::interrupt"; |
||
25189 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25190 | OS << "\"" << RISCVInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; |
||
25191 | if (!IsFirstArgument) |
||
25192 | OS << ")"; |
||
25193 | OS << "]]"; |
||
25194 | break; |
||
25195 | } |
||
25196 | } |
||
25197 | } |
||
25198 | |||
25199 | const char *RISCVInterruptAttr::getSpelling() const { |
||
25200 | switch (getAttributeSpellingListIndex()) { |
||
25201 | default: |
||
25202 | llvm_unreachable("Unknown attribute spelling!"); |
||
25203 | return "(No spelling)"; |
||
25204 | case 0: |
||
25205 | return "interrupt"; |
||
25206 | case 1: |
||
25207 | return "interrupt"; |
||
25208 | case 2: |
||
25209 | return "interrupt"; |
||
25210 | } |
||
25211 | } |
||
25212 | |||
25213 | |||
25214 | // RandomizeLayoutAttr implementation |
||
25215 | |||
25216 | RandomizeLayoutAttr *RandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25217 | auto *A = new (Ctx) RandomizeLayoutAttr(Ctx, CommonInfo); |
||
25218 | A->setImplicit(true); |
||
25219 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25220 | A->setAttributeSpellingListIndex(0); |
||
25221 | return A; |
||
25222 | } |
||
25223 | |||
25224 | RandomizeLayoutAttr *RandomizeLayoutAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25225 | auto *A = new (Ctx) RandomizeLayoutAttr(Ctx, CommonInfo); |
||
25226 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25227 | A->setAttributeSpellingListIndex(0); |
||
25228 | return A; |
||
25229 | } |
||
25230 | |||
25231 | RandomizeLayoutAttr *RandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25232 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25233 | return CreateImplicit(Ctx, I); |
||
25234 | } |
||
25235 | |||
25236 | RandomizeLayoutAttr *RandomizeLayoutAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25237 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25238 | return Create(Ctx, I); |
||
25239 | } |
||
25240 | |||
25241 | RandomizeLayoutAttr::RandomizeLayoutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25242 | ) |
||
25243 | : InheritableAttr(Ctx, CommonInfo, attr::RandomizeLayout, false, false) |
||
25244 | { |
||
25245 | } |
||
25246 | |||
25247 | RandomizeLayoutAttr *RandomizeLayoutAttr::clone(ASTContext &C) const { |
||
25248 | auto *A = new (C) RandomizeLayoutAttr(C, *this); |
||
25249 | A->Inherited = Inherited; |
||
25250 | A->IsPackExpansion = IsPackExpansion; |
||
25251 | A->setImplicit(Implicit); |
||
25252 | return A; |
||
25253 | } |
||
25254 | |||
25255 | void RandomizeLayoutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25256 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25257 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25258 | switch (getAttributeSpellingListIndex()) { |
||
25259 | default: |
||
25260 | llvm_unreachable("Unknown attribute spelling!"); |
||
25261 | break; |
||
25262 | case 0 : { |
||
25263 | OS << " __attribute__((randomize_layout"; |
||
25264 | OS << "))"; |
||
25265 | break; |
||
25266 | } |
||
25267 | case 1 : { |
||
25268 | OS << " [[gnu::randomize_layout"; |
||
25269 | OS << "]]"; |
||
25270 | break; |
||
25271 | } |
||
25272 | case 2 : { |
||
25273 | OS << " [[gnu::randomize_layout"; |
||
25274 | OS << "]]"; |
||
25275 | break; |
||
25276 | } |
||
25277 | } |
||
25278 | } |
||
25279 | |||
25280 | const char *RandomizeLayoutAttr::getSpelling() const { |
||
25281 | switch (getAttributeSpellingListIndex()) { |
||
25282 | default: |
||
25283 | llvm_unreachable("Unknown attribute spelling!"); |
||
25284 | return "(No spelling)"; |
||
25285 | case 0: |
||
25286 | return "randomize_layout"; |
||
25287 | case 1: |
||
25288 | return "randomize_layout"; |
||
25289 | case 2: |
||
25290 | return "randomize_layout"; |
||
25291 | } |
||
25292 | } |
||
25293 | |||
25294 | |||
25295 | // ReadOnlyPlacementAttr implementation |
||
25296 | |||
25297 | ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25298 | auto *A = new (Ctx) ReadOnlyPlacementAttr(Ctx, CommonInfo); |
||
25299 | A->setImplicit(true); |
||
25300 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25301 | A->setAttributeSpellingListIndex(0); |
||
25302 | return A; |
||
25303 | } |
||
25304 | |||
25305 | ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25306 | auto *A = new (Ctx) ReadOnlyPlacementAttr(Ctx, CommonInfo); |
||
25307 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25308 | A->setAttributeSpellingListIndex(0); |
||
25309 | return A; |
||
25310 | } |
||
25311 | |||
25312 | ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25313 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25314 | return CreateImplicit(Ctx, I); |
||
25315 | } |
||
25316 | |||
25317 | ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25318 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25319 | return Create(Ctx, I); |
||
25320 | } |
||
25321 | |||
25322 | ReadOnlyPlacementAttr::ReadOnlyPlacementAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25323 | ) |
||
25324 | : InheritableAttr(Ctx, CommonInfo, attr::ReadOnlyPlacement, false, false) |
||
25325 | { |
||
25326 | } |
||
25327 | |||
25328 | ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::clone(ASTContext &C) const { |
||
25329 | auto *A = new (C) ReadOnlyPlacementAttr(C, *this); |
||
25330 | A->Inherited = Inherited; |
||
25331 | A->IsPackExpansion = IsPackExpansion; |
||
25332 | A->setImplicit(Implicit); |
||
25333 | return A; |
||
25334 | } |
||
25335 | |||
25336 | void ReadOnlyPlacementAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25337 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25338 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25339 | switch (getAttributeSpellingListIndex()) { |
||
25340 | default: |
||
25341 | llvm_unreachable("Unknown attribute spelling!"); |
||
25342 | break; |
||
25343 | case 0 : { |
||
25344 | OS << " __attribute__((enforce_read_only_placement"; |
||
25345 | OS << "))"; |
||
25346 | break; |
||
25347 | } |
||
25348 | case 1 : { |
||
25349 | OS << " [[clang::enforce_read_only_placement"; |
||
25350 | OS << "]]"; |
||
25351 | break; |
||
25352 | } |
||
25353 | case 2 : { |
||
25354 | OS << " [[clang::enforce_read_only_placement"; |
||
25355 | OS << "]]"; |
||
25356 | break; |
||
25357 | } |
||
25358 | } |
||
25359 | } |
||
25360 | |||
25361 | const char *ReadOnlyPlacementAttr::getSpelling() const { |
||
25362 | switch (getAttributeSpellingListIndex()) { |
||
25363 | default: |
||
25364 | llvm_unreachable("Unknown attribute spelling!"); |
||
25365 | return "(No spelling)"; |
||
25366 | case 0: |
||
25367 | return "enforce_read_only_placement"; |
||
25368 | case 1: |
||
25369 | return "enforce_read_only_placement"; |
||
25370 | case 2: |
||
25371 | return "enforce_read_only_placement"; |
||
25372 | } |
||
25373 | } |
||
25374 | |||
25375 | |||
25376 | // RegCallAttr implementation |
||
25377 | |||
25378 | RegCallAttr *RegCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25379 | auto *A = new (Ctx) RegCallAttr(Ctx, CommonInfo); |
||
25380 | A->setImplicit(true); |
||
25381 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25382 | A->setAttributeSpellingListIndex(0); |
||
25383 | return A; |
||
25384 | } |
||
25385 | |||
25386 | RegCallAttr *RegCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25387 | auto *A = new (Ctx) RegCallAttr(Ctx, CommonInfo); |
||
25388 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25389 | A->setAttributeSpellingListIndex(0); |
||
25390 | return A; |
||
25391 | } |
||
25392 | |||
25393 | RegCallAttr *RegCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25394 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25395 | return CreateImplicit(Ctx, I); |
||
25396 | } |
||
25397 | |||
25398 | RegCallAttr *RegCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25399 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25400 | return Create(Ctx, I); |
||
25401 | } |
||
25402 | |||
25403 | RegCallAttr::RegCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25404 | ) |
||
25405 | : InheritableAttr(Ctx, CommonInfo, attr::RegCall, false, false) |
||
25406 | { |
||
25407 | } |
||
25408 | |||
25409 | RegCallAttr *RegCallAttr::clone(ASTContext &C) const { |
||
25410 | auto *A = new (C) RegCallAttr(C, *this); |
||
25411 | A->Inherited = Inherited; |
||
25412 | A->IsPackExpansion = IsPackExpansion; |
||
25413 | A->setImplicit(Implicit); |
||
25414 | return A; |
||
25415 | } |
||
25416 | |||
25417 | void RegCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25418 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25419 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25420 | switch (getAttributeSpellingListIndex()) { |
||
25421 | default: |
||
25422 | llvm_unreachable("Unknown attribute spelling!"); |
||
25423 | break; |
||
25424 | case 0 : { |
||
25425 | OS << " __attribute__((regcall"; |
||
25426 | OS << "))"; |
||
25427 | break; |
||
25428 | } |
||
25429 | case 1 : { |
||
25430 | OS << " [[gnu::regcall"; |
||
25431 | OS << "]]"; |
||
25432 | break; |
||
25433 | } |
||
25434 | case 2 : { |
||
25435 | OS << " [[gnu::regcall"; |
||
25436 | OS << "]]"; |
||
25437 | break; |
||
25438 | } |
||
25439 | case 3 : { |
||
25440 | OS << " __regcall"; |
||
25441 | OS << ""; |
||
25442 | break; |
||
25443 | } |
||
25444 | } |
||
25445 | } |
||
25446 | |||
25447 | const char *RegCallAttr::getSpelling() const { |
||
25448 | switch (getAttributeSpellingListIndex()) { |
||
25449 | default: |
||
25450 | llvm_unreachable("Unknown attribute spelling!"); |
||
25451 | return "(No spelling)"; |
||
25452 | case 0: |
||
25453 | return "regcall"; |
||
25454 | case 1: |
||
25455 | return "regcall"; |
||
25456 | case 2: |
||
25457 | return "regcall"; |
||
25458 | case 3: |
||
25459 | return "__regcall"; |
||
25460 | } |
||
25461 | } |
||
25462 | |||
25463 | |||
25464 | // ReinitializesAttr implementation |
||
25465 | |||
25466 | ReinitializesAttr *ReinitializesAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25467 | auto *A = new (Ctx) ReinitializesAttr(Ctx, CommonInfo); |
||
25468 | A->setImplicit(true); |
||
25469 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25470 | A->setAttributeSpellingListIndex(0); |
||
25471 | return A; |
||
25472 | } |
||
25473 | |||
25474 | ReinitializesAttr *ReinitializesAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25475 | auto *A = new (Ctx) ReinitializesAttr(Ctx, CommonInfo); |
||
25476 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25477 | A->setAttributeSpellingListIndex(0); |
||
25478 | return A; |
||
25479 | } |
||
25480 | |||
25481 | ReinitializesAttr *ReinitializesAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25482 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25483 | return CreateImplicit(Ctx, I); |
||
25484 | } |
||
25485 | |||
25486 | ReinitializesAttr *ReinitializesAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25487 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25488 | return Create(Ctx, I); |
||
25489 | } |
||
25490 | |||
25491 | ReinitializesAttr::ReinitializesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25492 | ) |
||
25493 | : InheritableAttr(Ctx, CommonInfo, attr::Reinitializes, false, false) |
||
25494 | { |
||
25495 | } |
||
25496 | |||
25497 | ReinitializesAttr *ReinitializesAttr::clone(ASTContext &C) const { |
||
25498 | auto *A = new (C) ReinitializesAttr(C, *this); |
||
25499 | A->Inherited = Inherited; |
||
25500 | A->IsPackExpansion = IsPackExpansion; |
||
25501 | A->setImplicit(Implicit); |
||
25502 | return A; |
||
25503 | } |
||
25504 | |||
25505 | void ReinitializesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25506 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25507 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25508 | switch (getAttributeSpellingListIndex()) { |
||
25509 | default: |
||
25510 | llvm_unreachable("Unknown attribute spelling!"); |
||
25511 | break; |
||
25512 | case 0 : { |
||
25513 | OS << " __attribute__((reinitializes"; |
||
25514 | OS << "))"; |
||
25515 | break; |
||
25516 | } |
||
25517 | case 1 : { |
||
25518 | OS << " [[clang::reinitializes"; |
||
25519 | OS << "]]"; |
||
25520 | break; |
||
25521 | } |
||
25522 | } |
||
25523 | } |
||
25524 | |||
25525 | const char *ReinitializesAttr::getSpelling() const { |
||
25526 | switch (getAttributeSpellingListIndex()) { |
||
25527 | default: |
||
25528 | llvm_unreachable("Unknown attribute spelling!"); |
||
25529 | return "(No spelling)"; |
||
25530 | case 0: |
||
25531 | return "reinitializes"; |
||
25532 | case 1: |
||
25533 | return "reinitializes"; |
||
25534 | } |
||
25535 | } |
||
25536 | |||
25537 | |||
25538 | // ReleaseCapabilityAttr implementation |
||
25539 | |||
25540 | ReleaseCapabilityAttr *ReleaseCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
25541 | auto *A = new (Ctx) ReleaseCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
25542 | A->setImplicit(true); |
||
25543 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25544 | A->setAttributeSpellingListIndex(0); |
||
25545 | return A; |
||
25546 | } |
||
25547 | |||
25548 | ReleaseCapabilityAttr *ReleaseCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
25549 | auto *A = new (Ctx) ReleaseCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
25550 | return A; |
||
25551 | } |
||
25552 | |||
25553 | ReleaseCapabilityAttr *ReleaseCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ReleaseCapabilityAttr::Spelling S) { |
||
25554 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
25555 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
25556 | } |
||
25557 | |||
25558 | ReleaseCapabilityAttr *ReleaseCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, ReleaseCapabilityAttr::Spelling S) { |
||
25559 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
25560 | return Create(Ctx, Args, ArgsSize, I); |
||
25561 | } |
||
25562 | |||
25563 | ReleaseCapabilityAttr::ReleaseCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25564 | , Expr * *Args, unsigned ArgsSize |
||
25565 | ) |
||
25566 | : InheritableAttr(Ctx, CommonInfo, attr::ReleaseCapability, true, true) |
||
25567 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
25568 | { |
||
25569 | std::copy(Args, Args + args_Size, args_); |
||
25570 | } |
||
25571 | |||
25572 | ReleaseCapabilityAttr::ReleaseCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25573 | ) |
||
25574 | : InheritableAttr(Ctx, CommonInfo, attr::ReleaseCapability, true, true) |
||
25575 | , args_Size(0), args_(nullptr) |
||
25576 | { |
||
25577 | } |
||
25578 | |||
25579 | ReleaseCapabilityAttr::Spelling ReleaseCapabilityAttr::getSemanticSpelling() const { |
||
25580 | switch (getAttributeSpellingListIndex()) { |
||
25581 | default: llvm_unreachable("Unknown spelling list index"); |
||
25582 | case 0: return GNU_release_capability; |
||
25583 | case 1: return CXX11_clang_release_capability; |
||
25584 | case 2: return GNU_release_shared_capability; |
||
25585 | case 3: return CXX11_clang_release_shared_capability; |
||
25586 | case 4: return GNU_release_generic_capability; |
||
25587 | case 5: return CXX11_clang_release_generic_capability; |
||
25588 | case 6: return GNU_unlock_function; |
||
25589 | case 7: return CXX11_clang_unlock_function; |
||
25590 | } |
||
25591 | } |
||
25592 | |||
25593 | |||
25594 | ReleaseCapabilityAttr *ReleaseCapabilityAttr::clone(ASTContext &C) const { |
||
25595 | auto *A = new (C) ReleaseCapabilityAttr(C, *this, args_, args_Size); |
||
25596 | A->Inherited = Inherited; |
||
25597 | A->IsPackExpansion = IsPackExpansion; |
||
25598 | A->setImplicit(Implicit); |
||
25599 | return A; |
||
25600 | } |
||
25601 | |||
25602 | void ReleaseCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25603 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25604 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25605 | switch (getAttributeSpellingListIndex()) { |
||
25606 | default: |
||
25607 | llvm_unreachable("Unknown attribute spelling!"); |
||
25608 | break; |
||
25609 | case 0 : { |
||
25610 | OS << " __attribute__((release_capability"; |
||
25611 | OS << ""; |
||
25612 | for (const auto &Val : args()) { |
||
25613 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25614 | OS << Val; |
||
25615 | } |
||
25616 | OS << ""; |
||
25617 | if (!IsFirstArgument) |
||
25618 | OS << ")"; |
||
25619 | OS << "))"; |
||
25620 | break; |
||
25621 | } |
||
25622 | case 1 : { |
||
25623 | OS << " [[clang::release_capability"; |
||
25624 | OS << ""; |
||
25625 | for (const auto &Val : args()) { |
||
25626 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25627 | OS << Val; |
||
25628 | } |
||
25629 | OS << ""; |
||
25630 | if (!IsFirstArgument) |
||
25631 | OS << ")"; |
||
25632 | OS << "]]"; |
||
25633 | break; |
||
25634 | } |
||
25635 | case 2 : { |
||
25636 | OS << " __attribute__((release_shared_capability"; |
||
25637 | OS << ""; |
||
25638 | for (const auto &Val : args()) { |
||
25639 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25640 | OS << Val; |
||
25641 | } |
||
25642 | OS << ""; |
||
25643 | if (!IsFirstArgument) |
||
25644 | OS << ")"; |
||
25645 | OS << "))"; |
||
25646 | break; |
||
25647 | } |
||
25648 | case 3 : { |
||
25649 | OS << " [[clang::release_shared_capability"; |
||
25650 | OS << ""; |
||
25651 | for (const auto &Val : args()) { |
||
25652 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25653 | OS << Val; |
||
25654 | } |
||
25655 | OS << ""; |
||
25656 | if (!IsFirstArgument) |
||
25657 | OS << ")"; |
||
25658 | OS << "]]"; |
||
25659 | break; |
||
25660 | } |
||
25661 | case 4 : { |
||
25662 | OS << " __attribute__((release_generic_capability"; |
||
25663 | OS << ""; |
||
25664 | for (const auto &Val : args()) { |
||
25665 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25666 | OS << Val; |
||
25667 | } |
||
25668 | OS << ""; |
||
25669 | if (!IsFirstArgument) |
||
25670 | OS << ")"; |
||
25671 | OS << "))"; |
||
25672 | break; |
||
25673 | } |
||
25674 | case 5 : { |
||
25675 | OS << " [[clang::release_generic_capability"; |
||
25676 | OS << ""; |
||
25677 | for (const auto &Val : args()) { |
||
25678 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25679 | OS << Val; |
||
25680 | } |
||
25681 | OS << ""; |
||
25682 | if (!IsFirstArgument) |
||
25683 | OS << ")"; |
||
25684 | OS << "]]"; |
||
25685 | break; |
||
25686 | } |
||
25687 | case 6 : { |
||
25688 | OS << " __attribute__((unlock_function"; |
||
25689 | OS << ""; |
||
25690 | for (const auto &Val : args()) { |
||
25691 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25692 | OS << Val; |
||
25693 | } |
||
25694 | OS << ""; |
||
25695 | if (!IsFirstArgument) |
||
25696 | OS << ")"; |
||
25697 | OS << "))"; |
||
25698 | break; |
||
25699 | } |
||
25700 | case 7 : { |
||
25701 | OS << " [[clang::unlock_function"; |
||
25702 | OS << ""; |
||
25703 | for (const auto &Val : args()) { |
||
25704 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25705 | OS << Val; |
||
25706 | } |
||
25707 | OS << ""; |
||
25708 | if (!IsFirstArgument) |
||
25709 | OS << ")"; |
||
25710 | OS << "]]"; |
||
25711 | break; |
||
25712 | } |
||
25713 | } |
||
25714 | } |
||
25715 | |||
25716 | const char *ReleaseCapabilityAttr::getSpelling() const { |
||
25717 | switch (getAttributeSpellingListIndex()) { |
||
25718 | default: |
||
25719 | llvm_unreachable("Unknown attribute spelling!"); |
||
25720 | return "(No spelling)"; |
||
25721 | case 0: |
||
25722 | return "release_capability"; |
||
25723 | case 1: |
||
25724 | return "release_capability"; |
||
25725 | case 2: |
||
25726 | return "release_shared_capability"; |
||
25727 | case 3: |
||
25728 | return "release_shared_capability"; |
||
25729 | case 4: |
||
25730 | return "release_generic_capability"; |
||
25731 | case 5: |
||
25732 | return "release_generic_capability"; |
||
25733 | case 6: |
||
25734 | return "unlock_function"; |
||
25735 | case 7: |
||
25736 | return "unlock_function"; |
||
25737 | } |
||
25738 | } |
||
25739 | |||
25740 | |||
25741 | // ReleaseHandleAttr implementation |
||
25742 | |||
25743 | ReleaseHandleAttr *ReleaseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { |
||
25744 | auto *A = new (Ctx) ReleaseHandleAttr(Ctx, CommonInfo, HandleType); |
||
25745 | A->setImplicit(true); |
||
25746 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25747 | A->setAttributeSpellingListIndex(0); |
||
25748 | return A; |
||
25749 | } |
||
25750 | |||
25751 | ReleaseHandleAttr *ReleaseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { |
||
25752 | auto *A = new (Ctx) ReleaseHandleAttr(Ctx, CommonInfo, HandleType); |
||
25753 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25754 | A->setAttributeSpellingListIndex(0); |
||
25755 | return A; |
||
25756 | } |
||
25757 | |||
25758 | ReleaseHandleAttr *ReleaseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25759 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25760 | return CreateImplicit(Ctx, HandleType, I); |
||
25761 | } |
||
25762 | |||
25763 | ReleaseHandleAttr *ReleaseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25764 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25765 | return Create(Ctx, HandleType, I); |
||
25766 | } |
||
25767 | |||
25768 | ReleaseHandleAttr::ReleaseHandleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25769 | , llvm::StringRef HandleType |
||
25770 | ) |
||
25771 | : InheritableParamAttr(Ctx, CommonInfo, attr::ReleaseHandle, false, false) |
||
25772 | , handleTypeLength(HandleType.size()),handleType(new (Ctx, 1) char[handleTypeLength]) |
||
25773 | { |
||
25774 | if (!HandleType.empty()) |
||
25775 | std::memcpy(handleType, HandleType.data(), handleTypeLength); |
||
25776 | } |
||
25777 | |||
25778 | |||
25779 | |||
25780 | ReleaseHandleAttr *ReleaseHandleAttr::clone(ASTContext &C) const { |
||
25781 | auto *A = new (C) ReleaseHandleAttr(C, *this, getHandleType()); |
||
25782 | A->Inherited = Inherited; |
||
25783 | A->IsPackExpansion = IsPackExpansion; |
||
25784 | A->setImplicit(Implicit); |
||
25785 | return A; |
||
25786 | } |
||
25787 | |||
25788 | void ReleaseHandleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25789 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25790 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25791 | switch (getAttributeSpellingListIndex()) { |
||
25792 | default: |
||
25793 | llvm_unreachable("Unknown attribute spelling!"); |
||
25794 | break; |
||
25795 | case 0 : { |
||
25796 | OS << " __attribute__((release_handle"; |
||
25797 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25798 | OS << "\"" << getHandleType() << "\""; |
||
25799 | if (!IsFirstArgument) |
||
25800 | OS << ")"; |
||
25801 | OS << "))"; |
||
25802 | break; |
||
25803 | } |
||
25804 | case 1 : { |
||
25805 | OS << " [[clang::release_handle"; |
||
25806 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25807 | OS << "\"" << getHandleType() << "\""; |
||
25808 | if (!IsFirstArgument) |
||
25809 | OS << ")"; |
||
25810 | OS << "]]"; |
||
25811 | break; |
||
25812 | } |
||
25813 | case 2 : { |
||
25814 | OS << " [[clang::release_handle"; |
||
25815 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25816 | OS << "\"" << getHandleType() << "\""; |
||
25817 | if (!IsFirstArgument) |
||
25818 | OS << ")"; |
||
25819 | OS << "]]"; |
||
25820 | break; |
||
25821 | } |
||
25822 | } |
||
25823 | } |
||
25824 | |||
25825 | const char *ReleaseHandleAttr::getSpelling() const { |
||
25826 | switch (getAttributeSpellingListIndex()) { |
||
25827 | default: |
||
25828 | llvm_unreachable("Unknown attribute spelling!"); |
||
25829 | return "(No spelling)"; |
||
25830 | case 0: |
||
25831 | return "release_handle"; |
||
25832 | case 1: |
||
25833 | return "release_handle"; |
||
25834 | case 2: |
||
25835 | return "release_handle"; |
||
25836 | } |
||
25837 | } |
||
25838 | |||
25839 | |||
25840 | // RenderScriptKernelAttr implementation |
||
25841 | |||
25842 | RenderScriptKernelAttr *RenderScriptKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25843 | auto *A = new (Ctx) RenderScriptKernelAttr(Ctx, CommonInfo); |
||
25844 | A->setImplicit(true); |
||
25845 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25846 | A->setAttributeSpellingListIndex(0); |
||
25847 | return A; |
||
25848 | } |
||
25849 | |||
25850 | RenderScriptKernelAttr *RenderScriptKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
25851 | auto *A = new (Ctx) RenderScriptKernelAttr(Ctx, CommonInfo); |
||
25852 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25853 | A->setAttributeSpellingListIndex(0); |
||
25854 | return A; |
||
25855 | } |
||
25856 | |||
25857 | RenderScriptKernelAttr *RenderScriptKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25858 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25859 | return CreateImplicit(Ctx, I); |
||
25860 | } |
||
25861 | |||
25862 | RenderScriptKernelAttr *RenderScriptKernelAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25863 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25864 | return Create(Ctx, I); |
||
25865 | } |
||
25866 | |||
25867 | RenderScriptKernelAttr::RenderScriptKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25868 | ) |
||
25869 | : Attr(Ctx, CommonInfo, attr::RenderScriptKernel, false) |
||
25870 | { |
||
25871 | } |
||
25872 | |||
25873 | RenderScriptKernelAttr *RenderScriptKernelAttr::clone(ASTContext &C) const { |
||
25874 | auto *A = new (C) RenderScriptKernelAttr(C, *this); |
||
25875 | A->Inherited = Inherited; |
||
25876 | A->IsPackExpansion = IsPackExpansion; |
||
25877 | A->setImplicit(Implicit); |
||
25878 | return A; |
||
25879 | } |
||
25880 | |||
25881 | void RenderScriptKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25882 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25883 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25884 | switch (getAttributeSpellingListIndex()) { |
||
25885 | default: |
||
25886 | llvm_unreachable("Unknown attribute spelling!"); |
||
25887 | break; |
||
25888 | case 0 : { |
||
25889 | OS << " __attribute__((kernel"; |
||
25890 | OS << "))"; |
||
25891 | break; |
||
25892 | } |
||
25893 | } |
||
25894 | } |
||
25895 | |||
25896 | const char *RenderScriptKernelAttr::getSpelling() const { |
||
25897 | switch (getAttributeSpellingListIndex()) { |
||
25898 | default: |
||
25899 | llvm_unreachable("Unknown attribute spelling!"); |
||
25900 | return "(No spelling)"; |
||
25901 | case 0: |
||
25902 | return "kernel"; |
||
25903 | } |
||
25904 | } |
||
25905 | |||
25906 | |||
25907 | // ReqdWorkGroupSizeAttr implementation |
||
25908 | |||
25909 | ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) { |
||
25910 | auto *A = new (Ctx) ReqdWorkGroupSizeAttr(Ctx, CommonInfo, XDim, YDim, ZDim); |
||
25911 | A->setImplicit(true); |
||
25912 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25913 | A->setAttributeSpellingListIndex(0); |
||
25914 | return A; |
||
25915 | } |
||
25916 | |||
25917 | ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) { |
||
25918 | auto *A = new (Ctx) ReqdWorkGroupSizeAttr(Ctx, CommonInfo, XDim, YDim, ZDim); |
||
25919 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
25920 | A->setAttributeSpellingListIndex(0); |
||
25921 | return A; |
||
25922 | } |
||
25923 | |||
25924 | ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25925 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25926 | return CreateImplicit(Ctx, XDim, YDim, ZDim, I); |
||
25927 | } |
||
25928 | |||
25929 | ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
25930 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
25931 | return Create(Ctx, XDim, YDim, ZDim, I); |
||
25932 | } |
||
25933 | |||
25934 | ReqdWorkGroupSizeAttr::ReqdWorkGroupSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
25935 | , unsigned XDim |
||
25936 | , unsigned YDim |
||
25937 | , unsigned ZDim |
||
25938 | ) |
||
25939 | : InheritableAttr(Ctx, CommonInfo, attr::ReqdWorkGroupSize, false, false) |
||
25940 | , xDim(XDim) |
||
25941 | , yDim(YDim) |
||
25942 | , zDim(ZDim) |
||
25943 | { |
||
25944 | } |
||
25945 | |||
25946 | |||
25947 | |||
25948 | |||
25949 | |||
25950 | |||
25951 | |||
25952 | ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::clone(ASTContext &C) const { |
||
25953 | auto *A = new (C) ReqdWorkGroupSizeAttr(C, *this, xDim, yDim, zDim); |
||
25954 | A->Inherited = Inherited; |
||
25955 | A->IsPackExpansion = IsPackExpansion; |
||
25956 | A->setImplicit(Implicit); |
||
25957 | return A; |
||
25958 | } |
||
25959 | |||
25960 | void ReqdWorkGroupSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
25961 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
25962 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
25963 | switch (getAttributeSpellingListIndex()) { |
||
25964 | default: |
||
25965 | llvm_unreachable("Unknown attribute spelling!"); |
||
25966 | break; |
||
25967 | case 0 : { |
||
25968 | OS << " __attribute__((reqd_work_group_size"; |
||
25969 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25970 | OS << "" << getXDim() << ""; |
||
25971 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25972 | OS << "" << getYDim() << ""; |
||
25973 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
25974 | OS << "" << getZDim() << ""; |
||
25975 | if (!IsFirstArgument) |
||
25976 | OS << ")"; |
||
25977 | OS << "))"; |
||
25978 | break; |
||
25979 | } |
||
25980 | } |
||
25981 | } |
||
25982 | |||
25983 | const char *ReqdWorkGroupSizeAttr::getSpelling() const { |
||
25984 | switch (getAttributeSpellingListIndex()) { |
||
25985 | default: |
||
25986 | llvm_unreachable("Unknown attribute spelling!"); |
||
25987 | return "(No spelling)"; |
||
25988 | case 0: |
||
25989 | return "reqd_work_group_size"; |
||
25990 | } |
||
25991 | } |
||
25992 | |||
25993 | |||
25994 | // RequiresCapabilityAttr implementation |
||
25995 | |||
25996 | RequiresCapabilityAttr *RequiresCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
25997 | auto *A = new (Ctx) RequiresCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
25998 | A->setImplicit(true); |
||
25999 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26000 | A->setAttributeSpellingListIndex(0); |
||
26001 | return A; |
||
26002 | } |
||
26003 | |||
26004 | RequiresCapabilityAttr *RequiresCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
26005 | auto *A = new (Ctx) RequiresCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); |
||
26006 | return A; |
||
26007 | } |
||
26008 | |||
26009 | RequiresCapabilityAttr *RequiresCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, RequiresCapabilityAttr::Spelling S) { |
||
26010 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
26011 | return CreateImplicit(Ctx, Args, ArgsSize, I); |
||
26012 | } |
||
26013 | |||
26014 | RequiresCapabilityAttr *RequiresCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, RequiresCapabilityAttr::Spelling S) { |
||
26015 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
26016 | return Create(Ctx, Args, ArgsSize, I); |
||
26017 | } |
||
26018 | |||
26019 | RequiresCapabilityAttr::RequiresCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26020 | , Expr * *Args, unsigned ArgsSize |
||
26021 | ) |
||
26022 | : InheritableAttr(Ctx, CommonInfo, attr::RequiresCapability, true, true) |
||
26023 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
26024 | { |
||
26025 | std::copy(Args, Args + args_Size, args_); |
||
26026 | } |
||
26027 | |||
26028 | RequiresCapabilityAttr::RequiresCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26029 | ) |
||
26030 | : InheritableAttr(Ctx, CommonInfo, attr::RequiresCapability, true, true) |
||
26031 | , args_Size(0), args_(nullptr) |
||
26032 | { |
||
26033 | } |
||
26034 | |||
26035 | RequiresCapabilityAttr::Spelling RequiresCapabilityAttr::getSemanticSpelling() const { |
||
26036 | switch (getAttributeSpellingListIndex()) { |
||
26037 | default: llvm_unreachable("Unknown spelling list index"); |
||
26038 | case 0: return GNU_requires_capability; |
||
26039 | case 1: return CXX11_clang_requires_capability; |
||
26040 | case 2: return GNU_exclusive_locks_required; |
||
26041 | case 3: return CXX11_clang_exclusive_locks_required; |
||
26042 | case 4: return GNU_requires_shared_capability; |
||
26043 | case 5: return CXX11_clang_requires_shared_capability; |
||
26044 | case 6: return GNU_shared_locks_required; |
||
26045 | case 7: return CXX11_clang_shared_locks_required; |
||
26046 | } |
||
26047 | } |
||
26048 | |||
26049 | |||
26050 | RequiresCapabilityAttr *RequiresCapabilityAttr::clone(ASTContext &C) const { |
||
26051 | auto *A = new (C) RequiresCapabilityAttr(C, *this, args_, args_Size); |
||
26052 | A->Inherited = Inherited; |
||
26053 | A->IsPackExpansion = IsPackExpansion; |
||
26054 | A->setImplicit(Implicit); |
||
26055 | return A; |
||
26056 | } |
||
26057 | |||
26058 | void RequiresCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26059 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26060 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26061 | switch (getAttributeSpellingListIndex()) { |
||
26062 | default: |
||
26063 | llvm_unreachable("Unknown attribute spelling!"); |
||
26064 | break; |
||
26065 | case 0 : { |
||
26066 | OS << " __attribute__((requires_capability"; |
||
26067 | OS << ""; |
||
26068 | for (const auto &Val : args()) { |
||
26069 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26070 | OS << Val; |
||
26071 | } |
||
26072 | OS << ""; |
||
26073 | if (!IsFirstArgument) |
||
26074 | OS << ")"; |
||
26075 | OS << "))"; |
||
26076 | break; |
||
26077 | } |
||
26078 | case 1 : { |
||
26079 | OS << " [[clang::requires_capability"; |
||
26080 | OS << ""; |
||
26081 | for (const auto &Val : args()) { |
||
26082 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26083 | OS << Val; |
||
26084 | } |
||
26085 | OS << ""; |
||
26086 | if (!IsFirstArgument) |
||
26087 | OS << ")"; |
||
26088 | OS << "]]"; |
||
26089 | break; |
||
26090 | } |
||
26091 | case 2 : { |
||
26092 | OS << " __attribute__((exclusive_locks_required"; |
||
26093 | OS << ""; |
||
26094 | for (const auto &Val : args()) { |
||
26095 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26096 | OS << Val; |
||
26097 | } |
||
26098 | OS << ""; |
||
26099 | if (!IsFirstArgument) |
||
26100 | OS << ")"; |
||
26101 | OS << "))"; |
||
26102 | break; |
||
26103 | } |
||
26104 | case 3 : { |
||
26105 | OS << " [[clang::exclusive_locks_required"; |
||
26106 | OS << ""; |
||
26107 | for (const auto &Val : args()) { |
||
26108 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26109 | OS << Val; |
||
26110 | } |
||
26111 | OS << ""; |
||
26112 | if (!IsFirstArgument) |
||
26113 | OS << ")"; |
||
26114 | OS << "]]"; |
||
26115 | break; |
||
26116 | } |
||
26117 | case 4 : { |
||
26118 | OS << " __attribute__((requires_shared_capability"; |
||
26119 | OS << ""; |
||
26120 | for (const auto &Val : args()) { |
||
26121 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26122 | OS << Val; |
||
26123 | } |
||
26124 | OS << ""; |
||
26125 | if (!IsFirstArgument) |
||
26126 | OS << ")"; |
||
26127 | OS << "))"; |
||
26128 | break; |
||
26129 | } |
||
26130 | case 5 : { |
||
26131 | OS << " [[clang::requires_shared_capability"; |
||
26132 | OS << ""; |
||
26133 | for (const auto &Val : args()) { |
||
26134 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26135 | OS << Val; |
||
26136 | } |
||
26137 | OS << ""; |
||
26138 | if (!IsFirstArgument) |
||
26139 | OS << ")"; |
||
26140 | OS << "]]"; |
||
26141 | break; |
||
26142 | } |
||
26143 | case 6 : { |
||
26144 | OS << " __attribute__((shared_locks_required"; |
||
26145 | OS << ""; |
||
26146 | for (const auto &Val : args()) { |
||
26147 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26148 | OS << Val; |
||
26149 | } |
||
26150 | OS << ""; |
||
26151 | if (!IsFirstArgument) |
||
26152 | OS << ")"; |
||
26153 | OS << "))"; |
||
26154 | break; |
||
26155 | } |
||
26156 | case 7 : { |
||
26157 | OS << " [[clang::shared_locks_required"; |
||
26158 | OS << ""; |
||
26159 | for (const auto &Val : args()) { |
||
26160 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26161 | OS << Val; |
||
26162 | } |
||
26163 | OS << ""; |
||
26164 | if (!IsFirstArgument) |
||
26165 | OS << ")"; |
||
26166 | OS << "]]"; |
||
26167 | break; |
||
26168 | } |
||
26169 | } |
||
26170 | } |
||
26171 | |||
26172 | const char *RequiresCapabilityAttr::getSpelling() const { |
||
26173 | switch (getAttributeSpellingListIndex()) { |
||
26174 | default: |
||
26175 | llvm_unreachable("Unknown attribute spelling!"); |
||
26176 | return "(No spelling)"; |
||
26177 | case 0: |
||
26178 | return "requires_capability"; |
||
26179 | case 1: |
||
26180 | return "requires_capability"; |
||
26181 | case 2: |
||
26182 | return "exclusive_locks_required"; |
||
26183 | case 3: |
||
26184 | return "exclusive_locks_required"; |
||
26185 | case 4: |
||
26186 | return "requires_shared_capability"; |
||
26187 | case 5: |
||
26188 | return "requires_shared_capability"; |
||
26189 | case 6: |
||
26190 | return "shared_locks_required"; |
||
26191 | case 7: |
||
26192 | return "shared_locks_required"; |
||
26193 | } |
||
26194 | } |
||
26195 | |||
26196 | |||
26197 | // RestrictAttr implementation |
||
26198 | |||
26199 | RestrictAttr *RestrictAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26200 | auto *A = new (Ctx) RestrictAttr(Ctx, CommonInfo); |
||
26201 | A->setImplicit(true); |
||
26202 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26203 | A->setAttributeSpellingListIndex(0); |
||
26204 | return A; |
||
26205 | } |
||
26206 | |||
26207 | RestrictAttr *RestrictAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26208 | auto *A = new (Ctx) RestrictAttr(Ctx, CommonInfo); |
||
26209 | return A; |
||
26210 | } |
||
26211 | |||
26212 | RestrictAttr *RestrictAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, RestrictAttr::Spelling S) { |
||
26213 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
26214 | return CreateImplicit(Ctx, I); |
||
26215 | } |
||
26216 | |||
26217 | RestrictAttr *RestrictAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, RestrictAttr::Spelling S) { |
||
26218 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
26219 | return Create(Ctx, I); |
||
26220 | } |
||
26221 | |||
26222 | RestrictAttr::RestrictAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26223 | ) |
||
26224 | : InheritableAttr(Ctx, CommonInfo, attr::Restrict, false, false) |
||
26225 | { |
||
26226 | } |
||
26227 | |||
26228 | RestrictAttr::Spelling RestrictAttr::getSemanticSpelling() const { |
||
26229 | switch (getAttributeSpellingListIndex()) { |
||
26230 | default: llvm_unreachable("Unknown spelling list index"); |
||
26231 | case 0: return Declspec_restrict; |
||
26232 | case 1: return GNU_malloc; |
||
26233 | case 2: return CXX11_gnu_malloc; |
||
26234 | case 3: return C2x_gnu_malloc; |
||
26235 | } |
||
26236 | } |
||
26237 | RestrictAttr *RestrictAttr::clone(ASTContext &C) const { |
||
26238 | auto *A = new (C) RestrictAttr(C, *this); |
||
26239 | A->Inherited = Inherited; |
||
26240 | A->IsPackExpansion = IsPackExpansion; |
||
26241 | A->setImplicit(Implicit); |
||
26242 | return A; |
||
26243 | } |
||
26244 | |||
26245 | void RestrictAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26246 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26247 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26248 | switch (getAttributeSpellingListIndex()) { |
||
26249 | default: |
||
26250 | llvm_unreachable("Unknown attribute spelling!"); |
||
26251 | break; |
||
26252 | case 0 : { |
||
26253 | OS << " __declspec(restrict"; |
||
26254 | OS << ")"; |
||
26255 | break; |
||
26256 | } |
||
26257 | case 1 : { |
||
26258 | OS << " __attribute__((malloc"; |
||
26259 | OS << "))"; |
||
26260 | break; |
||
26261 | } |
||
26262 | case 2 : { |
||
26263 | OS << " [[gnu::malloc"; |
||
26264 | OS << "]]"; |
||
26265 | break; |
||
26266 | } |
||
26267 | case 3 : { |
||
26268 | OS << " [[gnu::malloc"; |
||
26269 | OS << "]]"; |
||
26270 | break; |
||
26271 | } |
||
26272 | } |
||
26273 | } |
||
26274 | |||
26275 | const char *RestrictAttr::getSpelling() const { |
||
26276 | switch (getAttributeSpellingListIndex()) { |
||
26277 | default: |
||
26278 | llvm_unreachable("Unknown attribute spelling!"); |
||
26279 | return "(No spelling)"; |
||
26280 | case 0: |
||
26281 | return "restrict"; |
||
26282 | case 1: |
||
26283 | return "malloc"; |
||
26284 | case 2: |
||
26285 | return "malloc"; |
||
26286 | case 3: |
||
26287 | return "malloc"; |
||
26288 | } |
||
26289 | } |
||
26290 | |||
26291 | |||
26292 | // RetainAttr implementation |
||
26293 | |||
26294 | RetainAttr *RetainAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26295 | auto *A = new (Ctx) RetainAttr(Ctx, CommonInfo); |
||
26296 | A->setImplicit(true); |
||
26297 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26298 | A->setAttributeSpellingListIndex(0); |
||
26299 | return A; |
||
26300 | } |
||
26301 | |||
26302 | RetainAttr *RetainAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26303 | auto *A = new (Ctx) RetainAttr(Ctx, CommonInfo); |
||
26304 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26305 | A->setAttributeSpellingListIndex(0); |
||
26306 | return A; |
||
26307 | } |
||
26308 | |||
26309 | RetainAttr *RetainAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26310 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26311 | return CreateImplicit(Ctx, I); |
||
26312 | } |
||
26313 | |||
26314 | RetainAttr *RetainAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26315 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26316 | return Create(Ctx, I); |
||
26317 | } |
||
26318 | |||
26319 | RetainAttr::RetainAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26320 | ) |
||
26321 | : InheritableAttr(Ctx, CommonInfo, attr::Retain, false, false) |
||
26322 | { |
||
26323 | } |
||
26324 | |||
26325 | RetainAttr *RetainAttr::clone(ASTContext &C) const { |
||
26326 | auto *A = new (C) RetainAttr(C, *this); |
||
26327 | A->Inherited = Inherited; |
||
26328 | A->IsPackExpansion = IsPackExpansion; |
||
26329 | A->setImplicit(Implicit); |
||
26330 | return A; |
||
26331 | } |
||
26332 | |||
26333 | void RetainAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26334 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26335 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26336 | switch (getAttributeSpellingListIndex()) { |
||
26337 | default: |
||
26338 | llvm_unreachable("Unknown attribute spelling!"); |
||
26339 | break; |
||
26340 | case 0 : { |
||
26341 | OS << " __attribute__((retain"; |
||
26342 | OS << "))"; |
||
26343 | break; |
||
26344 | } |
||
26345 | case 1 : { |
||
26346 | OS << " [[gnu::retain"; |
||
26347 | OS << "]]"; |
||
26348 | break; |
||
26349 | } |
||
26350 | case 2 : { |
||
26351 | OS << " [[gnu::retain"; |
||
26352 | OS << "]]"; |
||
26353 | break; |
||
26354 | } |
||
26355 | } |
||
26356 | } |
||
26357 | |||
26358 | const char *RetainAttr::getSpelling() const { |
||
26359 | switch (getAttributeSpellingListIndex()) { |
||
26360 | default: |
||
26361 | llvm_unreachable("Unknown attribute spelling!"); |
||
26362 | return "(No spelling)"; |
||
26363 | case 0: |
||
26364 | return "retain"; |
||
26365 | case 1: |
||
26366 | return "retain"; |
||
26367 | case 2: |
||
26368 | return "retain"; |
||
26369 | } |
||
26370 | } |
||
26371 | |||
26372 | |||
26373 | // ReturnTypestateAttr implementation |
||
26374 | |||
26375 | ReturnTypestateAttr *ReturnTypestateAttr::CreateImplicit(ASTContext &Ctx, ConsumedState State, const AttributeCommonInfo &CommonInfo) { |
||
26376 | auto *A = new (Ctx) ReturnTypestateAttr(Ctx, CommonInfo, State); |
||
26377 | A->setImplicit(true); |
||
26378 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26379 | A->setAttributeSpellingListIndex(0); |
||
26380 | return A; |
||
26381 | } |
||
26382 | |||
26383 | ReturnTypestateAttr *ReturnTypestateAttr::Create(ASTContext &Ctx, ConsumedState State, const AttributeCommonInfo &CommonInfo) { |
||
26384 | auto *A = new (Ctx) ReturnTypestateAttr(Ctx, CommonInfo, State); |
||
26385 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26386 | A->setAttributeSpellingListIndex(0); |
||
26387 | return A; |
||
26388 | } |
||
26389 | |||
26390 | ReturnTypestateAttr *ReturnTypestateAttr::CreateImplicit(ASTContext &Ctx, ConsumedState State, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26391 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26392 | return CreateImplicit(Ctx, State, I); |
||
26393 | } |
||
26394 | |||
26395 | ReturnTypestateAttr *ReturnTypestateAttr::Create(ASTContext &Ctx, ConsumedState State, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26396 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26397 | return Create(Ctx, State, I); |
||
26398 | } |
||
26399 | |||
26400 | ReturnTypestateAttr::ReturnTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26401 | , ConsumedState State |
||
26402 | ) |
||
26403 | : InheritableAttr(Ctx, CommonInfo, attr::ReturnTypestate, false, false) |
||
26404 | , state(State) |
||
26405 | { |
||
26406 | } |
||
26407 | |||
26408 | |||
26409 | |||
26410 | bool ReturnTypestateAttr::ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) { |
||
26411 | std::optional<ConsumedState> R = llvm::StringSwitch<std::optional<ConsumedState>>(Val) |
||
26412 | .Case("unknown", ReturnTypestateAttr::Unknown) |
||
26413 | .Case("consumed", ReturnTypestateAttr::Consumed) |
||
26414 | .Case("unconsumed", ReturnTypestateAttr::Unconsumed) |
||
26415 | .Default(std::optional<ConsumedState>()); |
||
26416 | if (R) { |
||
26417 | Out = *R; |
||
26418 | return true; |
||
26419 | } |
||
26420 | return false; |
||
26421 | } |
||
26422 | |||
26423 | const char *ReturnTypestateAttr::ConvertConsumedStateToStr(ConsumedState Val) { |
||
26424 | switch(Val) { |
||
26425 | case ReturnTypestateAttr::Unknown: return "unknown"; |
||
26426 | case ReturnTypestateAttr::Consumed: return "consumed"; |
||
26427 | case ReturnTypestateAttr::Unconsumed: return "unconsumed"; |
||
26428 | } |
||
26429 | llvm_unreachable("No enumerator with that value"); |
||
26430 | } |
||
26431 | ReturnTypestateAttr *ReturnTypestateAttr::clone(ASTContext &C) const { |
||
26432 | auto *A = new (C) ReturnTypestateAttr(C, *this, state); |
||
26433 | A->Inherited = Inherited; |
||
26434 | A->IsPackExpansion = IsPackExpansion; |
||
26435 | A->setImplicit(Implicit); |
||
26436 | return A; |
||
26437 | } |
||
26438 | |||
26439 | void ReturnTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26440 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26441 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26442 | switch (getAttributeSpellingListIndex()) { |
||
26443 | default: |
||
26444 | llvm_unreachable("Unknown attribute spelling!"); |
||
26445 | break; |
||
26446 | case 0 : { |
||
26447 | OS << " __attribute__((return_typestate"; |
||
26448 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26449 | OS << "\"" << ReturnTypestateAttr::ConvertConsumedStateToStr(getState()) << "\""; |
||
26450 | if (!IsFirstArgument) |
||
26451 | OS << ")"; |
||
26452 | OS << "))"; |
||
26453 | break; |
||
26454 | } |
||
26455 | case 1 : { |
||
26456 | OS << " [[clang::return_typestate"; |
||
26457 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
26458 | OS << "\"" << ReturnTypestateAttr::ConvertConsumedStateToStr(getState()) << "\""; |
||
26459 | if (!IsFirstArgument) |
||
26460 | OS << ")"; |
||
26461 | OS << "]]"; |
||
26462 | break; |
||
26463 | } |
||
26464 | } |
||
26465 | } |
||
26466 | |||
26467 | const char *ReturnTypestateAttr::getSpelling() const { |
||
26468 | switch (getAttributeSpellingListIndex()) { |
||
26469 | default: |
||
26470 | llvm_unreachable("Unknown attribute spelling!"); |
||
26471 | return "(No spelling)"; |
||
26472 | case 0: |
||
26473 | return "return_typestate"; |
||
26474 | case 1: |
||
26475 | return "return_typestate"; |
||
26476 | } |
||
26477 | } |
||
26478 | |||
26479 | |||
26480 | // ReturnsNonNullAttr implementation |
||
26481 | |||
26482 | ReturnsNonNullAttr *ReturnsNonNullAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26483 | auto *A = new (Ctx) ReturnsNonNullAttr(Ctx, CommonInfo); |
||
26484 | A->setImplicit(true); |
||
26485 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26486 | A->setAttributeSpellingListIndex(0); |
||
26487 | return A; |
||
26488 | } |
||
26489 | |||
26490 | ReturnsNonNullAttr *ReturnsNonNullAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26491 | auto *A = new (Ctx) ReturnsNonNullAttr(Ctx, CommonInfo); |
||
26492 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26493 | A->setAttributeSpellingListIndex(0); |
||
26494 | return A; |
||
26495 | } |
||
26496 | |||
26497 | ReturnsNonNullAttr *ReturnsNonNullAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26498 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26499 | return CreateImplicit(Ctx, I); |
||
26500 | } |
||
26501 | |||
26502 | ReturnsNonNullAttr *ReturnsNonNullAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26503 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26504 | return Create(Ctx, I); |
||
26505 | } |
||
26506 | |||
26507 | ReturnsNonNullAttr::ReturnsNonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26508 | ) |
||
26509 | : InheritableAttr(Ctx, CommonInfo, attr::ReturnsNonNull, false, false) |
||
26510 | { |
||
26511 | } |
||
26512 | |||
26513 | ReturnsNonNullAttr *ReturnsNonNullAttr::clone(ASTContext &C) const { |
||
26514 | auto *A = new (C) ReturnsNonNullAttr(C, *this); |
||
26515 | A->Inherited = Inherited; |
||
26516 | A->IsPackExpansion = IsPackExpansion; |
||
26517 | A->setImplicit(Implicit); |
||
26518 | return A; |
||
26519 | } |
||
26520 | |||
26521 | void ReturnsNonNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26522 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26523 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26524 | switch (getAttributeSpellingListIndex()) { |
||
26525 | default: |
||
26526 | llvm_unreachable("Unknown attribute spelling!"); |
||
26527 | break; |
||
26528 | case 0 : { |
||
26529 | OS << " __attribute__((returns_nonnull"; |
||
26530 | OS << "))"; |
||
26531 | break; |
||
26532 | } |
||
26533 | case 1 : { |
||
26534 | OS << " [[gnu::returns_nonnull"; |
||
26535 | OS << "]]"; |
||
26536 | break; |
||
26537 | } |
||
26538 | case 2 : { |
||
26539 | OS << " [[gnu::returns_nonnull"; |
||
26540 | OS << "]]"; |
||
26541 | break; |
||
26542 | } |
||
26543 | } |
||
26544 | } |
||
26545 | |||
26546 | const char *ReturnsNonNullAttr::getSpelling() const { |
||
26547 | switch (getAttributeSpellingListIndex()) { |
||
26548 | default: |
||
26549 | llvm_unreachable("Unknown attribute spelling!"); |
||
26550 | return "(No spelling)"; |
||
26551 | case 0: |
||
26552 | return "returns_nonnull"; |
||
26553 | case 1: |
||
26554 | return "returns_nonnull"; |
||
26555 | case 2: |
||
26556 | return "returns_nonnull"; |
||
26557 | } |
||
26558 | } |
||
26559 | |||
26560 | |||
26561 | // ReturnsTwiceAttr implementation |
||
26562 | |||
26563 | ReturnsTwiceAttr *ReturnsTwiceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26564 | auto *A = new (Ctx) ReturnsTwiceAttr(Ctx, CommonInfo); |
||
26565 | A->setImplicit(true); |
||
26566 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26567 | A->setAttributeSpellingListIndex(0); |
||
26568 | return A; |
||
26569 | } |
||
26570 | |||
26571 | ReturnsTwiceAttr *ReturnsTwiceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26572 | auto *A = new (Ctx) ReturnsTwiceAttr(Ctx, CommonInfo); |
||
26573 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26574 | A->setAttributeSpellingListIndex(0); |
||
26575 | return A; |
||
26576 | } |
||
26577 | |||
26578 | ReturnsTwiceAttr *ReturnsTwiceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26579 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26580 | return CreateImplicit(Ctx, I); |
||
26581 | } |
||
26582 | |||
26583 | ReturnsTwiceAttr *ReturnsTwiceAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26584 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26585 | return Create(Ctx, I); |
||
26586 | } |
||
26587 | |||
26588 | ReturnsTwiceAttr::ReturnsTwiceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26589 | ) |
||
26590 | : InheritableAttr(Ctx, CommonInfo, attr::ReturnsTwice, false, false) |
||
26591 | { |
||
26592 | } |
||
26593 | |||
26594 | ReturnsTwiceAttr *ReturnsTwiceAttr::clone(ASTContext &C) const { |
||
26595 | auto *A = new (C) ReturnsTwiceAttr(C, *this); |
||
26596 | A->Inherited = Inherited; |
||
26597 | A->IsPackExpansion = IsPackExpansion; |
||
26598 | A->setImplicit(Implicit); |
||
26599 | return A; |
||
26600 | } |
||
26601 | |||
26602 | void ReturnsTwiceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26603 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26604 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26605 | switch (getAttributeSpellingListIndex()) { |
||
26606 | default: |
||
26607 | llvm_unreachable("Unknown attribute spelling!"); |
||
26608 | break; |
||
26609 | case 0 : { |
||
26610 | OS << " __attribute__((returns_twice"; |
||
26611 | OS << "))"; |
||
26612 | break; |
||
26613 | } |
||
26614 | case 1 : { |
||
26615 | OS << " [[gnu::returns_twice"; |
||
26616 | OS << "]]"; |
||
26617 | break; |
||
26618 | } |
||
26619 | case 2 : { |
||
26620 | OS << " [[gnu::returns_twice"; |
||
26621 | OS << "]]"; |
||
26622 | break; |
||
26623 | } |
||
26624 | } |
||
26625 | } |
||
26626 | |||
26627 | const char *ReturnsTwiceAttr::getSpelling() const { |
||
26628 | switch (getAttributeSpellingListIndex()) { |
||
26629 | default: |
||
26630 | llvm_unreachable("Unknown attribute spelling!"); |
||
26631 | return "(No spelling)"; |
||
26632 | case 0: |
||
26633 | return "returns_twice"; |
||
26634 | case 1: |
||
26635 | return "returns_twice"; |
||
26636 | case 2: |
||
26637 | return "returns_twice"; |
||
26638 | } |
||
26639 | } |
||
26640 | |||
26641 | |||
26642 | // SPtrAttr implementation |
||
26643 | |||
26644 | SPtrAttr *SPtrAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26645 | auto *A = new (Ctx) SPtrAttr(Ctx, CommonInfo); |
||
26646 | A->setImplicit(true); |
||
26647 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26648 | A->setAttributeSpellingListIndex(0); |
||
26649 | return A; |
||
26650 | } |
||
26651 | |||
26652 | SPtrAttr *SPtrAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26653 | auto *A = new (Ctx) SPtrAttr(Ctx, CommonInfo); |
||
26654 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26655 | A->setAttributeSpellingListIndex(0); |
||
26656 | return A; |
||
26657 | } |
||
26658 | |||
26659 | SPtrAttr *SPtrAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26660 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26661 | return CreateImplicit(Ctx, I); |
||
26662 | } |
||
26663 | |||
26664 | SPtrAttr *SPtrAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26665 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26666 | return Create(Ctx, I); |
||
26667 | } |
||
26668 | |||
26669 | SPtrAttr::SPtrAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26670 | ) |
||
26671 | : TypeAttr(Ctx, CommonInfo, attr::SPtr, false) |
||
26672 | { |
||
26673 | } |
||
26674 | |||
26675 | SPtrAttr *SPtrAttr::clone(ASTContext &C) const { |
||
26676 | auto *A = new (C) SPtrAttr(C, *this); |
||
26677 | A->Inherited = Inherited; |
||
26678 | A->IsPackExpansion = IsPackExpansion; |
||
26679 | A->setImplicit(Implicit); |
||
26680 | return A; |
||
26681 | } |
||
26682 | |||
26683 | void SPtrAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26684 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26685 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26686 | switch (getAttributeSpellingListIndex()) { |
||
26687 | default: |
||
26688 | llvm_unreachable("Unknown attribute spelling!"); |
||
26689 | break; |
||
26690 | case 0 : { |
||
26691 | OS << " __sptr"; |
||
26692 | OS << ""; |
||
26693 | break; |
||
26694 | } |
||
26695 | } |
||
26696 | } |
||
26697 | |||
26698 | const char *SPtrAttr::getSpelling() const { |
||
26699 | switch (getAttributeSpellingListIndex()) { |
||
26700 | default: |
||
26701 | llvm_unreachable("Unknown attribute spelling!"); |
||
26702 | return "(No spelling)"; |
||
26703 | case 0: |
||
26704 | return "__sptr"; |
||
26705 | } |
||
26706 | } |
||
26707 | |||
26708 | |||
26709 | // SYCLKernelAttr implementation |
||
26710 | |||
26711 | SYCLKernelAttr *SYCLKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26712 | auto *A = new (Ctx) SYCLKernelAttr(Ctx, CommonInfo); |
||
26713 | A->setImplicit(true); |
||
26714 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26715 | A->setAttributeSpellingListIndex(0); |
||
26716 | return A; |
||
26717 | } |
||
26718 | |||
26719 | SYCLKernelAttr *SYCLKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26720 | auto *A = new (Ctx) SYCLKernelAttr(Ctx, CommonInfo); |
||
26721 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26722 | A->setAttributeSpellingListIndex(0); |
||
26723 | return A; |
||
26724 | } |
||
26725 | |||
26726 | SYCLKernelAttr *SYCLKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26727 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26728 | return CreateImplicit(Ctx, I); |
||
26729 | } |
||
26730 | |||
26731 | SYCLKernelAttr *SYCLKernelAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26732 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26733 | return Create(Ctx, I); |
||
26734 | } |
||
26735 | |||
26736 | SYCLKernelAttr::SYCLKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26737 | ) |
||
26738 | : InheritableAttr(Ctx, CommonInfo, attr::SYCLKernel, false, false) |
||
26739 | { |
||
26740 | } |
||
26741 | |||
26742 | SYCLKernelAttr *SYCLKernelAttr::clone(ASTContext &C) const { |
||
26743 | auto *A = new (C) SYCLKernelAttr(C, *this); |
||
26744 | A->Inherited = Inherited; |
||
26745 | A->IsPackExpansion = IsPackExpansion; |
||
26746 | A->setImplicit(Implicit); |
||
26747 | return A; |
||
26748 | } |
||
26749 | |||
26750 | void SYCLKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26751 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26752 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26753 | switch (getAttributeSpellingListIndex()) { |
||
26754 | default: |
||
26755 | llvm_unreachable("Unknown attribute spelling!"); |
||
26756 | break; |
||
26757 | case 0 : { |
||
26758 | OS << " __attribute__((sycl_kernel"; |
||
26759 | OS << "))"; |
||
26760 | break; |
||
26761 | } |
||
26762 | case 1 : { |
||
26763 | OS << " [[clang::sycl_kernel"; |
||
26764 | OS << "]]"; |
||
26765 | break; |
||
26766 | } |
||
26767 | case 2 : { |
||
26768 | OS << " [[clang::sycl_kernel"; |
||
26769 | OS << "]]"; |
||
26770 | break; |
||
26771 | } |
||
26772 | } |
||
26773 | } |
||
26774 | |||
26775 | const char *SYCLKernelAttr::getSpelling() const { |
||
26776 | switch (getAttributeSpellingListIndex()) { |
||
26777 | default: |
||
26778 | llvm_unreachable("Unknown attribute spelling!"); |
||
26779 | return "(No spelling)"; |
||
26780 | case 0: |
||
26781 | return "sycl_kernel"; |
||
26782 | case 1: |
||
26783 | return "sycl_kernel"; |
||
26784 | case 2: |
||
26785 | return "sycl_kernel"; |
||
26786 | } |
||
26787 | } |
||
26788 | |||
26789 | |||
26790 | // SYCLSpecialClassAttr implementation |
||
26791 | |||
26792 | SYCLSpecialClassAttr *SYCLSpecialClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26793 | auto *A = new (Ctx) SYCLSpecialClassAttr(Ctx, CommonInfo); |
||
26794 | A->setImplicit(true); |
||
26795 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26796 | A->setAttributeSpellingListIndex(0); |
||
26797 | return A; |
||
26798 | } |
||
26799 | |||
26800 | SYCLSpecialClassAttr *SYCLSpecialClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26801 | auto *A = new (Ctx) SYCLSpecialClassAttr(Ctx, CommonInfo); |
||
26802 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26803 | A->setAttributeSpellingListIndex(0); |
||
26804 | return A; |
||
26805 | } |
||
26806 | |||
26807 | SYCLSpecialClassAttr *SYCLSpecialClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26808 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26809 | return CreateImplicit(Ctx, I); |
||
26810 | } |
||
26811 | |||
26812 | SYCLSpecialClassAttr *SYCLSpecialClassAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26813 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26814 | return Create(Ctx, I); |
||
26815 | } |
||
26816 | |||
26817 | SYCLSpecialClassAttr::SYCLSpecialClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26818 | ) |
||
26819 | : InheritableAttr(Ctx, CommonInfo, attr::SYCLSpecialClass, false, false) |
||
26820 | { |
||
26821 | } |
||
26822 | |||
26823 | SYCLSpecialClassAttr *SYCLSpecialClassAttr::clone(ASTContext &C) const { |
||
26824 | auto *A = new (C) SYCLSpecialClassAttr(C, *this); |
||
26825 | A->Inherited = Inherited; |
||
26826 | A->IsPackExpansion = IsPackExpansion; |
||
26827 | A->setImplicit(Implicit); |
||
26828 | return A; |
||
26829 | } |
||
26830 | |||
26831 | void SYCLSpecialClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26832 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26833 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26834 | switch (getAttributeSpellingListIndex()) { |
||
26835 | default: |
||
26836 | llvm_unreachable("Unknown attribute spelling!"); |
||
26837 | break; |
||
26838 | case 0 : { |
||
26839 | OS << " __attribute__((sycl_special_class"; |
||
26840 | OS << "))"; |
||
26841 | break; |
||
26842 | } |
||
26843 | case 1 : { |
||
26844 | OS << " [[clang::sycl_special_class"; |
||
26845 | OS << "]]"; |
||
26846 | break; |
||
26847 | } |
||
26848 | case 2 : { |
||
26849 | OS << " [[clang::sycl_special_class"; |
||
26850 | OS << "]]"; |
||
26851 | break; |
||
26852 | } |
||
26853 | } |
||
26854 | } |
||
26855 | |||
26856 | const char *SYCLSpecialClassAttr::getSpelling() const { |
||
26857 | switch (getAttributeSpellingListIndex()) { |
||
26858 | default: |
||
26859 | llvm_unreachable("Unknown attribute spelling!"); |
||
26860 | return "(No spelling)"; |
||
26861 | case 0: |
||
26862 | return "sycl_special_class"; |
||
26863 | case 1: |
||
26864 | return "sycl_special_class"; |
||
26865 | case 2: |
||
26866 | return "sycl_special_class"; |
||
26867 | } |
||
26868 | } |
||
26869 | |||
26870 | |||
26871 | // ScopedLockableAttr implementation |
||
26872 | |||
26873 | ScopedLockableAttr *ScopedLockableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26874 | auto *A = new (Ctx) ScopedLockableAttr(Ctx, CommonInfo); |
||
26875 | A->setImplicit(true); |
||
26876 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26877 | A->setAttributeSpellingListIndex(0); |
||
26878 | return A; |
||
26879 | } |
||
26880 | |||
26881 | ScopedLockableAttr *ScopedLockableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
26882 | auto *A = new (Ctx) ScopedLockableAttr(Ctx, CommonInfo); |
||
26883 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26884 | A->setAttributeSpellingListIndex(0); |
||
26885 | return A; |
||
26886 | } |
||
26887 | |||
26888 | ScopedLockableAttr *ScopedLockableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26889 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26890 | return CreateImplicit(Ctx, I); |
||
26891 | } |
||
26892 | |||
26893 | ScopedLockableAttr *ScopedLockableAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
26894 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
26895 | return Create(Ctx, I); |
||
26896 | } |
||
26897 | |||
26898 | ScopedLockableAttr::ScopedLockableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26899 | ) |
||
26900 | : InheritableAttr(Ctx, CommonInfo, attr::ScopedLockable, false, false) |
||
26901 | { |
||
26902 | } |
||
26903 | |||
26904 | ScopedLockableAttr *ScopedLockableAttr::clone(ASTContext &C) const { |
||
26905 | auto *A = new (C) ScopedLockableAttr(C, *this); |
||
26906 | A->Inherited = Inherited; |
||
26907 | A->IsPackExpansion = IsPackExpansion; |
||
26908 | A->setImplicit(Implicit); |
||
26909 | return A; |
||
26910 | } |
||
26911 | |||
26912 | void ScopedLockableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
26913 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
26914 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
26915 | switch (getAttributeSpellingListIndex()) { |
||
26916 | default: |
||
26917 | llvm_unreachable("Unknown attribute spelling!"); |
||
26918 | break; |
||
26919 | case 0 : { |
||
26920 | OS << " __attribute__((scoped_lockable"; |
||
26921 | OS << "))"; |
||
26922 | break; |
||
26923 | } |
||
26924 | case 1 : { |
||
26925 | OS << " [[clang::scoped_lockable"; |
||
26926 | OS << "]]"; |
||
26927 | break; |
||
26928 | } |
||
26929 | } |
||
26930 | } |
||
26931 | |||
26932 | const char *ScopedLockableAttr::getSpelling() const { |
||
26933 | switch (getAttributeSpellingListIndex()) { |
||
26934 | default: |
||
26935 | llvm_unreachable("Unknown attribute spelling!"); |
||
26936 | return "(No spelling)"; |
||
26937 | case 0: |
||
26938 | return "scoped_lockable"; |
||
26939 | case 1: |
||
26940 | return "scoped_lockable"; |
||
26941 | } |
||
26942 | } |
||
26943 | |||
26944 | |||
26945 | // SectionAttr implementation |
||
26946 | |||
26947 | SectionAttr *SectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
26948 | auto *A = new (Ctx) SectionAttr(Ctx, CommonInfo, Name); |
||
26949 | A->setImplicit(true); |
||
26950 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
26951 | A->setAttributeSpellingListIndex(0); |
||
26952 | return A; |
||
26953 | } |
||
26954 | |||
26955 | SectionAttr *SectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
26956 | auto *A = new (Ctx) SectionAttr(Ctx, CommonInfo, Name); |
||
26957 | return A; |
||
26958 | } |
||
26959 | |||
26960 | SectionAttr *SectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax, SectionAttr::Spelling S) { |
||
26961 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
26962 | return CreateImplicit(Ctx, Name, I); |
||
26963 | } |
||
26964 | |||
26965 | SectionAttr *SectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax, SectionAttr::Spelling S) { |
||
26966 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
26967 | return Create(Ctx, Name, I); |
||
26968 | } |
||
26969 | |||
26970 | SectionAttr::SectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
26971 | , llvm::StringRef Name |
||
26972 | ) |
||
26973 | : InheritableAttr(Ctx, CommonInfo, attr::Section, false, false) |
||
26974 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
26975 | { |
||
26976 | if (!Name.empty()) |
||
26977 | std::memcpy(name, Name.data(), nameLength); |
||
26978 | } |
||
26979 | |||
26980 | SectionAttr::Spelling SectionAttr::getSemanticSpelling() const { |
||
26981 | switch (getAttributeSpellingListIndex()) { |
||
26982 | default: llvm_unreachable("Unknown spelling list index"); |
||
26983 | case 0: return GNU_section; |
||
26984 | case 1: return CXX11_gnu_section; |
||
26985 | case 2: return C2x_gnu_section; |
||
26986 | case 3: return Declspec_allocate; |
||
26987 | } |
||
26988 | } |
||
26989 | |||
26990 | |||
26991 | SectionAttr *SectionAttr::clone(ASTContext &C) const { |
||
26992 | auto *A = new (C) SectionAttr(C, *this, getName()); |
||
26993 | A->Inherited = Inherited; |
||
26994 | A->IsPackExpansion = IsPackExpansion; |
||
26995 | A->setImplicit(Implicit); |
||
26996 | return A; |
||
26997 | } |
||
26998 | |||
26999 | void SectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27000 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27001 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27002 | switch (getAttributeSpellingListIndex()) { |
||
27003 | default: |
||
27004 | llvm_unreachable("Unknown attribute spelling!"); |
||
27005 | break; |
||
27006 | case 0 : { |
||
27007 | OS << " __attribute__((section"; |
||
27008 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27009 | OS << "\"" << getName() << "\""; |
||
27010 | if (!IsFirstArgument) |
||
27011 | OS << ")"; |
||
27012 | OS << "))"; |
||
27013 | break; |
||
27014 | } |
||
27015 | case 1 : { |
||
27016 | OS << " [[gnu::section"; |
||
27017 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27018 | OS << "\"" << getName() << "\""; |
||
27019 | if (!IsFirstArgument) |
||
27020 | OS << ")"; |
||
27021 | OS << "]]"; |
||
27022 | break; |
||
27023 | } |
||
27024 | case 2 : { |
||
27025 | OS << " [[gnu::section"; |
||
27026 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27027 | OS << "\"" << getName() << "\""; |
||
27028 | if (!IsFirstArgument) |
||
27029 | OS << ")"; |
||
27030 | OS << "]]"; |
||
27031 | break; |
||
27032 | } |
||
27033 | case 3 : { |
||
27034 | OS << " __declspec(allocate"; |
||
27035 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27036 | OS << "\"" << getName() << "\""; |
||
27037 | if (!IsFirstArgument) |
||
27038 | OS << ")"; |
||
27039 | OS << ")"; |
||
27040 | break; |
||
27041 | } |
||
27042 | } |
||
27043 | } |
||
27044 | |||
27045 | const char *SectionAttr::getSpelling() const { |
||
27046 | switch (getAttributeSpellingListIndex()) { |
||
27047 | default: |
||
27048 | llvm_unreachable("Unknown attribute spelling!"); |
||
27049 | return "(No spelling)"; |
||
27050 | case 0: |
||
27051 | return "section"; |
||
27052 | case 1: |
||
27053 | return "section"; |
||
27054 | case 2: |
||
27055 | return "section"; |
||
27056 | case 3: |
||
27057 | return "allocate"; |
||
27058 | } |
||
27059 | } |
||
27060 | |||
27061 | |||
27062 | // SelectAnyAttr implementation |
||
27063 | |||
27064 | SelectAnyAttr *SelectAnyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27065 | auto *A = new (Ctx) SelectAnyAttr(Ctx, CommonInfo); |
||
27066 | A->setImplicit(true); |
||
27067 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27068 | A->setAttributeSpellingListIndex(0); |
||
27069 | return A; |
||
27070 | } |
||
27071 | |||
27072 | SelectAnyAttr *SelectAnyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27073 | auto *A = new (Ctx) SelectAnyAttr(Ctx, CommonInfo); |
||
27074 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27075 | A->setAttributeSpellingListIndex(0); |
||
27076 | return A; |
||
27077 | } |
||
27078 | |||
27079 | SelectAnyAttr *SelectAnyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27080 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27081 | return CreateImplicit(Ctx, I); |
||
27082 | } |
||
27083 | |||
27084 | SelectAnyAttr *SelectAnyAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27085 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27086 | return Create(Ctx, I); |
||
27087 | } |
||
27088 | |||
27089 | SelectAnyAttr::SelectAnyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27090 | ) |
||
27091 | : InheritableAttr(Ctx, CommonInfo, attr::SelectAny, false, false) |
||
27092 | { |
||
27093 | } |
||
27094 | |||
27095 | SelectAnyAttr *SelectAnyAttr::clone(ASTContext &C) const { |
||
27096 | auto *A = new (C) SelectAnyAttr(C, *this); |
||
27097 | A->Inherited = Inherited; |
||
27098 | A->IsPackExpansion = IsPackExpansion; |
||
27099 | A->setImplicit(Implicit); |
||
27100 | return A; |
||
27101 | } |
||
27102 | |||
27103 | void SelectAnyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27104 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27105 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27106 | switch (getAttributeSpellingListIndex()) { |
||
27107 | default: |
||
27108 | llvm_unreachable("Unknown attribute spelling!"); |
||
27109 | break; |
||
27110 | case 0 : { |
||
27111 | OS << " __declspec(selectany"; |
||
27112 | OS << ")"; |
||
27113 | break; |
||
27114 | } |
||
27115 | case 1 : { |
||
27116 | OS << " __attribute__((selectany"; |
||
27117 | OS << "))"; |
||
27118 | break; |
||
27119 | } |
||
27120 | case 2 : { |
||
27121 | OS << " [[gnu::selectany"; |
||
27122 | OS << "]]"; |
||
27123 | break; |
||
27124 | } |
||
27125 | case 3 : { |
||
27126 | OS << " [[gnu::selectany"; |
||
27127 | OS << "]]"; |
||
27128 | break; |
||
27129 | } |
||
27130 | } |
||
27131 | } |
||
27132 | |||
27133 | const char *SelectAnyAttr::getSpelling() const { |
||
27134 | switch (getAttributeSpellingListIndex()) { |
||
27135 | default: |
||
27136 | llvm_unreachable("Unknown attribute spelling!"); |
||
27137 | return "(No spelling)"; |
||
27138 | case 0: |
||
27139 | return "selectany"; |
||
27140 | case 1: |
||
27141 | return "selectany"; |
||
27142 | case 2: |
||
27143 | return "selectany"; |
||
27144 | case 3: |
||
27145 | return "selectany"; |
||
27146 | } |
||
27147 | } |
||
27148 | |||
27149 | |||
27150 | // SentinelAttr implementation |
||
27151 | |||
27152 | SentinelAttr *SentinelAttr::CreateImplicit(ASTContext &Ctx, int Sentinel, int NullPos, const AttributeCommonInfo &CommonInfo) { |
||
27153 | auto *A = new (Ctx) SentinelAttr(Ctx, CommonInfo, Sentinel, NullPos); |
||
27154 | A->setImplicit(true); |
||
27155 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27156 | A->setAttributeSpellingListIndex(0); |
||
27157 | return A; |
||
27158 | } |
||
27159 | |||
27160 | SentinelAttr *SentinelAttr::Create(ASTContext &Ctx, int Sentinel, int NullPos, const AttributeCommonInfo &CommonInfo) { |
||
27161 | auto *A = new (Ctx) SentinelAttr(Ctx, CommonInfo, Sentinel, NullPos); |
||
27162 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27163 | A->setAttributeSpellingListIndex(0); |
||
27164 | return A; |
||
27165 | } |
||
27166 | |||
27167 | SentinelAttr *SentinelAttr::CreateImplicit(ASTContext &Ctx, int Sentinel, int NullPos, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27168 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27169 | return CreateImplicit(Ctx, Sentinel, NullPos, I); |
||
27170 | } |
||
27171 | |||
27172 | SentinelAttr *SentinelAttr::Create(ASTContext &Ctx, int Sentinel, int NullPos, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27173 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27174 | return Create(Ctx, Sentinel, NullPos, I); |
||
27175 | } |
||
27176 | |||
27177 | SentinelAttr::SentinelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27178 | , int Sentinel |
||
27179 | , int NullPos |
||
27180 | ) |
||
27181 | : InheritableAttr(Ctx, CommonInfo, attr::Sentinel, false, false) |
||
27182 | , sentinel(Sentinel) |
||
27183 | , nullPos(NullPos) |
||
27184 | { |
||
27185 | } |
||
27186 | |||
27187 | SentinelAttr::SentinelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27188 | ) |
||
27189 | : InheritableAttr(Ctx, CommonInfo, attr::Sentinel, false, false) |
||
27190 | , sentinel() |
||
27191 | , nullPos() |
||
27192 | { |
||
27193 | } |
||
27194 | |||
27195 | |||
27196 | |||
27197 | |||
27198 | |||
27199 | SentinelAttr *SentinelAttr::clone(ASTContext &C) const { |
||
27200 | auto *A = new (C) SentinelAttr(C, *this, sentinel, nullPos); |
||
27201 | A->Inherited = Inherited; |
||
27202 | A->IsPackExpansion = IsPackExpansion; |
||
27203 | A->setImplicit(Implicit); |
||
27204 | return A; |
||
27205 | } |
||
27206 | |||
27207 | void SentinelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27208 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27209 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27210 | switch (getAttributeSpellingListIndex()) { |
||
27211 | default: |
||
27212 | llvm_unreachable("Unknown attribute spelling!"); |
||
27213 | break; |
||
27214 | case 0 : { |
||
27215 | OS << " __attribute__((sentinel"; |
||
27216 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27217 | OS << "" << getSentinel() << ""; |
||
27218 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27219 | OS << "" << getNullPos() << ""; |
||
27220 | if (!IsFirstArgument) |
||
27221 | OS << ")"; |
||
27222 | OS << "))"; |
||
27223 | break; |
||
27224 | } |
||
27225 | case 1 : { |
||
27226 | OS << " [[gnu::sentinel"; |
||
27227 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27228 | OS << "" << getSentinel() << ""; |
||
27229 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27230 | OS << "" << getNullPos() << ""; |
||
27231 | if (!IsFirstArgument) |
||
27232 | OS << ")"; |
||
27233 | OS << "]]"; |
||
27234 | break; |
||
27235 | } |
||
27236 | case 2 : { |
||
27237 | OS << " [[gnu::sentinel"; |
||
27238 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27239 | OS << "" << getSentinel() << ""; |
||
27240 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27241 | OS << "" << getNullPos() << ""; |
||
27242 | if (!IsFirstArgument) |
||
27243 | OS << ")"; |
||
27244 | OS << "]]"; |
||
27245 | break; |
||
27246 | } |
||
27247 | } |
||
27248 | } |
||
27249 | |||
27250 | const char *SentinelAttr::getSpelling() const { |
||
27251 | switch (getAttributeSpellingListIndex()) { |
||
27252 | default: |
||
27253 | llvm_unreachable("Unknown attribute spelling!"); |
||
27254 | return "(No spelling)"; |
||
27255 | case 0: |
||
27256 | return "sentinel"; |
||
27257 | case 1: |
||
27258 | return "sentinel"; |
||
27259 | case 2: |
||
27260 | return "sentinel"; |
||
27261 | } |
||
27262 | } |
||
27263 | |||
27264 | |||
27265 | // SetTypestateAttr implementation |
||
27266 | |||
27267 | SetTypestateAttr *SetTypestateAttr::CreateImplicit(ASTContext &Ctx, ConsumedState NewState, const AttributeCommonInfo &CommonInfo) { |
||
27268 | auto *A = new (Ctx) SetTypestateAttr(Ctx, CommonInfo, NewState); |
||
27269 | A->setImplicit(true); |
||
27270 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27271 | A->setAttributeSpellingListIndex(0); |
||
27272 | return A; |
||
27273 | } |
||
27274 | |||
27275 | SetTypestateAttr *SetTypestateAttr::Create(ASTContext &Ctx, ConsumedState NewState, const AttributeCommonInfo &CommonInfo) { |
||
27276 | auto *A = new (Ctx) SetTypestateAttr(Ctx, CommonInfo, NewState); |
||
27277 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27278 | A->setAttributeSpellingListIndex(0); |
||
27279 | return A; |
||
27280 | } |
||
27281 | |||
27282 | SetTypestateAttr *SetTypestateAttr::CreateImplicit(ASTContext &Ctx, ConsumedState NewState, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27283 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27284 | return CreateImplicit(Ctx, NewState, I); |
||
27285 | } |
||
27286 | |||
27287 | SetTypestateAttr *SetTypestateAttr::Create(ASTContext &Ctx, ConsumedState NewState, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27288 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27289 | return Create(Ctx, NewState, I); |
||
27290 | } |
||
27291 | |||
27292 | SetTypestateAttr::SetTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27293 | , ConsumedState NewState |
||
27294 | ) |
||
27295 | : InheritableAttr(Ctx, CommonInfo, attr::SetTypestate, false, false) |
||
27296 | , newState(NewState) |
||
27297 | { |
||
27298 | } |
||
27299 | |||
27300 | |||
27301 | |||
27302 | bool SetTypestateAttr::ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) { |
||
27303 | std::optional<ConsumedState> R = llvm::StringSwitch<std::optional<ConsumedState>>(Val) |
||
27304 | .Case("unknown", SetTypestateAttr::Unknown) |
||
27305 | .Case("consumed", SetTypestateAttr::Consumed) |
||
27306 | .Case("unconsumed", SetTypestateAttr::Unconsumed) |
||
27307 | .Default(std::optional<ConsumedState>()); |
||
27308 | if (R) { |
||
27309 | Out = *R; |
||
27310 | return true; |
||
27311 | } |
||
27312 | return false; |
||
27313 | } |
||
27314 | |||
27315 | const char *SetTypestateAttr::ConvertConsumedStateToStr(ConsumedState Val) { |
||
27316 | switch(Val) { |
||
27317 | case SetTypestateAttr::Unknown: return "unknown"; |
||
27318 | case SetTypestateAttr::Consumed: return "consumed"; |
||
27319 | case SetTypestateAttr::Unconsumed: return "unconsumed"; |
||
27320 | } |
||
27321 | llvm_unreachable("No enumerator with that value"); |
||
27322 | } |
||
27323 | SetTypestateAttr *SetTypestateAttr::clone(ASTContext &C) const { |
||
27324 | auto *A = new (C) SetTypestateAttr(C, *this, newState); |
||
27325 | A->Inherited = Inherited; |
||
27326 | A->IsPackExpansion = IsPackExpansion; |
||
27327 | A->setImplicit(Implicit); |
||
27328 | return A; |
||
27329 | } |
||
27330 | |||
27331 | void SetTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27332 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27333 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27334 | switch (getAttributeSpellingListIndex()) { |
||
27335 | default: |
||
27336 | llvm_unreachable("Unknown attribute spelling!"); |
||
27337 | break; |
||
27338 | case 0 : { |
||
27339 | OS << " __attribute__((set_typestate"; |
||
27340 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27341 | OS << "\"" << SetTypestateAttr::ConvertConsumedStateToStr(getNewState()) << "\""; |
||
27342 | if (!IsFirstArgument) |
||
27343 | OS << ")"; |
||
27344 | OS << "))"; |
||
27345 | break; |
||
27346 | } |
||
27347 | case 1 : { |
||
27348 | OS << " [[clang::set_typestate"; |
||
27349 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27350 | OS << "\"" << SetTypestateAttr::ConvertConsumedStateToStr(getNewState()) << "\""; |
||
27351 | if (!IsFirstArgument) |
||
27352 | OS << ")"; |
||
27353 | OS << "]]"; |
||
27354 | break; |
||
27355 | } |
||
27356 | } |
||
27357 | } |
||
27358 | |||
27359 | const char *SetTypestateAttr::getSpelling() const { |
||
27360 | switch (getAttributeSpellingListIndex()) { |
||
27361 | default: |
||
27362 | llvm_unreachable("Unknown attribute spelling!"); |
||
27363 | return "(No spelling)"; |
||
27364 | case 0: |
||
27365 | return "set_typestate"; |
||
27366 | case 1: |
||
27367 | return "set_typestate"; |
||
27368 | } |
||
27369 | } |
||
27370 | |||
27371 | |||
27372 | // SharedTrylockFunctionAttr implementation |
||
27373 | |||
27374 | SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
27375 | auto *A = new (Ctx) SharedTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); |
||
27376 | A->setImplicit(true); |
||
27377 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27378 | A->setAttributeSpellingListIndex(0); |
||
27379 | return A; |
||
27380 | } |
||
27381 | |||
27382 | SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
27383 | auto *A = new (Ctx) SharedTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); |
||
27384 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27385 | A->setAttributeSpellingListIndex(0); |
||
27386 | return A; |
||
27387 | } |
||
27388 | |||
27389 | SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27390 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27391 | return CreateImplicit(Ctx, SuccessValue, Args, ArgsSize, I); |
||
27392 | } |
||
27393 | |||
27394 | SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27395 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27396 | return Create(Ctx, SuccessValue, Args, ArgsSize, I); |
||
27397 | } |
||
27398 | |||
27399 | SharedTrylockFunctionAttr::SharedTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27400 | , Expr * SuccessValue |
||
27401 | , Expr * *Args, unsigned ArgsSize |
||
27402 | ) |
||
27403 | : InheritableAttr(Ctx, CommonInfo, attr::SharedTrylockFunction, true, true) |
||
27404 | , successValue(SuccessValue) |
||
27405 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
27406 | { |
||
27407 | std::copy(Args, Args + args_Size, args_); |
||
27408 | } |
||
27409 | |||
27410 | SharedTrylockFunctionAttr::SharedTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27411 | , Expr * SuccessValue |
||
27412 | ) |
||
27413 | : InheritableAttr(Ctx, CommonInfo, attr::SharedTrylockFunction, true, true) |
||
27414 | , successValue(SuccessValue) |
||
27415 | , args_Size(0), args_(nullptr) |
||
27416 | { |
||
27417 | } |
||
27418 | |||
27419 | |||
27420 | |||
27421 | |||
27422 | |||
27423 | SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::clone(ASTContext &C) const { |
||
27424 | auto *A = new (C) SharedTrylockFunctionAttr(C, *this, successValue, args_, args_Size); |
||
27425 | A->Inherited = Inherited; |
||
27426 | A->IsPackExpansion = IsPackExpansion; |
||
27427 | A->setImplicit(Implicit); |
||
27428 | return A; |
||
27429 | } |
||
27430 | |||
27431 | void SharedTrylockFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27432 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27433 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27434 | switch (getAttributeSpellingListIndex()) { |
||
27435 | default: |
||
27436 | llvm_unreachable("Unknown attribute spelling!"); |
||
27437 | break; |
||
27438 | case 0 : { |
||
27439 | OS << " __attribute__((shared_trylock_function"; |
||
27440 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27441 | OS << ""; |
||
27442 | getSuccessValue()->printPretty(OS, nullptr, Policy); |
||
27443 | OS << ""; |
||
27444 | OS << ""; |
||
27445 | for (const auto &Val : args()) { |
||
27446 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27447 | OS << Val; |
||
27448 | } |
||
27449 | OS << ""; |
||
27450 | if (!IsFirstArgument) |
||
27451 | OS << ")"; |
||
27452 | OS << "))"; |
||
27453 | break; |
||
27454 | } |
||
27455 | } |
||
27456 | } |
||
27457 | |||
27458 | const char *SharedTrylockFunctionAttr::getSpelling() const { |
||
27459 | switch (getAttributeSpellingListIndex()) { |
||
27460 | default: |
||
27461 | llvm_unreachable("Unknown attribute spelling!"); |
||
27462 | return "(No spelling)"; |
||
27463 | case 0: |
||
27464 | return "shared_trylock_function"; |
||
27465 | } |
||
27466 | } |
||
27467 | |||
27468 | |||
27469 | // SpeculativeLoadHardeningAttr implementation |
||
27470 | |||
27471 | SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27472 | auto *A = new (Ctx) SpeculativeLoadHardeningAttr(Ctx, CommonInfo); |
||
27473 | A->setImplicit(true); |
||
27474 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27475 | A->setAttributeSpellingListIndex(0); |
||
27476 | return A; |
||
27477 | } |
||
27478 | |||
27479 | SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27480 | auto *A = new (Ctx) SpeculativeLoadHardeningAttr(Ctx, CommonInfo); |
||
27481 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27482 | A->setAttributeSpellingListIndex(0); |
||
27483 | return A; |
||
27484 | } |
||
27485 | |||
27486 | SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27487 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27488 | return CreateImplicit(Ctx, I); |
||
27489 | } |
||
27490 | |||
27491 | SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27492 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27493 | return Create(Ctx, I); |
||
27494 | } |
||
27495 | |||
27496 | SpeculativeLoadHardeningAttr::SpeculativeLoadHardeningAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27497 | ) |
||
27498 | : InheritableAttr(Ctx, CommonInfo, attr::SpeculativeLoadHardening, false, false) |
||
27499 | { |
||
27500 | } |
||
27501 | |||
27502 | SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::clone(ASTContext &C) const { |
||
27503 | auto *A = new (C) SpeculativeLoadHardeningAttr(C, *this); |
||
27504 | A->Inherited = Inherited; |
||
27505 | A->IsPackExpansion = IsPackExpansion; |
||
27506 | A->setImplicit(Implicit); |
||
27507 | return A; |
||
27508 | } |
||
27509 | |||
27510 | void SpeculativeLoadHardeningAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27511 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27512 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27513 | switch (getAttributeSpellingListIndex()) { |
||
27514 | default: |
||
27515 | llvm_unreachable("Unknown attribute spelling!"); |
||
27516 | break; |
||
27517 | case 0 : { |
||
27518 | OS << " __attribute__((speculative_load_hardening"; |
||
27519 | OS << "))"; |
||
27520 | break; |
||
27521 | } |
||
27522 | case 1 : { |
||
27523 | OS << " [[clang::speculative_load_hardening"; |
||
27524 | OS << "]]"; |
||
27525 | break; |
||
27526 | } |
||
27527 | case 2 : { |
||
27528 | OS << " [[clang::speculative_load_hardening"; |
||
27529 | OS << "]]"; |
||
27530 | break; |
||
27531 | } |
||
27532 | } |
||
27533 | } |
||
27534 | |||
27535 | const char *SpeculativeLoadHardeningAttr::getSpelling() const { |
||
27536 | switch (getAttributeSpellingListIndex()) { |
||
27537 | default: |
||
27538 | llvm_unreachable("Unknown attribute spelling!"); |
||
27539 | return "(No spelling)"; |
||
27540 | case 0: |
||
27541 | return "speculative_load_hardening"; |
||
27542 | case 1: |
||
27543 | return "speculative_load_hardening"; |
||
27544 | case 2: |
||
27545 | return "speculative_load_hardening"; |
||
27546 | } |
||
27547 | } |
||
27548 | |||
27549 | |||
27550 | // StandaloneDebugAttr implementation |
||
27551 | |||
27552 | StandaloneDebugAttr *StandaloneDebugAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27553 | auto *A = new (Ctx) StandaloneDebugAttr(Ctx, CommonInfo); |
||
27554 | A->setImplicit(true); |
||
27555 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27556 | A->setAttributeSpellingListIndex(0); |
||
27557 | return A; |
||
27558 | } |
||
27559 | |||
27560 | StandaloneDebugAttr *StandaloneDebugAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27561 | auto *A = new (Ctx) StandaloneDebugAttr(Ctx, CommonInfo); |
||
27562 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27563 | A->setAttributeSpellingListIndex(0); |
||
27564 | return A; |
||
27565 | } |
||
27566 | |||
27567 | StandaloneDebugAttr *StandaloneDebugAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27568 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27569 | return CreateImplicit(Ctx, I); |
||
27570 | } |
||
27571 | |||
27572 | StandaloneDebugAttr *StandaloneDebugAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27573 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27574 | return Create(Ctx, I); |
||
27575 | } |
||
27576 | |||
27577 | StandaloneDebugAttr::StandaloneDebugAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27578 | ) |
||
27579 | : InheritableAttr(Ctx, CommonInfo, attr::StandaloneDebug, false, false) |
||
27580 | { |
||
27581 | } |
||
27582 | |||
27583 | StandaloneDebugAttr *StandaloneDebugAttr::clone(ASTContext &C) const { |
||
27584 | auto *A = new (C) StandaloneDebugAttr(C, *this); |
||
27585 | A->Inherited = Inherited; |
||
27586 | A->IsPackExpansion = IsPackExpansion; |
||
27587 | A->setImplicit(Implicit); |
||
27588 | return A; |
||
27589 | } |
||
27590 | |||
27591 | void StandaloneDebugAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27592 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27593 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27594 | switch (getAttributeSpellingListIndex()) { |
||
27595 | default: |
||
27596 | llvm_unreachable("Unknown attribute spelling!"); |
||
27597 | break; |
||
27598 | case 0 : { |
||
27599 | OS << " __attribute__((standalone_debug"; |
||
27600 | OS << "))"; |
||
27601 | break; |
||
27602 | } |
||
27603 | case 1 : { |
||
27604 | OS << " [[clang::standalone_debug"; |
||
27605 | OS << "]]"; |
||
27606 | break; |
||
27607 | } |
||
27608 | } |
||
27609 | } |
||
27610 | |||
27611 | const char *StandaloneDebugAttr::getSpelling() const { |
||
27612 | switch (getAttributeSpellingListIndex()) { |
||
27613 | default: |
||
27614 | llvm_unreachable("Unknown attribute spelling!"); |
||
27615 | return "(No spelling)"; |
||
27616 | case 0: |
||
27617 | return "standalone_debug"; |
||
27618 | case 1: |
||
27619 | return "standalone_debug"; |
||
27620 | } |
||
27621 | } |
||
27622 | |||
27623 | |||
27624 | // StdCallAttr implementation |
||
27625 | |||
27626 | StdCallAttr *StdCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27627 | auto *A = new (Ctx) StdCallAttr(Ctx, CommonInfo); |
||
27628 | A->setImplicit(true); |
||
27629 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27630 | A->setAttributeSpellingListIndex(0); |
||
27631 | return A; |
||
27632 | } |
||
27633 | |||
27634 | StdCallAttr *StdCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27635 | auto *A = new (Ctx) StdCallAttr(Ctx, CommonInfo); |
||
27636 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27637 | A->setAttributeSpellingListIndex(0); |
||
27638 | return A; |
||
27639 | } |
||
27640 | |||
27641 | StdCallAttr *StdCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27642 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27643 | return CreateImplicit(Ctx, I); |
||
27644 | } |
||
27645 | |||
27646 | StdCallAttr *StdCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27647 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27648 | return Create(Ctx, I); |
||
27649 | } |
||
27650 | |||
27651 | StdCallAttr::StdCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27652 | ) |
||
27653 | : InheritableAttr(Ctx, CommonInfo, attr::StdCall, false, false) |
||
27654 | { |
||
27655 | } |
||
27656 | |||
27657 | StdCallAttr *StdCallAttr::clone(ASTContext &C) const { |
||
27658 | auto *A = new (C) StdCallAttr(C, *this); |
||
27659 | A->Inherited = Inherited; |
||
27660 | A->IsPackExpansion = IsPackExpansion; |
||
27661 | A->setImplicit(Implicit); |
||
27662 | return A; |
||
27663 | } |
||
27664 | |||
27665 | void StdCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27666 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27667 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27668 | switch (getAttributeSpellingListIndex()) { |
||
27669 | default: |
||
27670 | llvm_unreachable("Unknown attribute spelling!"); |
||
27671 | break; |
||
27672 | case 0 : { |
||
27673 | OS << " __attribute__((stdcall"; |
||
27674 | OS << "))"; |
||
27675 | break; |
||
27676 | } |
||
27677 | case 1 : { |
||
27678 | OS << " [[gnu::stdcall"; |
||
27679 | OS << "]]"; |
||
27680 | break; |
||
27681 | } |
||
27682 | case 2 : { |
||
27683 | OS << " [[gnu::stdcall"; |
||
27684 | OS << "]]"; |
||
27685 | break; |
||
27686 | } |
||
27687 | case 3 : { |
||
27688 | OS << " __stdcall"; |
||
27689 | OS << ""; |
||
27690 | break; |
||
27691 | } |
||
27692 | case 4 : { |
||
27693 | OS << " _stdcall"; |
||
27694 | OS << ""; |
||
27695 | break; |
||
27696 | } |
||
27697 | } |
||
27698 | } |
||
27699 | |||
27700 | const char *StdCallAttr::getSpelling() const { |
||
27701 | switch (getAttributeSpellingListIndex()) { |
||
27702 | default: |
||
27703 | llvm_unreachable("Unknown attribute spelling!"); |
||
27704 | return "(No spelling)"; |
||
27705 | case 0: |
||
27706 | return "stdcall"; |
||
27707 | case 1: |
||
27708 | return "stdcall"; |
||
27709 | case 2: |
||
27710 | return "stdcall"; |
||
27711 | case 3: |
||
27712 | return "__stdcall"; |
||
27713 | case 4: |
||
27714 | return "_stdcall"; |
||
27715 | } |
||
27716 | } |
||
27717 | |||
27718 | |||
27719 | // StrictFPAttr implementation |
||
27720 | |||
27721 | StrictFPAttr *StrictFPAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27722 | auto *A = new (Ctx) StrictFPAttr(Ctx, CommonInfo); |
||
27723 | A->setImplicit(true); |
||
27724 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27725 | A->setAttributeSpellingListIndex(0); |
||
27726 | return A; |
||
27727 | } |
||
27728 | |||
27729 | StrictFPAttr *StrictFPAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27730 | auto *A = new (Ctx) StrictFPAttr(Ctx, CommonInfo); |
||
27731 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27732 | A->setAttributeSpellingListIndex(0); |
||
27733 | return A; |
||
27734 | } |
||
27735 | |||
27736 | StrictFPAttr *StrictFPAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27737 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27738 | return CreateImplicit(Ctx, I); |
||
27739 | } |
||
27740 | |||
27741 | StrictFPAttr *StrictFPAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27742 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27743 | return Create(Ctx, I); |
||
27744 | } |
||
27745 | |||
27746 | StrictFPAttr::StrictFPAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27747 | ) |
||
27748 | : InheritableAttr(Ctx, CommonInfo, attr::StrictFP, false, false) |
||
27749 | { |
||
27750 | } |
||
27751 | |||
27752 | StrictFPAttr *StrictFPAttr::clone(ASTContext &C) const { |
||
27753 | auto *A = new (C) StrictFPAttr(C, *this); |
||
27754 | A->Inherited = Inherited; |
||
27755 | A->IsPackExpansion = IsPackExpansion; |
||
27756 | A->setImplicit(Implicit); |
||
27757 | return A; |
||
27758 | } |
||
27759 | |||
27760 | void StrictFPAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27761 | } |
||
27762 | |||
27763 | const char *StrictFPAttr::getSpelling() const { |
||
27764 | return "(No spelling)"; |
||
27765 | } |
||
27766 | |||
27767 | |||
27768 | // StrictGuardStackCheckAttr implementation |
||
27769 | |||
27770 | StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27771 | auto *A = new (Ctx) StrictGuardStackCheckAttr(Ctx, CommonInfo); |
||
27772 | A->setImplicit(true); |
||
27773 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27774 | A->setAttributeSpellingListIndex(0); |
||
27775 | return A; |
||
27776 | } |
||
27777 | |||
27778 | StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
27779 | auto *A = new (Ctx) StrictGuardStackCheckAttr(Ctx, CommonInfo); |
||
27780 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27781 | A->setAttributeSpellingListIndex(0); |
||
27782 | return A; |
||
27783 | } |
||
27784 | |||
27785 | StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27786 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27787 | return CreateImplicit(Ctx, I); |
||
27788 | } |
||
27789 | |||
27790 | StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27791 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27792 | return Create(Ctx, I); |
||
27793 | } |
||
27794 | |||
27795 | StrictGuardStackCheckAttr::StrictGuardStackCheckAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27796 | ) |
||
27797 | : InheritableAttr(Ctx, CommonInfo, attr::StrictGuardStackCheck, false, false) |
||
27798 | { |
||
27799 | } |
||
27800 | |||
27801 | StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::clone(ASTContext &C) const { |
||
27802 | auto *A = new (C) StrictGuardStackCheckAttr(C, *this); |
||
27803 | A->Inherited = Inherited; |
||
27804 | A->IsPackExpansion = IsPackExpansion; |
||
27805 | A->setImplicit(Implicit); |
||
27806 | return A; |
||
27807 | } |
||
27808 | |||
27809 | void StrictGuardStackCheckAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27810 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27811 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27812 | switch (getAttributeSpellingListIndex()) { |
||
27813 | default: |
||
27814 | llvm_unreachable("Unknown attribute spelling!"); |
||
27815 | break; |
||
27816 | case 0 : { |
||
27817 | OS << " __declspec(strict_gs_check"; |
||
27818 | OS << ")"; |
||
27819 | break; |
||
27820 | } |
||
27821 | } |
||
27822 | } |
||
27823 | |||
27824 | const char *StrictGuardStackCheckAttr::getSpelling() const { |
||
27825 | switch (getAttributeSpellingListIndex()) { |
||
27826 | default: |
||
27827 | llvm_unreachable("Unknown attribute spelling!"); |
||
27828 | return "(No spelling)"; |
||
27829 | case 0: |
||
27830 | return "strict_gs_check"; |
||
27831 | } |
||
27832 | } |
||
27833 | |||
27834 | |||
27835 | // SuppressAttr implementation |
||
27836 | |||
27837 | SuppressAttr *SuppressAttr::CreateImplicit(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, const AttributeCommonInfo &CommonInfo) { |
||
27838 | auto *A = new (Ctx) SuppressAttr(Ctx, CommonInfo, DiagnosticIdentifiers, DiagnosticIdentifiersSize); |
||
27839 | A->setImplicit(true); |
||
27840 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27841 | A->setAttributeSpellingListIndex(0); |
||
27842 | return A; |
||
27843 | } |
||
27844 | |||
27845 | SuppressAttr *SuppressAttr::Create(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, const AttributeCommonInfo &CommonInfo) { |
||
27846 | auto *A = new (Ctx) SuppressAttr(Ctx, CommonInfo, DiagnosticIdentifiers, DiagnosticIdentifiersSize); |
||
27847 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27848 | A->setAttributeSpellingListIndex(0); |
||
27849 | return A; |
||
27850 | } |
||
27851 | |||
27852 | SuppressAttr *SuppressAttr::CreateImplicit(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27853 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27854 | return CreateImplicit(Ctx, DiagnosticIdentifiers, DiagnosticIdentifiersSize, I); |
||
27855 | } |
||
27856 | |||
27857 | SuppressAttr *SuppressAttr::Create(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27858 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27859 | return Create(Ctx, DiagnosticIdentifiers, DiagnosticIdentifiersSize, I); |
||
27860 | } |
||
27861 | |||
27862 | SuppressAttr::SuppressAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27863 | , StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize |
||
27864 | ) |
||
27865 | : StmtAttr(Ctx, CommonInfo, attr::Suppress, false) |
||
27866 | , diagnosticIdentifiers_Size(DiagnosticIdentifiersSize), diagnosticIdentifiers_(new (Ctx, 16) StringRef[diagnosticIdentifiers_Size]) |
||
27867 | { |
||
27868 | for (size_t I = 0, E = diagnosticIdentifiers_Size; I != E; |
||
27869 | ++I) { |
||
27870 | StringRef Ref = DiagnosticIdentifiers[I]; |
||
27871 | if (!Ref.empty()) { |
||
27872 | char *Mem = new (Ctx, 1) char[Ref.size()]; |
||
27873 | std::memcpy(Mem, Ref.data(), Ref.size()); |
||
27874 | diagnosticIdentifiers_[I] = StringRef(Mem, Ref.size()); |
||
27875 | } |
||
27876 | } |
||
27877 | } |
||
27878 | |||
27879 | SuppressAttr::SuppressAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27880 | ) |
||
27881 | : StmtAttr(Ctx, CommonInfo, attr::Suppress, false) |
||
27882 | , diagnosticIdentifiers_Size(0), diagnosticIdentifiers_(nullptr) |
||
27883 | { |
||
27884 | } |
||
27885 | |||
27886 | |||
27887 | |||
27888 | SuppressAttr *SuppressAttr::clone(ASTContext &C) const { |
||
27889 | auto *A = new (C) SuppressAttr(C, *this, diagnosticIdentifiers_, diagnosticIdentifiers_Size); |
||
27890 | A->Inherited = Inherited; |
||
27891 | A->IsPackExpansion = IsPackExpansion; |
||
27892 | A->setImplicit(Implicit); |
||
27893 | return A; |
||
27894 | } |
||
27895 | |||
27896 | void SuppressAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
27897 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
27898 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
27899 | switch (getAttributeSpellingListIndex()) { |
||
27900 | default: |
||
27901 | llvm_unreachable("Unknown attribute spelling!"); |
||
27902 | break; |
||
27903 | case 0 : { |
||
27904 | OS << " [[gsl::suppress"; |
||
27905 | OS << ""; |
||
27906 | for (const auto &Val : diagnosticIdentifiers()) { |
||
27907 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
27908 | OS << "\"" << Val << "\""; |
||
27909 | } |
||
27910 | OS << ""; |
||
27911 | if (!IsFirstArgument) |
||
27912 | OS << ")"; |
||
27913 | OS << "]]"; |
||
27914 | break; |
||
27915 | } |
||
27916 | } |
||
27917 | } |
||
27918 | |||
27919 | const char *SuppressAttr::getSpelling() const { |
||
27920 | switch (getAttributeSpellingListIndex()) { |
||
27921 | default: |
||
27922 | llvm_unreachable("Unknown attribute spelling!"); |
||
27923 | return "(No spelling)"; |
||
27924 | case 0: |
||
27925 | return "suppress"; |
||
27926 | } |
||
27927 | } |
||
27928 | |||
27929 | |||
27930 | // SwiftAsyncAttr implementation |
||
27931 | |||
27932 | SwiftAsyncAttr *SwiftAsyncAttr::CreateImplicit(ASTContext &Ctx, Kind Kind, ParamIdx CompletionHandlerIndex, const AttributeCommonInfo &CommonInfo) { |
||
27933 | auto *A = new (Ctx) SwiftAsyncAttr(Ctx, CommonInfo, Kind, CompletionHandlerIndex); |
||
27934 | A->setImplicit(true); |
||
27935 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27936 | A->setAttributeSpellingListIndex(0); |
||
27937 | return A; |
||
27938 | } |
||
27939 | |||
27940 | SwiftAsyncAttr *SwiftAsyncAttr::Create(ASTContext &Ctx, Kind Kind, ParamIdx CompletionHandlerIndex, const AttributeCommonInfo &CommonInfo) { |
||
27941 | auto *A = new (Ctx) SwiftAsyncAttr(Ctx, CommonInfo, Kind, CompletionHandlerIndex); |
||
27942 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
27943 | A->setAttributeSpellingListIndex(0); |
||
27944 | return A; |
||
27945 | } |
||
27946 | |||
27947 | SwiftAsyncAttr *SwiftAsyncAttr::CreateImplicit(ASTContext &Ctx, Kind Kind, ParamIdx CompletionHandlerIndex, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27948 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27949 | return CreateImplicit(Ctx, Kind, CompletionHandlerIndex, I); |
||
27950 | } |
||
27951 | |||
27952 | SwiftAsyncAttr *SwiftAsyncAttr::Create(ASTContext &Ctx, Kind Kind, ParamIdx CompletionHandlerIndex, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
27953 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
27954 | return Create(Ctx, Kind, CompletionHandlerIndex, I); |
||
27955 | } |
||
27956 | |||
27957 | SwiftAsyncAttr::SwiftAsyncAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27958 | , Kind Kind |
||
27959 | , ParamIdx CompletionHandlerIndex |
||
27960 | ) |
||
27961 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsync, false, false) |
||
27962 | , kind(Kind) |
||
27963 | , completionHandlerIndex(CompletionHandlerIndex) |
||
27964 | { |
||
27965 | } |
||
27966 | |||
27967 | SwiftAsyncAttr::SwiftAsyncAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
27968 | , Kind Kind |
||
27969 | ) |
||
27970 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsync, false, false) |
||
27971 | , kind(Kind) |
||
27972 | , completionHandlerIndex() |
||
27973 | { |
||
27974 | } |
||
27975 | |||
27976 | |||
27977 | |||
27978 | bool SwiftAsyncAttr::ConvertStrToKind(StringRef Val, Kind &Out) { |
||
27979 | std::optional<Kind> R = llvm::StringSwitch<std::optional<Kind>>(Val) |
||
27980 | .Case("none", SwiftAsyncAttr::None) |
||
27981 | .Case("swift_private", SwiftAsyncAttr::SwiftPrivate) |
||
27982 | .Case("not_swift_private", SwiftAsyncAttr::NotSwiftPrivate) |
||
27983 | .Default(std::optional<Kind>()); |
||
27984 | if (R) { |
||
27985 | Out = *R; |
||
27986 | return true; |
||
27987 | } |
||
27988 | return false; |
||
27989 | } |
||
27990 | |||
27991 | const char *SwiftAsyncAttr::ConvertKindToStr(Kind Val) { |
||
27992 | switch(Val) { |
||
27993 | case SwiftAsyncAttr::None: return "none"; |
||
27994 | case SwiftAsyncAttr::SwiftPrivate: return "swift_private"; |
||
27995 | case SwiftAsyncAttr::NotSwiftPrivate: return "not_swift_private"; |
||
27996 | } |
||
27997 | llvm_unreachable("No enumerator with that value"); |
||
27998 | } |
||
27999 | |||
28000 | |||
28001 | SwiftAsyncAttr *SwiftAsyncAttr::clone(ASTContext &C) const { |
||
28002 | auto *A = new (C) SwiftAsyncAttr(C, *this, kind, completionHandlerIndex); |
||
28003 | A->Inherited = Inherited; |
||
28004 | A->IsPackExpansion = IsPackExpansion; |
||
28005 | A->setImplicit(Implicit); |
||
28006 | return A; |
||
28007 | } |
||
28008 | |||
28009 | void SwiftAsyncAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28010 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28011 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28012 | switch (getAttributeSpellingListIndex()) { |
||
28013 | default: |
||
28014 | llvm_unreachable("Unknown attribute spelling!"); |
||
28015 | break; |
||
28016 | case 0 : { |
||
28017 | OS << " __attribute__((swift_async"; |
||
28018 | if (!getCompletionHandlerIndex().isValid()) |
||
28019 | ++TrailingOmittedArgs; |
||
28020 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28021 | OS << "\"" << SwiftAsyncAttr::ConvertKindToStr(getKind()) << "\""; |
||
28022 | if (!(!getCompletionHandlerIndex().isValid())) { |
||
28023 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28024 | OS << "" << getCompletionHandlerIndex().getSourceIndex() << ""; |
||
28025 | } |
||
28026 | if (!IsFirstArgument) |
||
28027 | OS << ")"; |
||
28028 | OS << "))"; |
||
28029 | break; |
||
28030 | } |
||
28031 | case 1 : { |
||
28032 | OS << " [[clang::swift_async"; |
||
28033 | if (!getCompletionHandlerIndex().isValid()) |
||
28034 | ++TrailingOmittedArgs; |
||
28035 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28036 | OS << "\"" << SwiftAsyncAttr::ConvertKindToStr(getKind()) << "\""; |
||
28037 | if (!(!getCompletionHandlerIndex().isValid())) { |
||
28038 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28039 | OS << "" << getCompletionHandlerIndex().getSourceIndex() << ""; |
||
28040 | } |
||
28041 | if (!IsFirstArgument) |
||
28042 | OS << ")"; |
||
28043 | OS << "]]"; |
||
28044 | break; |
||
28045 | } |
||
28046 | case 2 : { |
||
28047 | OS << " [[clang::swift_async"; |
||
28048 | if (!getCompletionHandlerIndex().isValid()) |
||
28049 | ++TrailingOmittedArgs; |
||
28050 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28051 | OS << "\"" << SwiftAsyncAttr::ConvertKindToStr(getKind()) << "\""; |
||
28052 | if (!(!getCompletionHandlerIndex().isValid())) { |
||
28053 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28054 | OS << "" << getCompletionHandlerIndex().getSourceIndex() << ""; |
||
28055 | } |
||
28056 | if (!IsFirstArgument) |
||
28057 | OS << ")"; |
||
28058 | OS << "]]"; |
||
28059 | break; |
||
28060 | } |
||
28061 | } |
||
28062 | } |
||
28063 | |||
28064 | const char *SwiftAsyncAttr::getSpelling() const { |
||
28065 | switch (getAttributeSpellingListIndex()) { |
||
28066 | default: |
||
28067 | llvm_unreachable("Unknown attribute spelling!"); |
||
28068 | return "(No spelling)"; |
||
28069 | case 0: |
||
28070 | return "swift_async"; |
||
28071 | case 1: |
||
28072 | return "swift_async"; |
||
28073 | case 2: |
||
28074 | return "swift_async"; |
||
28075 | } |
||
28076 | } |
||
28077 | |||
28078 | |||
28079 | // SwiftAsyncCallAttr implementation |
||
28080 | |||
28081 | SwiftAsyncCallAttr *SwiftAsyncCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28082 | auto *A = new (Ctx) SwiftAsyncCallAttr(Ctx, CommonInfo); |
||
28083 | A->setImplicit(true); |
||
28084 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28085 | A->setAttributeSpellingListIndex(0); |
||
28086 | return A; |
||
28087 | } |
||
28088 | |||
28089 | SwiftAsyncCallAttr *SwiftAsyncCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28090 | auto *A = new (Ctx) SwiftAsyncCallAttr(Ctx, CommonInfo); |
||
28091 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28092 | A->setAttributeSpellingListIndex(0); |
||
28093 | return A; |
||
28094 | } |
||
28095 | |||
28096 | SwiftAsyncCallAttr *SwiftAsyncCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28097 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28098 | return CreateImplicit(Ctx, I); |
||
28099 | } |
||
28100 | |||
28101 | SwiftAsyncCallAttr *SwiftAsyncCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28102 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28103 | return Create(Ctx, I); |
||
28104 | } |
||
28105 | |||
28106 | SwiftAsyncCallAttr::SwiftAsyncCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28107 | ) |
||
28108 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncCall, false, false) |
||
28109 | { |
||
28110 | } |
||
28111 | |||
28112 | SwiftAsyncCallAttr *SwiftAsyncCallAttr::clone(ASTContext &C) const { |
||
28113 | auto *A = new (C) SwiftAsyncCallAttr(C, *this); |
||
28114 | A->Inherited = Inherited; |
||
28115 | A->IsPackExpansion = IsPackExpansion; |
||
28116 | A->setImplicit(Implicit); |
||
28117 | return A; |
||
28118 | } |
||
28119 | |||
28120 | void SwiftAsyncCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28121 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28122 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28123 | switch (getAttributeSpellingListIndex()) { |
||
28124 | default: |
||
28125 | llvm_unreachable("Unknown attribute spelling!"); |
||
28126 | break; |
||
28127 | case 0 : { |
||
28128 | OS << " __attribute__((swiftasynccall"; |
||
28129 | OS << "))"; |
||
28130 | break; |
||
28131 | } |
||
28132 | case 1 : { |
||
28133 | OS << " [[clang::swiftasynccall"; |
||
28134 | OS << "]]"; |
||
28135 | break; |
||
28136 | } |
||
28137 | case 2 : { |
||
28138 | OS << " [[clang::swiftasynccall"; |
||
28139 | OS << "]]"; |
||
28140 | break; |
||
28141 | } |
||
28142 | } |
||
28143 | } |
||
28144 | |||
28145 | const char *SwiftAsyncCallAttr::getSpelling() const { |
||
28146 | switch (getAttributeSpellingListIndex()) { |
||
28147 | default: |
||
28148 | llvm_unreachable("Unknown attribute spelling!"); |
||
28149 | return "(No spelling)"; |
||
28150 | case 0: |
||
28151 | return "swiftasynccall"; |
||
28152 | case 1: |
||
28153 | return "swiftasynccall"; |
||
28154 | case 2: |
||
28155 | return "swiftasynccall"; |
||
28156 | } |
||
28157 | } |
||
28158 | |||
28159 | |||
28160 | // SwiftAsyncContextAttr implementation |
||
28161 | |||
28162 | SwiftAsyncContextAttr *SwiftAsyncContextAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28163 | auto *A = new (Ctx) SwiftAsyncContextAttr(Ctx, CommonInfo); |
||
28164 | A->setImplicit(true); |
||
28165 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28166 | A->setAttributeSpellingListIndex(0); |
||
28167 | return A; |
||
28168 | } |
||
28169 | |||
28170 | SwiftAsyncContextAttr *SwiftAsyncContextAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28171 | auto *A = new (Ctx) SwiftAsyncContextAttr(Ctx, CommonInfo); |
||
28172 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28173 | A->setAttributeSpellingListIndex(0); |
||
28174 | return A; |
||
28175 | } |
||
28176 | |||
28177 | SwiftAsyncContextAttr *SwiftAsyncContextAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28178 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28179 | return CreateImplicit(Ctx, I); |
||
28180 | } |
||
28181 | |||
28182 | SwiftAsyncContextAttr *SwiftAsyncContextAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28183 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28184 | return Create(Ctx, I); |
||
28185 | } |
||
28186 | |||
28187 | SwiftAsyncContextAttr::SwiftAsyncContextAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28188 | ) |
||
28189 | : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftAsyncContext, false, false) |
||
28190 | { |
||
28191 | } |
||
28192 | |||
28193 | SwiftAsyncContextAttr *SwiftAsyncContextAttr::clone(ASTContext &C) const { |
||
28194 | auto *A = new (C) SwiftAsyncContextAttr(C, *this); |
||
28195 | A->Inherited = Inherited; |
||
28196 | A->IsPackExpansion = IsPackExpansion; |
||
28197 | A->setImplicit(Implicit); |
||
28198 | return A; |
||
28199 | } |
||
28200 | |||
28201 | void SwiftAsyncContextAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28202 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28203 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28204 | switch (getAttributeSpellingListIndex()) { |
||
28205 | default: |
||
28206 | llvm_unreachable("Unknown attribute spelling!"); |
||
28207 | break; |
||
28208 | case 0 : { |
||
28209 | OS << " __attribute__((swift_async_context"; |
||
28210 | OS << "))"; |
||
28211 | break; |
||
28212 | } |
||
28213 | case 1 : { |
||
28214 | OS << " [[clang::swift_async_context"; |
||
28215 | OS << "]]"; |
||
28216 | break; |
||
28217 | } |
||
28218 | case 2 : { |
||
28219 | OS << " [[clang::swift_async_context"; |
||
28220 | OS << "]]"; |
||
28221 | break; |
||
28222 | } |
||
28223 | } |
||
28224 | } |
||
28225 | |||
28226 | const char *SwiftAsyncContextAttr::getSpelling() const { |
||
28227 | switch (getAttributeSpellingListIndex()) { |
||
28228 | default: |
||
28229 | llvm_unreachable("Unknown attribute spelling!"); |
||
28230 | return "(No spelling)"; |
||
28231 | case 0: |
||
28232 | return "swift_async_context"; |
||
28233 | case 1: |
||
28234 | return "swift_async_context"; |
||
28235 | case 2: |
||
28236 | return "swift_async_context"; |
||
28237 | } |
||
28238 | } |
||
28239 | |||
28240 | |||
28241 | // SwiftAsyncErrorAttr implementation |
||
28242 | |||
28243 | SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::CreateImplicit(ASTContext &Ctx, ConventionKind Convention, unsigned HandlerParamIdx, const AttributeCommonInfo &CommonInfo) { |
||
28244 | auto *A = new (Ctx) SwiftAsyncErrorAttr(Ctx, CommonInfo, Convention, HandlerParamIdx); |
||
28245 | A->setImplicit(true); |
||
28246 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28247 | A->setAttributeSpellingListIndex(0); |
||
28248 | return A; |
||
28249 | } |
||
28250 | |||
28251 | SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::Create(ASTContext &Ctx, ConventionKind Convention, unsigned HandlerParamIdx, const AttributeCommonInfo &CommonInfo) { |
||
28252 | auto *A = new (Ctx) SwiftAsyncErrorAttr(Ctx, CommonInfo, Convention, HandlerParamIdx); |
||
28253 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28254 | A->setAttributeSpellingListIndex(0); |
||
28255 | return A; |
||
28256 | } |
||
28257 | |||
28258 | SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::CreateImplicit(ASTContext &Ctx, ConventionKind Convention, unsigned HandlerParamIdx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28259 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28260 | return CreateImplicit(Ctx, Convention, HandlerParamIdx, I); |
||
28261 | } |
||
28262 | |||
28263 | SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::Create(ASTContext &Ctx, ConventionKind Convention, unsigned HandlerParamIdx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28264 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28265 | return Create(Ctx, Convention, HandlerParamIdx, I); |
||
28266 | } |
||
28267 | |||
28268 | SwiftAsyncErrorAttr::SwiftAsyncErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28269 | , ConventionKind Convention |
||
28270 | , unsigned HandlerParamIdx |
||
28271 | ) |
||
28272 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncError, false, false) |
||
28273 | , convention(Convention) |
||
28274 | , handlerParamIdx(HandlerParamIdx) |
||
28275 | { |
||
28276 | } |
||
28277 | |||
28278 | SwiftAsyncErrorAttr::SwiftAsyncErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28279 | , ConventionKind Convention |
||
28280 | ) |
||
28281 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncError, false, false) |
||
28282 | , convention(Convention) |
||
28283 | , handlerParamIdx() |
||
28284 | { |
||
28285 | } |
||
28286 | |||
28287 | |||
28288 | |||
28289 | bool SwiftAsyncErrorAttr::ConvertStrToConventionKind(StringRef Val, ConventionKind &Out) { |
||
28290 | std::optional<ConventionKind> R = llvm::StringSwitch<std::optional<ConventionKind>>(Val) |
||
28291 | .Case("none", SwiftAsyncErrorAttr::None) |
||
28292 | .Case("nonnull_error", SwiftAsyncErrorAttr::NonNullError) |
||
28293 | .Case("zero_argument", SwiftAsyncErrorAttr::ZeroArgument) |
||
28294 | .Case("nonzero_argument", SwiftAsyncErrorAttr::NonZeroArgument) |
||
28295 | .Default(std::optional<ConventionKind>()); |
||
28296 | if (R) { |
||
28297 | Out = *R; |
||
28298 | return true; |
||
28299 | } |
||
28300 | return false; |
||
28301 | } |
||
28302 | |||
28303 | const char *SwiftAsyncErrorAttr::ConvertConventionKindToStr(ConventionKind Val) { |
||
28304 | switch(Val) { |
||
28305 | case SwiftAsyncErrorAttr::None: return "none"; |
||
28306 | case SwiftAsyncErrorAttr::NonNullError: return "nonnull_error"; |
||
28307 | case SwiftAsyncErrorAttr::ZeroArgument: return "zero_argument"; |
||
28308 | case SwiftAsyncErrorAttr::NonZeroArgument: return "nonzero_argument"; |
||
28309 | } |
||
28310 | llvm_unreachable("No enumerator with that value"); |
||
28311 | } |
||
28312 | |||
28313 | |||
28314 | SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::clone(ASTContext &C) const { |
||
28315 | auto *A = new (C) SwiftAsyncErrorAttr(C, *this, convention, handlerParamIdx); |
||
28316 | A->Inherited = Inherited; |
||
28317 | A->IsPackExpansion = IsPackExpansion; |
||
28318 | A->setImplicit(Implicit); |
||
28319 | return A; |
||
28320 | } |
||
28321 | |||
28322 | void SwiftAsyncErrorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28323 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28324 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28325 | switch (getAttributeSpellingListIndex()) { |
||
28326 | default: |
||
28327 | llvm_unreachable("Unknown attribute spelling!"); |
||
28328 | break; |
||
28329 | case 0 : { |
||
28330 | OS << " __attribute__((swift_async_error"; |
||
28331 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28332 | OS << "\"" << SwiftAsyncErrorAttr::ConvertConventionKindToStr(getConvention()) << "\""; |
||
28333 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28334 | OS << "" << getHandlerParamIdx() << ""; |
||
28335 | if (!IsFirstArgument) |
||
28336 | OS << ")"; |
||
28337 | OS << "))"; |
||
28338 | break; |
||
28339 | } |
||
28340 | case 1 : { |
||
28341 | OS << " [[clang::swift_async_error"; |
||
28342 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28343 | OS << "\"" << SwiftAsyncErrorAttr::ConvertConventionKindToStr(getConvention()) << "\""; |
||
28344 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28345 | OS << "" << getHandlerParamIdx() << ""; |
||
28346 | if (!IsFirstArgument) |
||
28347 | OS << ")"; |
||
28348 | OS << "]]"; |
||
28349 | break; |
||
28350 | } |
||
28351 | case 2 : { |
||
28352 | OS << " [[clang::swift_async_error"; |
||
28353 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28354 | OS << "\"" << SwiftAsyncErrorAttr::ConvertConventionKindToStr(getConvention()) << "\""; |
||
28355 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28356 | OS << "" << getHandlerParamIdx() << ""; |
||
28357 | if (!IsFirstArgument) |
||
28358 | OS << ")"; |
||
28359 | OS << "]]"; |
||
28360 | break; |
||
28361 | } |
||
28362 | } |
||
28363 | } |
||
28364 | |||
28365 | const char *SwiftAsyncErrorAttr::getSpelling() const { |
||
28366 | switch (getAttributeSpellingListIndex()) { |
||
28367 | default: |
||
28368 | llvm_unreachable("Unknown attribute spelling!"); |
||
28369 | return "(No spelling)"; |
||
28370 | case 0: |
||
28371 | return "swift_async_error"; |
||
28372 | case 1: |
||
28373 | return "swift_async_error"; |
||
28374 | case 2: |
||
28375 | return "swift_async_error"; |
||
28376 | } |
||
28377 | } |
||
28378 | |||
28379 | |||
28380 | // SwiftAsyncNameAttr implementation |
||
28381 | |||
28382 | SwiftAsyncNameAttr *SwiftAsyncNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
28383 | auto *A = new (Ctx) SwiftAsyncNameAttr(Ctx, CommonInfo, Name); |
||
28384 | A->setImplicit(true); |
||
28385 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28386 | A->setAttributeSpellingListIndex(0); |
||
28387 | return A; |
||
28388 | } |
||
28389 | |||
28390 | SwiftAsyncNameAttr *SwiftAsyncNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
28391 | auto *A = new (Ctx) SwiftAsyncNameAttr(Ctx, CommonInfo, Name); |
||
28392 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28393 | A->setAttributeSpellingListIndex(0); |
||
28394 | return A; |
||
28395 | } |
||
28396 | |||
28397 | SwiftAsyncNameAttr *SwiftAsyncNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28398 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28399 | return CreateImplicit(Ctx, Name, I); |
||
28400 | } |
||
28401 | |||
28402 | SwiftAsyncNameAttr *SwiftAsyncNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28403 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28404 | return Create(Ctx, Name, I); |
||
28405 | } |
||
28406 | |||
28407 | SwiftAsyncNameAttr::SwiftAsyncNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28408 | , llvm::StringRef Name |
||
28409 | ) |
||
28410 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncName, false, false) |
||
28411 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
28412 | { |
||
28413 | if (!Name.empty()) |
||
28414 | std::memcpy(name, Name.data(), nameLength); |
||
28415 | } |
||
28416 | |||
28417 | |||
28418 | |||
28419 | SwiftAsyncNameAttr *SwiftAsyncNameAttr::clone(ASTContext &C) const { |
||
28420 | auto *A = new (C) SwiftAsyncNameAttr(C, *this, getName()); |
||
28421 | A->Inherited = Inherited; |
||
28422 | A->IsPackExpansion = IsPackExpansion; |
||
28423 | A->setImplicit(Implicit); |
||
28424 | return A; |
||
28425 | } |
||
28426 | |||
28427 | void SwiftAsyncNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28428 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28429 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28430 | switch (getAttributeSpellingListIndex()) { |
||
28431 | default: |
||
28432 | llvm_unreachable("Unknown attribute spelling!"); |
||
28433 | break; |
||
28434 | case 0 : { |
||
28435 | OS << " __attribute__((swift_async_name"; |
||
28436 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28437 | OS << "\"" << getName() << "\""; |
||
28438 | if (!IsFirstArgument) |
||
28439 | OS << ")"; |
||
28440 | OS << "))"; |
||
28441 | break; |
||
28442 | } |
||
28443 | } |
||
28444 | } |
||
28445 | |||
28446 | const char *SwiftAsyncNameAttr::getSpelling() const { |
||
28447 | switch (getAttributeSpellingListIndex()) { |
||
28448 | default: |
||
28449 | llvm_unreachable("Unknown attribute spelling!"); |
||
28450 | return "(No spelling)"; |
||
28451 | case 0: |
||
28452 | return "swift_async_name"; |
||
28453 | } |
||
28454 | } |
||
28455 | |||
28456 | |||
28457 | // SwiftAttrAttr implementation |
||
28458 | |||
28459 | SwiftAttrAttr *SwiftAttrAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Attribute, const AttributeCommonInfo &CommonInfo) { |
||
28460 | auto *A = new (Ctx) SwiftAttrAttr(Ctx, CommonInfo, Attribute); |
||
28461 | A->setImplicit(true); |
||
28462 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28463 | A->setAttributeSpellingListIndex(0); |
||
28464 | return A; |
||
28465 | } |
||
28466 | |||
28467 | SwiftAttrAttr *SwiftAttrAttr::Create(ASTContext &Ctx, llvm::StringRef Attribute, const AttributeCommonInfo &CommonInfo) { |
||
28468 | auto *A = new (Ctx) SwiftAttrAttr(Ctx, CommonInfo, Attribute); |
||
28469 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28470 | A->setAttributeSpellingListIndex(0); |
||
28471 | return A; |
||
28472 | } |
||
28473 | |||
28474 | SwiftAttrAttr *SwiftAttrAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Attribute, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28475 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28476 | return CreateImplicit(Ctx, Attribute, I); |
||
28477 | } |
||
28478 | |||
28479 | SwiftAttrAttr *SwiftAttrAttr::Create(ASTContext &Ctx, llvm::StringRef Attribute, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28480 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28481 | return Create(Ctx, Attribute, I); |
||
28482 | } |
||
28483 | |||
28484 | SwiftAttrAttr::SwiftAttrAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28485 | , llvm::StringRef Attribute |
||
28486 | ) |
||
28487 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftAttr, false, false) |
||
28488 | , attributeLength(Attribute.size()),attribute(new (Ctx, 1) char[attributeLength]) |
||
28489 | { |
||
28490 | if (!Attribute.empty()) |
||
28491 | std::memcpy(attribute, Attribute.data(), attributeLength); |
||
28492 | } |
||
28493 | |||
28494 | |||
28495 | |||
28496 | SwiftAttrAttr *SwiftAttrAttr::clone(ASTContext &C) const { |
||
28497 | auto *A = new (C) SwiftAttrAttr(C, *this, getAttribute()); |
||
28498 | A->Inherited = Inherited; |
||
28499 | A->IsPackExpansion = IsPackExpansion; |
||
28500 | A->setImplicit(Implicit); |
||
28501 | return A; |
||
28502 | } |
||
28503 | |||
28504 | void SwiftAttrAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28505 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28506 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28507 | switch (getAttributeSpellingListIndex()) { |
||
28508 | default: |
||
28509 | llvm_unreachable("Unknown attribute spelling!"); |
||
28510 | break; |
||
28511 | case 0 : { |
||
28512 | OS << " __attribute__((swift_attr"; |
||
28513 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28514 | OS << "\"" << getAttribute() << "\""; |
||
28515 | if (!IsFirstArgument) |
||
28516 | OS << ")"; |
||
28517 | OS << "))"; |
||
28518 | break; |
||
28519 | } |
||
28520 | } |
||
28521 | } |
||
28522 | |||
28523 | const char *SwiftAttrAttr::getSpelling() const { |
||
28524 | switch (getAttributeSpellingListIndex()) { |
||
28525 | default: |
||
28526 | llvm_unreachable("Unknown attribute spelling!"); |
||
28527 | return "(No spelling)"; |
||
28528 | case 0: |
||
28529 | return "swift_attr"; |
||
28530 | } |
||
28531 | } |
||
28532 | |||
28533 | |||
28534 | // SwiftBridgeAttr implementation |
||
28535 | |||
28536 | SwiftBridgeAttr *SwiftBridgeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef SwiftType, const AttributeCommonInfo &CommonInfo) { |
||
28537 | auto *A = new (Ctx) SwiftBridgeAttr(Ctx, CommonInfo, SwiftType); |
||
28538 | A->setImplicit(true); |
||
28539 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28540 | A->setAttributeSpellingListIndex(0); |
||
28541 | return A; |
||
28542 | } |
||
28543 | |||
28544 | SwiftBridgeAttr *SwiftBridgeAttr::Create(ASTContext &Ctx, llvm::StringRef SwiftType, const AttributeCommonInfo &CommonInfo) { |
||
28545 | auto *A = new (Ctx) SwiftBridgeAttr(Ctx, CommonInfo, SwiftType); |
||
28546 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28547 | A->setAttributeSpellingListIndex(0); |
||
28548 | return A; |
||
28549 | } |
||
28550 | |||
28551 | SwiftBridgeAttr *SwiftBridgeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef SwiftType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28552 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28553 | return CreateImplicit(Ctx, SwiftType, I); |
||
28554 | } |
||
28555 | |||
28556 | SwiftBridgeAttr *SwiftBridgeAttr::Create(ASTContext &Ctx, llvm::StringRef SwiftType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28557 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28558 | return Create(Ctx, SwiftType, I); |
||
28559 | } |
||
28560 | |||
28561 | SwiftBridgeAttr::SwiftBridgeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28562 | , llvm::StringRef SwiftType |
||
28563 | ) |
||
28564 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftBridge, false, false) |
||
28565 | , swiftTypeLength(SwiftType.size()),swiftType(new (Ctx, 1) char[swiftTypeLength]) |
||
28566 | { |
||
28567 | if (!SwiftType.empty()) |
||
28568 | std::memcpy(swiftType, SwiftType.data(), swiftTypeLength); |
||
28569 | } |
||
28570 | |||
28571 | |||
28572 | |||
28573 | SwiftBridgeAttr *SwiftBridgeAttr::clone(ASTContext &C) const { |
||
28574 | auto *A = new (C) SwiftBridgeAttr(C, *this, getSwiftType()); |
||
28575 | A->Inherited = Inherited; |
||
28576 | A->IsPackExpansion = IsPackExpansion; |
||
28577 | A->setImplicit(Implicit); |
||
28578 | return A; |
||
28579 | } |
||
28580 | |||
28581 | void SwiftBridgeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28582 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28583 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28584 | switch (getAttributeSpellingListIndex()) { |
||
28585 | default: |
||
28586 | llvm_unreachable("Unknown attribute spelling!"); |
||
28587 | break; |
||
28588 | case 0 : { |
||
28589 | OS << " __attribute__((swift_bridge"; |
||
28590 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28591 | OS << "\"" << getSwiftType() << "\""; |
||
28592 | if (!IsFirstArgument) |
||
28593 | OS << ")"; |
||
28594 | OS << "))"; |
||
28595 | break; |
||
28596 | } |
||
28597 | } |
||
28598 | } |
||
28599 | |||
28600 | const char *SwiftBridgeAttr::getSpelling() const { |
||
28601 | switch (getAttributeSpellingListIndex()) { |
||
28602 | default: |
||
28603 | llvm_unreachable("Unknown attribute spelling!"); |
||
28604 | return "(No spelling)"; |
||
28605 | case 0: |
||
28606 | return "swift_bridge"; |
||
28607 | } |
||
28608 | } |
||
28609 | |||
28610 | |||
28611 | // SwiftBridgedTypedefAttr implementation |
||
28612 | |||
28613 | SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28614 | auto *A = new (Ctx) SwiftBridgedTypedefAttr(Ctx, CommonInfo); |
||
28615 | A->setImplicit(true); |
||
28616 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28617 | A->setAttributeSpellingListIndex(0); |
||
28618 | return A; |
||
28619 | } |
||
28620 | |||
28621 | SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28622 | auto *A = new (Ctx) SwiftBridgedTypedefAttr(Ctx, CommonInfo); |
||
28623 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28624 | A->setAttributeSpellingListIndex(0); |
||
28625 | return A; |
||
28626 | } |
||
28627 | |||
28628 | SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28629 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28630 | return CreateImplicit(Ctx, I); |
||
28631 | } |
||
28632 | |||
28633 | SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28634 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28635 | return Create(Ctx, I); |
||
28636 | } |
||
28637 | |||
28638 | SwiftBridgedTypedefAttr::SwiftBridgedTypedefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28639 | ) |
||
28640 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftBridgedTypedef, false, false) |
||
28641 | { |
||
28642 | } |
||
28643 | |||
28644 | SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::clone(ASTContext &C) const { |
||
28645 | auto *A = new (C) SwiftBridgedTypedefAttr(C, *this); |
||
28646 | A->Inherited = Inherited; |
||
28647 | A->IsPackExpansion = IsPackExpansion; |
||
28648 | A->setImplicit(Implicit); |
||
28649 | return A; |
||
28650 | } |
||
28651 | |||
28652 | void SwiftBridgedTypedefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28653 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28654 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28655 | switch (getAttributeSpellingListIndex()) { |
||
28656 | default: |
||
28657 | llvm_unreachable("Unknown attribute spelling!"); |
||
28658 | break; |
||
28659 | case 0 : { |
||
28660 | OS << " __attribute__((swift_bridged_typedef"; |
||
28661 | OS << "))"; |
||
28662 | break; |
||
28663 | } |
||
28664 | } |
||
28665 | } |
||
28666 | |||
28667 | const char *SwiftBridgedTypedefAttr::getSpelling() const { |
||
28668 | switch (getAttributeSpellingListIndex()) { |
||
28669 | default: |
||
28670 | llvm_unreachable("Unknown attribute spelling!"); |
||
28671 | return "(No spelling)"; |
||
28672 | case 0: |
||
28673 | return "swift_bridged_typedef"; |
||
28674 | } |
||
28675 | } |
||
28676 | |||
28677 | |||
28678 | // SwiftCallAttr implementation |
||
28679 | |||
28680 | SwiftCallAttr *SwiftCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28681 | auto *A = new (Ctx) SwiftCallAttr(Ctx, CommonInfo); |
||
28682 | A->setImplicit(true); |
||
28683 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28684 | A->setAttributeSpellingListIndex(0); |
||
28685 | return A; |
||
28686 | } |
||
28687 | |||
28688 | SwiftCallAttr *SwiftCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28689 | auto *A = new (Ctx) SwiftCallAttr(Ctx, CommonInfo); |
||
28690 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28691 | A->setAttributeSpellingListIndex(0); |
||
28692 | return A; |
||
28693 | } |
||
28694 | |||
28695 | SwiftCallAttr *SwiftCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28696 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28697 | return CreateImplicit(Ctx, I); |
||
28698 | } |
||
28699 | |||
28700 | SwiftCallAttr *SwiftCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28701 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28702 | return Create(Ctx, I); |
||
28703 | } |
||
28704 | |||
28705 | SwiftCallAttr::SwiftCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28706 | ) |
||
28707 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftCall, false, false) |
||
28708 | { |
||
28709 | } |
||
28710 | |||
28711 | SwiftCallAttr *SwiftCallAttr::clone(ASTContext &C) const { |
||
28712 | auto *A = new (C) SwiftCallAttr(C, *this); |
||
28713 | A->Inherited = Inherited; |
||
28714 | A->IsPackExpansion = IsPackExpansion; |
||
28715 | A->setImplicit(Implicit); |
||
28716 | return A; |
||
28717 | } |
||
28718 | |||
28719 | void SwiftCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28720 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28721 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28722 | switch (getAttributeSpellingListIndex()) { |
||
28723 | default: |
||
28724 | llvm_unreachable("Unknown attribute spelling!"); |
||
28725 | break; |
||
28726 | case 0 : { |
||
28727 | OS << " __attribute__((swiftcall"; |
||
28728 | OS << "))"; |
||
28729 | break; |
||
28730 | } |
||
28731 | case 1 : { |
||
28732 | OS << " [[clang::swiftcall"; |
||
28733 | OS << "]]"; |
||
28734 | break; |
||
28735 | } |
||
28736 | case 2 : { |
||
28737 | OS << " [[clang::swiftcall"; |
||
28738 | OS << "]]"; |
||
28739 | break; |
||
28740 | } |
||
28741 | } |
||
28742 | } |
||
28743 | |||
28744 | const char *SwiftCallAttr::getSpelling() const { |
||
28745 | switch (getAttributeSpellingListIndex()) { |
||
28746 | default: |
||
28747 | llvm_unreachable("Unknown attribute spelling!"); |
||
28748 | return "(No spelling)"; |
||
28749 | case 0: |
||
28750 | return "swiftcall"; |
||
28751 | case 1: |
||
28752 | return "swiftcall"; |
||
28753 | case 2: |
||
28754 | return "swiftcall"; |
||
28755 | } |
||
28756 | } |
||
28757 | |||
28758 | |||
28759 | // SwiftContextAttr implementation |
||
28760 | |||
28761 | SwiftContextAttr *SwiftContextAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28762 | auto *A = new (Ctx) SwiftContextAttr(Ctx, CommonInfo); |
||
28763 | A->setImplicit(true); |
||
28764 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28765 | A->setAttributeSpellingListIndex(0); |
||
28766 | return A; |
||
28767 | } |
||
28768 | |||
28769 | SwiftContextAttr *SwiftContextAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28770 | auto *A = new (Ctx) SwiftContextAttr(Ctx, CommonInfo); |
||
28771 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28772 | A->setAttributeSpellingListIndex(0); |
||
28773 | return A; |
||
28774 | } |
||
28775 | |||
28776 | SwiftContextAttr *SwiftContextAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28777 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28778 | return CreateImplicit(Ctx, I); |
||
28779 | } |
||
28780 | |||
28781 | SwiftContextAttr *SwiftContextAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28782 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28783 | return Create(Ctx, I); |
||
28784 | } |
||
28785 | |||
28786 | SwiftContextAttr::SwiftContextAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28787 | ) |
||
28788 | : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftContext, false, false) |
||
28789 | { |
||
28790 | } |
||
28791 | |||
28792 | SwiftContextAttr *SwiftContextAttr::clone(ASTContext &C) const { |
||
28793 | auto *A = new (C) SwiftContextAttr(C, *this); |
||
28794 | A->Inherited = Inherited; |
||
28795 | A->IsPackExpansion = IsPackExpansion; |
||
28796 | A->setImplicit(Implicit); |
||
28797 | return A; |
||
28798 | } |
||
28799 | |||
28800 | void SwiftContextAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28801 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28802 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28803 | switch (getAttributeSpellingListIndex()) { |
||
28804 | default: |
||
28805 | llvm_unreachable("Unknown attribute spelling!"); |
||
28806 | break; |
||
28807 | case 0 : { |
||
28808 | OS << " __attribute__((swift_context"; |
||
28809 | OS << "))"; |
||
28810 | break; |
||
28811 | } |
||
28812 | case 1 : { |
||
28813 | OS << " [[clang::swift_context"; |
||
28814 | OS << "]]"; |
||
28815 | break; |
||
28816 | } |
||
28817 | case 2 : { |
||
28818 | OS << " [[clang::swift_context"; |
||
28819 | OS << "]]"; |
||
28820 | break; |
||
28821 | } |
||
28822 | } |
||
28823 | } |
||
28824 | |||
28825 | const char *SwiftContextAttr::getSpelling() const { |
||
28826 | switch (getAttributeSpellingListIndex()) { |
||
28827 | default: |
||
28828 | llvm_unreachable("Unknown attribute spelling!"); |
||
28829 | return "(No spelling)"; |
||
28830 | case 0: |
||
28831 | return "swift_context"; |
||
28832 | case 1: |
||
28833 | return "swift_context"; |
||
28834 | case 2: |
||
28835 | return "swift_context"; |
||
28836 | } |
||
28837 | } |
||
28838 | |||
28839 | |||
28840 | // SwiftErrorAttr implementation |
||
28841 | |||
28842 | SwiftErrorAttr *SwiftErrorAttr::CreateImplicit(ASTContext &Ctx, ConventionKind Convention, const AttributeCommonInfo &CommonInfo) { |
||
28843 | auto *A = new (Ctx) SwiftErrorAttr(Ctx, CommonInfo, Convention); |
||
28844 | A->setImplicit(true); |
||
28845 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28846 | A->setAttributeSpellingListIndex(0); |
||
28847 | return A; |
||
28848 | } |
||
28849 | |||
28850 | SwiftErrorAttr *SwiftErrorAttr::Create(ASTContext &Ctx, ConventionKind Convention, const AttributeCommonInfo &CommonInfo) { |
||
28851 | auto *A = new (Ctx) SwiftErrorAttr(Ctx, CommonInfo, Convention); |
||
28852 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28853 | A->setAttributeSpellingListIndex(0); |
||
28854 | return A; |
||
28855 | } |
||
28856 | |||
28857 | SwiftErrorAttr *SwiftErrorAttr::CreateImplicit(ASTContext &Ctx, ConventionKind Convention, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28858 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28859 | return CreateImplicit(Ctx, Convention, I); |
||
28860 | } |
||
28861 | |||
28862 | SwiftErrorAttr *SwiftErrorAttr::Create(ASTContext &Ctx, ConventionKind Convention, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28863 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28864 | return Create(Ctx, Convention, I); |
||
28865 | } |
||
28866 | |||
28867 | SwiftErrorAttr::SwiftErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28868 | , ConventionKind Convention |
||
28869 | ) |
||
28870 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftError, false, false) |
||
28871 | , convention(Convention) |
||
28872 | { |
||
28873 | } |
||
28874 | |||
28875 | |||
28876 | |||
28877 | bool SwiftErrorAttr::ConvertStrToConventionKind(StringRef Val, ConventionKind &Out) { |
||
28878 | std::optional<ConventionKind> R = llvm::StringSwitch<std::optional<ConventionKind>>(Val) |
||
28879 | .Case("none", SwiftErrorAttr::None) |
||
28880 | .Case("nonnull_error", SwiftErrorAttr::NonNullError) |
||
28881 | .Case("null_result", SwiftErrorAttr::NullResult) |
||
28882 | .Case("zero_result", SwiftErrorAttr::ZeroResult) |
||
28883 | .Case("nonzero_result", SwiftErrorAttr::NonZeroResult) |
||
28884 | .Default(std::optional<ConventionKind>()); |
||
28885 | if (R) { |
||
28886 | Out = *R; |
||
28887 | return true; |
||
28888 | } |
||
28889 | return false; |
||
28890 | } |
||
28891 | |||
28892 | const char *SwiftErrorAttr::ConvertConventionKindToStr(ConventionKind Val) { |
||
28893 | switch(Val) { |
||
28894 | case SwiftErrorAttr::None: return "none"; |
||
28895 | case SwiftErrorAttr::NonNullError: return "nonnull_error"; |
||
28896 | case SwiftErrorAttr::NullResult: return "null_result"; |
||
28897 | case SwiftErrorAttr::ZeroResult: return "zero_result"; |
||
28898 | case SwiftErrorAttr::NonZeroResult: return "nonzero_result"; |
||
28899 | } |
||
28900 | llvm_unreachable("No enumerator with that value"); |
||
28901 | } |
||
28902 | SwiftErrorAttr *SwiftErrorAttr::clone(ASTContext &C) const { |
||
28903 | auto *A = new (C) SwiftErrorAttr(C, *this, convention); |
||
28904 | A->Inherited = Inherited; |
||
28905 | A->IsPackExpansion = IsPackExpansion; |
||
28906 | A->setImplicit(Implicit); |
||
28907 | return A; |
||
28908 | } |
||
28909 | |||
28910 | void SwiftErrorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28911 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28912 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28913 | switch (getAttributeSpellingListIndex()) { |
||
28914 | default: |
||
28915 | llvm_unreachable("Unknown attribute spelling!"); |
||
28916 | break; |
||
28917 | case 0 : { |
||
28918 | OS << " __attribute__((swift_error"; |
||
28919 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
28920 | OS << "\"" << SwiftErrorAttr::ConvertConventionKindToStr(getConvention()) << "\""; |
||
28921 | if (!IsFirstArgument) |
||
28922 | OS << ")"; |
||
28923 | OS << "))"; |
||
28924 | break; |
||
28925 | } |
||
28926 | } |
||
28927 | } |
||
28928 | |||
28929 | const char *SwiftErrorAttr::getSpelling() const { |
||
28930 | switch (getAttributeSpellingListIndex()) { |
||
28931 | default: |
||
28932 | llvm_unreachable("Unknown attribute spelling!"); |
||
28933 | return "(No spelling)"; |
||
28934 | case 0: |
||
28935 | return "swift_error"; |
||
28936 | } |
||
28937 | } |
||
28938 | |||
28939 | |||
28940 | // SwiftErrorResultAttr implementation |
||
28941 | |||
28942 | SwiftErrorResultAttr *SwiftErrorResultAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28943 | auto *A = new (Ctx) SwiftErrorResultAttr(Ctx, CommonInfo); |
||
28944 | A->setImplicit(true); |
||
28945 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28946 | A->setAttributeSpellingListIndex(0); |
||
28947 | return A; |
||
28948 | } |
||
28949 | |||
28950 | SwiftErrorResultAttr *SwiftErrorResultAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
28951 | auto *A = new (Ctx) SwiftErrorResultAttr(Ctx, CommonInfo); |
||
28952 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
28953 | A->setAttributeSpellingListIndex(0); |
||
28954 | return A; |
||
28955 | } |
||
28956 | |||
28957 | SwiftErrorResultAttr *SwiftErrorResultAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28958 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28959 | return CreateImplicit(Ctx, I); |
||
28960 | } |
||
28961 | |||
28962 | SwiftErrorResultAttr *SwiftErrorResultAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
28963 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
28964 | return Create(Ctx, I); |
||
28965 | } |
||
28966 | |||
28967 | SwiftErrorResultAttr::SwiftErrorResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
28968 | ) |
||
28969 | : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftErrorResult, false, false) |
||
28970 | { |
||
28971 | } |
||
28972 | |||
28973 | SwiftErrorResultAttr *SwiftErrorResultAttr::clone(ASTContext &C) const { |
||
28974 | auto *A = new (C) SwiftErrorResultAttr(C, *this); |
||
28975 | A->Inherited = Inherited; |
||
28976 | A->IsPackExpansion = IsPackExpansion; |
||
28977 | A->setImplicit(Implicit); |
||
28978 | return A; |
||
28979 | } |
||
28980 | |||
28981 | void SwiftErrorResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
28982 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
28983 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
28984 | switch (getAttributeSpellingListIndex()) { |
||
28985 | default: |
||
28986 | llvm_unreachable("Unknown attribute spelling!"); |
||
28987 | break; |
||
28988 | case 0 : { |
||
28989 | OS << " __attribute__((swift_error_result"; |
||
28990 | OS << "))"; |
||
28991 | break; |
||
28992 | } |
||
28993 | case 1 : { |
||
28994 | OS << " [[clang::swift_error_result"; |
||
28995 | OS << "]]"; |
||
28996 | break; |
||
28997 | } |
||
28998 | case 2 : { |
||
28999 | OS << " [[clang::swift_error_result"; |
||
29000 | OS << "]]"; |
||
29001 | break; |
||
29002 | } |
||
29003 | } |
||
29004 | } |
||
29005 | |||
29006 | const char *SwiftErrorResultAttr::getSpelling() const { |
||
29007 | switch (getAttributeSpellingListIndex()) { |
||
29008 | default: |
||
29009 | llvm_unreachable("Unknown attribute spelling!"); |
||
29010 | return "(No spelling)"; |
||
29011 | case 0: |
||
29012 | return "swift_error_result"; |
||
29013 | case 1: |
||
29014 | return "swift_error_result"; |
||
29015 | case 2: |
||
29016 | return "swift_error_result"; |
||
29017 | } |
||
29018 | } |
||
29019 | |||
29020 | |||
29021 | // SwiftIndirectResultAttr implementation |
||
29022 | |||
29023 | SwiftIndirectResultAttr *SwiftIndirectResultAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
29024 | auto *A = new (Ctx) SwiftIndirectResultAttr(Ctx, CommonInfo); |
||
29025 | A->setImplicit(true); |
||
29026 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29027 | A->setAttributeSpellingListIndex(0); |
||
29028 | return A; |
||
29029 | } |
||
29030 | |||
29031 | SwiftIndirectResultAttr *SwiftIndirectResultAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
29032 | auto *A = new (Ctx) SwiftIndirectResultAttr(Ctx, CommonInfo); |
||
29033 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29034 | A->setAttributeSpellingListIndex(0); |
||
29035 | return A; |
||
29036 | } |
||
29037 | |||
29038 | SwiftIndirectResultAttr *SwiftIndirectResultAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29039 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29040 | return CreateImplicit(Ctx, I); |
||
29041 | } |
||
29042 | |||
29043 | SwiftIndirectResultAttr *SwiftIndirectResultAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29044 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29045 | return Create(Ctx, I); |
||
29046 | } |
||
29047 | |||
29048 | SwiftIndirectResultAttr::SwiftIndirectResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29049 | ) |
||
29050 | : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftIndirectResult, false, false) |
||
29051 | { |
||
29052 | } |
||
29053 | |||
29054 | SwiftIndirectResultAttr *SwiftIndirectResultAttr::clone(ASTContext &C) const { |
||
29055 | auto *A = new (C) SwiftIndirectResultAttr(C, *this); |
||
29056 | A->Inherited = Inherited; |
||
29057 | A->IsPackExpansion = IsPackExpansion; |
||
29058 | A->setImplicit(Implicit); |
||
29059 | return A; |
||
29060 | } |
||
29061 | |||
29062 | void SwiftIndirectResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29063 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29064 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29065 | switch (getAttributeSpellingListIndex()) { |
||
29066 | default: |
||
29067 | llvm_unreachable("Unknown attribute spelling!"); |
||
29068 | break; |
||
29069 | case 0 : { |
||
29070 | OS << " __attribute__((swift_indirect_result"; |
||
29071 | OS << "))"; |
||
29072 | break; |
||
29073 | } |
||
29074 | case 1 : { |
||
29075 | OS << " [[clang::swift_indirect_result"; |
||
29076 | OS << "]]"; |
||
29077 | break; |
||
29078 | } |
||
29079 | case 2 : { |
||
29080 | OS << " [[clang::swift_indirect_result"; |
||
29081 | OS << "]]"; |
||
29082 | break; |
||
29083 | } |
||
29084 | } |
||
29085 | } |
||
29086 | |||
29087 | const char *SwiftIndirectResultAttr::getSpelling() const { |
||
29088 | switch (getAttributeSpellingListIndex()) { |
||
29089 | default: |
||
29090 | llvm_unreachable("Unknown attribute spelling!"); |
||
29091 | return "(No spelling)"; |
||
29092 | case 0: |
||
29093 | return "swift_indirect_result"; |
||
29094 | case 1: |
||
29095 | return "swift_indirect_result"; |
||
29096 | case 2: |
||
29097 | return "swift_indirect_result"; |
||
29098 | } |
||
29099 | } |
||
29100 | |||
29101 | |||
29102 | // SwiftNameAttr implementation |
||
29103 | |||
29104 | SwiftNameAttr *SwiftNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
29105 | auto *A = new (Ctx) SwiftNameAttr(Ctx, CommonInfo, Name); |
||
29106 | A->setImplicit(true); |
||
29107 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29108 | A->setAttributeSpellingListIndex(0); |
||
29109 | return A; |
||
29110 | } |
||
29111 | |||
29112 | SwiftNameAttr *SwiftNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { |
||
29113 | auto *A = new (Ctx) SwiftNameAttr(Ctx, CommonInfo, Name); |
||
29114 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29115 | A->setAttributeSpellingListIndex(0); |
||
29116 | return A; |
||
29117 | } |
||
29118 | |||
29119 | SwiftNameAttr *SwiftNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29120 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29121 | return CreateImplicit(Ctx, Name, I); |
||
29122 | } |
||
29123 | |||
29124 | SwiftNameAttr *SwiftNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29125 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29126 | return Create(Ctx, Name, I); |
||
29127 | } |
||
29128 | |||
29129 | SwiftNameAttr::SwiftNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29130 | , llvm::StringRef Name |
||
29131 | ) |
||
29132 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftName, false, false) |
||
29133 | , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) |
||
29134 | { |
||
29135 | if (!Name.empty()) |
||
29136 | std::memcpy(name, Name.data(), nameLength); |
||
29137 | } |
||
29138 | |||
29139 | |||
29140 | |||
29141 | SwiftNameAttr *SwiftNameAttr::clone(ASTContext &C) const { |
||
29142 | auto *A = new (C) SwiftNameAttr(C, *this, getName()); |
||
29143 | A->Inherited = Inherited; |
||
29144 | A->IsPackExpansion = IsPackExpansion; |
||
29145 | A->setImplicit(Implicit); |
||
29146 | return A; |
||
29147 | } |
||
29148 | |||
29149 | void SwiftNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29150 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29151 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29152 | switch (getAttributeSpellingListIndex()) { |
||
29153 | default: |
||
29154 | llvm_unreachable("Unknown attribute spelling!"); |
||
29155 | break; |
||
29156 | case 0 : { |
||
29157 | OS << " __attribute__((swift_name"; |
||
29158 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29159 | OS << "\"" << getName() << "\""; |
||
29160 | if (!IsFirstArgument) |
||
29161 | OS << ")"; |
||
29162 | OS << "))"; |
||
29163 | break; |
||
29164 | } |
||
29165 | } |
||
29166 | } |
||
29167 | |||
29168 | const char *SwiftNameAttr::getSpelling() const { |
||
29169 | switch (getAttributeSpellingListIndex()) { |
||
29170 | default: |
||
29171 | llvm_unreachable("Unknown attribute spelling!"); |
||
29172 | return "(No spelling)"; |
||
29173 | case 0: |
||
29174 | return "swift_name"; |
||
29175 | } |
||
29176 | } |
||
29177 | |||
29178 | |||
29179 | // SwiftNewTypeAttr implementation |
||
29180 | |||
29181 | SwiftNewTypeAttr *SwiftNewTypeAttr::CreateImplicit(ASTContext &Ctx, NewtypeKind NewtypeKind, const AttributeCommonInfo &CommonInfo) { |
||
29182 | auto *A = new (Ctx) SwiftNewTypeAttr(Ctx, CommonInfo, NewtypeKind); |
||
29183 | A->setImplicit(true); |
||
29184 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29185 | A->setAttributeSpellingListIndex(0); |
||
29186 | return A; |
||
29187 | } |
||
29188 | |||
29189 | SwiftNewTypeAttr *SwiftNewTypeAttr::Create(ASTContext &Ctx, NewtypeKind NewtypeKind, const AttributeCommonInfo &CommonInfo) { |
||
29190 | auto *A = new (Ctx) SwiftNewTypeAttr(Ctx, CommonInfo, NewtypeKind); |
||
29191 | return A; |
||
29192 | } |
||
29193 | |||
29194 | SwiftNewTypeAttr *SwiftNewTypeAttr::CreateImplicit(ASTContext &Ctx, NewtypeKind NewtypeKind, SourceRange Range, AttributeCommonInfo::Syntax Syntax, SwiftNewTypeAttr::Spelling S) { |
||
29195 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
29196 | return CreateImplicit(Ctx, NewtypeKind, I); |
||
29197 | } |
||
29198 | |||
29199 | SwiftNewTypeAttr *SwiftNewTypeAttr::Create(ASTContext &Ctx, NewtypeKind NewtypeKind, SourceRange Range, AttributeCommonInfo::Syntax Syntax, SwiftNewTypeAttr::Spelling S) { |
||
29200 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
29201 | return Create(Ctx, NewtypeKind, I); |
||
29202 | } |
||
29203 | |||
29204 | SwiftNewTypeAttr::SwiftNewTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29205 | , NewtypeKind NewtypeKind |
||
29206 | ) |
||
29207 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftNewType, false, false) |
||
29208 | , newtypeKind(NewtypeKind) |
||
29209 | { |
||
29210 | } |
||
29211 | |||
29212 | SwiftNewTypeAttr::Spelling SwiftNewTypeAttr::getSemanticSpelling() const { |
||
29213 | switch (getAttributeSpellingListIndex()) { |
||
29214 | default: llvm_unreachable("Unknown spelling list index"); |
||
29215 | case 0: return GNU_swift_newtype; |
||
29216 | case 1: return GNU_swift_wrapper; |
||
29217 | } |
||
29218 | } |
||
29219 | |||
29220 | |||
29221 | bool SwiftNewTypeAttr::ConvertStrToNewtypeKind(StringRef Val, NewtypeKind &Out) { |
||
29222 | std::optional<NewtypeKind> R = llvm::StringSwitch<std::optional<NewtypeKind>>(Val) |
||
29223 | .Case("struct", SwiftNewTypeAttr::NK_Struct) |
||
29224 | .Case("enum", SwiftNewTypeAttr::NK_Enum) |
||
29225 | .Default(std::optional<NewtypeKind>()); |
||
29226 | if (R) { |
||
29227 | Out = *R; |
||
29228 | return true; |
||
29229 | } |
||
29230 | return false; |
||
29231 | } |
||
29232 | |||
29233 | const char *SwiftNewTypeAttr::ConvertNewtypeKindToStr(NewtypeKind Val) { |
||
29234 | switch(Val) { |
||
29235 | case SwiftNewTypeAttr::NK_Struct: return "struct"; |
||
29236 | case SwiftNewTypeAttr::NK_Enum: return "enum"; |
||
29237 | } |
||
29238 | llvm_unreachable("No enumerator with that value"); |
||
29239 | } |
||
29240 | SwiftNewTypeAttr *SwiftNewTypeAttr::clone(ASTContext &C) const { |
||
29241 | auto *A = new (C) SwiftNewTypeAttr(C, *this, newtypeKind); |
||
29242 | A->Inherited = Inherited; |
||
29243 | A->IsPackExpansion = IsPackExpansion; |
||
29244 | A->setImplicit(Implicit); |
||
29245 | return A; |
||
29246 | } |
||
29247 | |||
29248 | void SwiftNewTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29249 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29250 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29251 | switch (getAttributeSpellingListIndex()) { |
||
29252 | default: |
||
29253 | llvm_unreachable("Unknown attribute spelling!"); |
||
29254 | break; |
||
29255 | case 0 : { |
||
29256 | OS << " __attribute__((swift_newtype"; |
||
29257 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29258 | OS << "\"" << SwiftNewTypeAttr::ConvertNewtypeKindToStr(getNewtypeKind()) << "\""; |
||
29259 | if (!IsFirstArgument) |
||
29260 | OS << ")"; |
||
29261 | OS << "))"; |
||
29262 | break; |
||
29263 | } |
||
29264 | case 1 : { |
||
29265 | OS << " __attribute__((swift_wrapper"; |
||
29266 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29267 | OS << "\"" << SwiftNewTypeAttr::ConvertNewtypeKindToStr(getNewtypeKind()) << "\""; |
||
29268 | if (!IsFirstArgument) |
||
29269 | OS << ")"; |
||
29270 | OS << "))"; |
||
29271 | break; |
||
29272 | } |
||
29273 | } |
||
29274 | } |
||
29275 | |||
29276 | const char *SwiftNewTypeAttr::getSpelling() const { |
||
29277 | switch (getAttributeSpellingListIndex()) { |
||
29278 | default: |
||
29279 | llvm_unreachable("Unknown attribute spelling!"); |
||
29280 | return "(No spelling)"; |
||
29281 | case 0: |
||
29282 | return "swift_newtype"; |
||
29283 | case 1: |
||
29284 | return "swift_wrapper"; |
||
29285 | } |
||
29286 | } |
||
29287 | |||
29288 | |||
29289 | // SwiftObjCMembersAttr implementation |
||
29290 | |||
29291 | SwiftObjCMembersAttr *SwiftObjCMembersAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
29292 | auto *A = new (Ctx) SwiftObjCMembersAttr(Ctx, CommonInfo); |
||
29293 | A->setImplicit(true); |
||
29294 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29295 | A->setAttributeSpellingListIndex(0); |
||
29296 | return A; |
||
29297 | } |
||
29298 | |||
29299 | SwiftObjCMembersAttr *SwiftObjCMembersAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
29300 | auto *A = new (Ctx) SwiftObjCMembersAttr(Ctx, CommonInfo); |
||
29301 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29302 | A->setAttributeSpellingListIndex(0); |
||
29303 | return A; |
||
29304 | } |
||
29305 | |||
29306 | SwiftObjCMembersAttr *SwiftObjCMembersAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29307 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29308 | return CreateImplicit(Ctx, I); |
||
29309 | } |
||
29310 | |||
29311 | SwiftObjCMembersAttr *SwiftObjCMembersAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29312 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29313 | return Create(Ctx, I); |
||
29314 | } |
||
29315 | |||
29316 | SwiftObjCMembersAttr::SwiftObjCMembersAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29317 | ) |
||
29318 | : Attr(Ctx, CommonInfo, attr::SwiftObjCMembers, false) |
||
29319 | { |
||
29320 | } |
||
29321 | |||
29322 | SwiftObjCMembersAttr *SwiftObjCMembersAttr::clone(ASTContext &C) const { |
||
29323 | auto *A = new (C) SwiftObjCMembersAttr(C, *this); |
||
29324 | A->Inherited = Inherited; |
||
29325 | A->IsPackExpansion = IsPackExpansion; |
||
29326 | A->setImplicit(Implicit); |
||
29327 | return A; |
||
29328 | } |
||
29329 | |||
29330 | void SwiftObjCMembersAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29331 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29332 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29333 | switch (getAttributeSpellingListIndex()) { |
||
29334 | default: |
||
29335 | llvm_unreachable("Unknown attribute spelling!"); |
||
29336 | break; |
||
29337 | case 0 : { |
||
29338 | OS << " __attribute__((swift_objc_members"; |
||
29339 | OS << "))"; |
||
29340 | break; |
||
29341 | } |
||
29342 | } |
||
29343 | } |
||
29344 | |||
29345 | const char *SwiftObjCMembersAttr::getSpelling() const { |
||
29346 | switch (getAttributeSpellingListIndex()) { |
||
29347 | default: |
||
29348 | llvm_unreachable("Unknown attribute spelling!"); |
||
29349 | return "(No spelling)"; |
||
29350 | case 0: |
||
29351 | return "swift_objc_members"; |
||
29352 | } |
||
29353 | } |
||
29354 | |||
29355 | |||
29356 | // SwiftPrivateAttr implementation |
||
29357 | |||
29358 | SwiftPrivateAttr *SwiftPrivateAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
29359 | auto *A = new (Ctx) SwiftPrivateAttr(Ctx, CommonInfo); |
||
29360 | A->setImplicit(true); |
||
29361 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29362 | A->setAttributeSpellingListIndex(0); |
||
29363 | return A; |
||
29364 | } |
||
29365 | |||
29366 | SwiftPrivateAttr *SwiftPrivateAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
29367 | auto *A = new (Ctx) SwiftPrivateAttr(Ctx, CommonInfo); |
||
29368 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29369 | A->setAttributeSpellingListIndex(0); |
||
29370 | return A; |
||
29371 | } |
||
29372 | |||
29373 | SwiftPrivateAttr *SwiftPrivateAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29374 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29375 | return CreateImplicit(Ctx, I); |
||
29376 | } |
||
29377 | |||
29378 | SwiftPrivateAttr *SwiftPrivateAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29379 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29380 | return Create(Ctx, I); |
||
29381 | } |
||
29382 | |||
29383 | SwiftPrivateAttr::SwiftPrivateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29384 | ) |
||
29385 | : InheritableAttr(Ctx, CommonInfo, attr::SwiftPrivate, false, false) |
||
29386 | { |
||
29387 | } |
||
29388 | |||
29389 | SwiftPrivateAttr *SwiftPrivateAttr::clone(ASTContext &C) const { |
||
29390 | auto *A = new (C) SwiftPrivateAttr(C, *this); |
||
29391 | A->Inherited = Inherited; |
||
29392 | A->IsPackExpansion = IsPackExpansion; |
||
29393 | A->setImplicit(Implicit); |
||
29394 | return A; |
||
29395 | } |
||
29396 | |||
29397 | void SwiftPrivateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29398 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29399 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29400 | switch (getAttributeSpellingListIndex()) { |
||
29401 | default: |
||
29402 | llvm_unreachable("Unknown attribute spelling!"); |
||
29403 | break; |
||
29404 | case 0 : { |
||
29405 | OS << " __attribute__((swift_private"; |
||
29406 | OS << "))"; |
||
29407 | break; |
||
29408 | } |
||
29409 | } |
||
29410 | } |
||
29411 | |||
29412 | const char *SwiftPrivateAttr::getSpelling() const { |
||
29413 | switch (getAttributeSpellingListIndex()) { |
||
29414 | default: |
||
29415 | llvm_unreachable("Unknown attribute spelling!"); |
||
29416 | return "(No spelling)"; |
||
29417 | case 0: |
||
29418 | return "swift_private"; |
||
29419 | } |
||
29420 | } |
||
29421 | |||
29422 | |||
29423 | // SysVABIAttr implementation |
||
29424 | |||
29425 | SysVABIAttr *SysVABIAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
29426 | auto *A = new (Ctx) SysVABIAttr(Ctx, CommonInfo); |
||
29427 | A->setImplicit(true); |
||
29428 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29429 | A->setAttributeSpellingListIndex(0); |
||
29430 | return A; |
||
29431 | } |
||
29432 | |||
29433 | SysVABIAttr *SysVABIAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
29434 | auto *A = new (Ctx) SysVABIAttr(Ctx, CommonInfo); |
||
29435 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29436 | A->setAttributeSpellingListIndex(0); |
||
29437 | return A; |
||
29438 | } |
||
29439 | |||
29440 | SysVABIAttr *SysVABIAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29441 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29442 | return CreateImplicit(Ctx, I); |
||
29443 | } |
||
29444 | |||
29445 | SysVABIAttr *SysVABIAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29446 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29447 | return Create(Ctx, I); |
||
29448 | } |
||
29449 | |||
29450 | SysVABIAttr::SysVABIAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29451 | ) |
||
29452 | : InheritableAttr(Ctx, CommonInfo, attr::SysVABI, false, false) |
||
29453 | { |
||
29454 | } |
||
29455 | |||
29456 | SysVABIAttr *SysVABIAttr::clone(ASTContext &C) const { |
||
29457 | auto *A = new (C) SysVABIAttr(C, *this); |
||
29458 | A->Inherited = Inherited; |
||
29459 | A->IsPackExpansion = IsPackExpansion; |
||
29460 | A->setImplicit(Implicit); |
||
29461 | return A; |
||
29462 | } |
||
29463 | |||
29464 | void SysVABIAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29465 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29466 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29467 | switch (getAttributeSpellingListIndex()) { |
||
29468 | default: |
||
29469 | llvm_unreachable("Unknown attribute spelling!"); |
||
29470 | break; |
||
29471 | case 0 : { |
||
29472 | OS << " __attribute__((sysv_abi"; |
||
29473 | OS << "))"; |
||
29474 | break; |
||
29475 | } |
||
29476 | case 1 : { |
||
29477 | OS << " [[gnu::sysv_abi"; |
||
29478 | OS << "]]"; |
||
29479 | break; |
||
29480 | } |
||
29481 | case 2 : { |
||
29482 | OS << " [[gnu::sysv_abi"; |
||
29483 | OS << "]]"; |
||
29484 | break; |
||
29485 | } |
||
29486 | } |
||
29487 | } |
||
29488 | |||
29489 | const char *SysVABIAttr::getSpelling() const { |
||
29490 | switch (getAttributeSpellingListIndex()) { |
||
29491 | default: |
||
29492 | llvm_unreachable("Unknown attribute spelling!"); |
||
29493 | return "(No spelling)"; |
||
29494 | case 0: |
||
29495 | return "sysv_abi"; |
||
29496 | case 1: |
||
29497 | return "sysv_abi"; |
||
29498 | case 2: |
||
29499 | return "sysv_abi"; |
||
29500 | } |
||
29501 | } |
||
29502 | |||
29503 | |||
29504 | // TLSModelAttr implementation |
||
29505 | |||
29506 | TLSModelAttr *TLSModelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Model, const AttributeCommonInfo &CommonInfo) { |
||
29507 | auto *A = new (Ctx) TLSModelAttr(Ctx, CommonInfo, Model); |
||
29508 | A->setImplicit(true); |
||
29509 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29510 | A->setAttributeSpellingListIndex(0); |
||
29511 | return A; |
||
29512 | } |
||
29513 | |||
29514 | TLSModelAttr *TLSModelAttr::Create(ASTContext &Ctx, llvm::StringRef Model, const AttributeCommonInfo &CommonInfo) { |
||
29515 | auto *A = new (Ctx) TLSModelAttr(Ctx, CommonInfo, Model); |
||
29516 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29517 | A->setAttributeSpellingListIndex(0); |
||
29518 | return A; |
||
29519 | } |
||
29520 | |||
29521 | TLSModelAttr *TLSModelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Model, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29522 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29523 | return CreateImplicit(Ctx, Model, I); |
||
29524 | } |
||
29525 | |||
29526 | TLSModelAttr *TLSModelAttr::Create(ASTContext &Ctx, llvm::StringRef Model, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29527 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29528 | return Create(Ctx, Model, I); |
||
29529 | } |
||
29530 | |||
29531 | TLSModelAttr::TLSModelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29532 | , llvm::StringRef Model |
||
29533 | ) |
||
29534 | : InheritableAttr(Ctx, CommonInfo, attr::TLSModel, false, false) |
||
29535 | , modelLength(Model.size()),model(new (Ctx, 1) char[modelLength]) |
||
29536 | { |
||
29537 | if (!Model.empty()) |
||
29538 | std::memcpy(model, Model.data(), modelLength); |
||
29539 | } |
||
29540 | |||
29541 | |||
29542 | |||
29543 | TLSModelAttr *TLSModelAttr::clone(ASTContext &C) const { |
||
29544 | auto *A = new (C) TLSModelAttr(C, *this, getModel()); |
||
29545 | A->Inherited = Inherited; |
||
29546 | A->IsPackExpansion = IsPackExpansion; |
||
29547 | A->setImplicit(Implicit); |
||
29548 | return A; |
||
29549 | } |
||
29550 | |||
29551 | void TLSModelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29552 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29553 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29554 | switch (getAttributeSpellingListIndex()) { |
||
29555 | default: |
||
29556 | llvm_unreachable("Unknown attribute spelling!"); |
||
29557 | break; |
||
29558 | case 0 : { |
||
29559 | OS << " __attribute__((tls_model"; |
||
29560 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29561 | OS << "\"" << getModel() << "\""; |
||
29562 | if (!IsFirstArgument) |
||
29563 | OS << ")"; |
||
29564 | OS << "))"; |
||
29565 | break; |
||
29566 | } |
||
29567 | case 1 : { |
||
29568 | OS << " [[gnu::tls_model"; |
||
29569 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29570 | OS << "\"" << getModel() << "\""; |
||
29571 | if (!IsFirstArgument) |
||
29572 | OS << ")"; |
||
29573 | OS << "]]"; |
||
29574 | break; |
||
29575 | } |
||
29576 | case 2 : { |
||
29577 | OS << " [[gnu::tls_model"; |
||
29578 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29579 | OS << "\"" << getModel() << "\""; |
||
29580 | if (!IsFirstArgument) |
||
29581 | OS << ")"; |
||
29582 | OS << "]]"; |
||
29583 | break; |
||
29584 | } |
||
29585 | } |
||
29586 | } |
||
29587 | |||
29588 | const char *TLSModelAttr::getSpelling() const { |
||
29589 | switch (getAttributeSpellingListIndex()) { |
||
29590 | default: |
||
29591 | llvm_unreachable("Unknown attribute spelling!"); |
||
29592 | return "(No spelling)"; |
||
29593 | case 0: |
||
29594 | return "tls_model"; |
||
29595 | case 1: |
||
29596 | return "tls_model"; |
||
29597 | case 2: |
||
29598 | return "tls_model"; |
||
29599 | } |
||
29600 | } |
||
29601 | |||
29602 | |||
29603 | // TargetAttr implementation |
||
29604 | |||
29605 | TargetAttr *TargetAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef FeaturesStr, const AttributeCommonInfo &CommonInfo) { |
||
29606 | auto *A = new (Ctx) TargetAttr(Ctx, CommonInfo, FeaturesStr); |
||
29607 | A->setImplicit(true); |
||
29608 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29609 | A->setAttributeSpellingListIndex(0); |
||
29610 | return A; |
||
29611 | } |
||
29612 | |||
29613 | TargetAttr *TargetAttr::Create(ASTContext &Ctx, llvm::StringRef FeaturesStr, const AttributeCommonInfo &CommonInfo) { |
||
29614 | auto *A = new (Ctx) TargetAttr(Ctx, CommonInfo, FeaturesStr); |
||
29615 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29616 | A->setAttributeSpellingListIndex(0); |
||
29617 | return A; |
||
29618 | } |
||
29619 | |||
29620 | TargetAttr *TargetAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef FeaturesStr, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29621 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29622 | return CreateImplicit(Ctx, FeaturesStr, I); |
||
29623 | } |
||
29624 | |||
29625 | TargetAttr *TargetAttr::Create(ASTContext &Ctx, llvm::StringRef FeaturesStr, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29626 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29627 | return Create(Ctx, FeaturesStr, I); |
||
29628 | } |
||
29629 | |||
29630 | TargetAttr::TargetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29631 | , llvm::StringRef FeaturesStr |
||
29632 | ) |
||
29633 | : InheritableAttr(Ctx, CommonInfo, attr::Target, false, false) |
||
29634 | , featuresStrLength(FeaturesStr.size()),featuresStr(new (Ctx, 1) char[featuresStrLength]) |
||
29635 | { |
||
29636 | if (!FeaturesStr.empty()) |
||
29637 | std::memcpy(featuresStr, FeaturesStr.data(), featuresStrLength); |
||
29638 | } |
||
29639 | |||
29640 | |||
29641 | |||
29642 | TargetAttr *TargetAttr::clone(ASTContext &C) const { |
||
29643 | auto *A = new (C) TargetAttr(C, *this, getFeaturesStr()); |
||
29644 | A->Inherited = Inherited; |
||
29645 | A->IsPackExpansion = IsPackExpansion; |
||
29646 | A->setImplicit(Implicit); |
||
29647 | return A; |
||
29648 | } |
||
29649 | |||
29650 | void TargetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29651 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29652 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29653 | switch (getAttributeSpellingListIndex()) { |
||
29654 | default: |
||
29655 | llvm_unreachable("Unknown attribute spelling!"); |
||
29656 | break; |
||
29657 | case 0 : { |
||
29658 | OS << " __attribute__((target"; |
||
29659 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29660 | OS << "\"" << getFeaturesStr() << "\""; |
||
29661 | if (!IsFirstArgument) |
||
29662 | OS << ")"; |
||
29663 | OS << "))"; |
||
29664 | break; |
||
29665 | } |
||
29666 | case 1 : { |
||
29667 | OS << " [[gnu::target"; |
||
29668 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29669 | OS << "\"" << getFeaturesStr() << "\""; |
||
29670 | if (!IsFirstArgument) |
||
29671 | OS << ")"; |
||
29672 | OS << "]]"; |
||
29673 | break; |
||
29674 | } |
||
29675 | case 2 : { |
||
29676 | OS << " [[gnu::target"; |
||
29677 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29678 | OS << "\"" << getFeaturesStr() << "\""; |
||
29679 | if (!IsFirstArgument) |
||
29680 | OS << ")"; |
||
29681 | OS << "]]"; |
||
29682 | break; |
||
29683 | } |
||
29684 | } |
||
29685 | } |
||
29686 | |||
29687 | const char *TargetAttr::getSpelling() const { |
||
29688 | switch (getAttributeSpellingListIndex()) { |
||
29689 | default: |
||
29690 | llvm_unreachable("Unknown attribute spelling!"); |
||
29691 | return "(No spelling)"; |
||
29692 | case 0: |
||
29693 | return "target"; |
||
29694 | case 1: |
||
29695 | return "target"; |
||
29696 | case 2: |
||
29697 | return "target"; |
||
29698 | } |
||
29699 | } |
||
29700 | |||
29701 | |||
29702 | // TargetClonesAttr implementation |
||
29703 | |||
29704 | TargetClonesAttr *TargetClonesAttr::CreateImplicit(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, const AttributeCommonInfo &CommonInfo) { |
||
29705 | auto *A = new (Ctx) TargetClonesAttr(Ctx, CommonInfo, FeaturesStrs, FeaturesStrsSize); |
||
29706 | A->setImplicit(true); |
||
29707 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29708 | A->setAttributeSpellingListIndex(0); |
||
29709 | return A; |
||
29710 | } |
||
29711 | |||
29712 | TargetClonesAttr *TargetClonesAttr::Create(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, const AttributeCommonInfo &CommonInfo) { |
||
29713 | auto *A = new (Ctx) TargetClonesAttr(Ctx, CommonInfo, FeaturesStrs, FeaturesStrsSize); |
||
29714 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29715 | A->setAttributeSpellingListIndex(0); |
||
29716 | return A; |
||
29717 | } |
||
29718 | |||
29719 | TargetClonesAttr *TargetClonesAttr::CreateImplicit(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29720 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29721 | return CreateImplicit(Ctx, FeaturesStrs, FeaturesStrsSize, I); |
||
29722 | } |
||
29723 | |||
29724 | TargetClonesAttr *TargetClonesAttr::Create(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29725 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29726 | return Create(Ctx, FeaturesStrs, FeaturesStrsSize, I); |
||
29727 | } |
||
29728 | |||
29729 | TargetClonesAttr::TargetClonesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29730 | , StringRef *FeaturesStrs, unsigned FeaturesStrsSize |
||
29731 | ) |
||
29732 | : InheritableAttr(Ctx, CommonInfo, attr::TargetClones, false, false) |
||
29733 | , featuresStrs_Size(FeaturesStrsSize), featuresStrs_(new (Ctx, 16) StringRef[featuresStrs_Size]) |
||
29734 | { |
||
29735 | for (size_t I = 0, E = featuresStrs_Size; I != E; |
||
29736 | ++I) { |
||
29737 | StringRef Ref = FeaturesStrs[I]; |
||
29738 | if (!Ref.empty()) { |
||
29739 | char *Mem = new (Ctx, 1) char[Ref.size()]; |
||
29740 | std::memcpy(Mem, Ref.data(), Ref.size()); |
||
29741 | featuresStrs_[I] = StringRef(Mem, Ref.size()); |
||
29742 | } |
||
29743 | } |
||
29744 | } |
||
29745 | |||
29746 | TargetClonesAttr::TargetClonesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29747 | ) |
||
29748 | : InheritableAttr(Ctx, CommonInfo, attr::TargetClones, false, false) |
||
29749 | , featuresStrs_Size(0), featuresStrs_(nullptr) |
||
29750 | { |
||
29751 | } |
||
29752 | |||
29753 | |||
29754 | |||
29755 | TargetClonesAttr *TargetClonesAttr::clone(ASTContext &C) const { |
||
29756 | auto *A = new (C) TargetClonesAttr(C, *this, featuresStrs_, featuresStrs_Size); |
||
29757 | A->Inherited = Inherited; |
||
29758 | A->IsPackExpansion = IsPackExpansion; |
||
29759 | A->setImplicit(Implicit); |
||
29760 | return A; |
||
29761 | } |
||
29762 | |||
29763 | void TargetClonesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29764 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29765 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29766 | switch (getAttributeSpellingListIndex()) { |
||
29767 | default: |
||
29768 | llvm_unreachable("Unknown attribute spelling!"); |
||
29769 | break; |
||
29770 | case 0 : { |
||
29771 | OS << " __attribute__((target_clones"; |
||
29772 | OS << ""; |
||
29773 | for (const auto &Val : featuresStrs()) { |
||
29774 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29775 | OS << "\"" << Val << "\""; |
||
29776 | } |
||
29777 | OS << ""; |
||
29778 | if (!IsFirstArgument) |
||
29779 | OS << ")"; |
||
29780 | OS << "))"; |
||
29781 | break; |
||
29782 | } |
||
29783 | case 1 : { |
||
29784 | OS << " [[gnu::target_clones"; |
||
29785 | OS << ""; |
||
29786 | for (const auto &Val : featuresStrs()) { |
||
29787 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29788 | OS << "\"" << Val << "\""; |
||
29789 | } |
||
29790 | OS << ""; |
||
29791 | if (!IsFirstArgument) |
||
29792 | OS << ")"; |
||
29793 | OS << "]]"; |
||
29794 | break; |
||
29795 | } |
||
29796 | case 2 : { |
||
29797 | OS << " [[gnu::target_clones"; |
||
29798 | OS << ""; |
||
29799 | for (const auto &Val : featuresStrs()) { |
||
29800 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29801 | OS << "\"" << Val << "\""; |
||
29802 | } |
||
29803 | OS << ""; |
||
29804 | if (!IsFirstArgument) |
||
29805 | OS << ")"; |
||
29806 | OS << "]]"; |
||
29807 | break; |
||
29808 | } |
||
29809 | } |
||
29810 | } |
||
29811 | |||
29812 | const char *TargetClonesAttr::getSpelling() const { |
||
29813 | switch (getAttributeSpellingListIndex()) { |
||
29814 | default: |
||
29815 | llvm_unreachable("Unknown attribute spelling!"); |
||
29816 | return "(No spelling)"; |
||
29817 | case 0: |
||
29818 | return "target_clones"; |
||
29819 | case 1: |
||
29820 | return "target_clones"; |
||
29821 | case 2: |
||
29822 | return "target_clones"; |
||
29823 | } |
||
29824 | } |
||
29825 | |||
29826 | |||
29827 | // TargetVersionAttr implementation |
||
29828 | |||
29829 | TargetVersionAttr *TargetVersionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef NamesStr, const AttributeCommonInfo &CommonInfo) { |
||
29830 | auto *A = new (Ctx) TargetVersionAttr(Ctx, CommonInfo, NamesStr); |
||
29831 | A->setImplicit(true); |
||
29832 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29833 | A->setAttributeSpellingListIndex(0); |
||
29834 | return A; |
||
29835 | } |
||
29836 | |||
29837 | TargetVersionAttr *TargetVersionAttr::Create(ASTContext &Ctx, llvm::StringRef NamesStr, const AttributeCommonInfo &CommonInfo) { |
||
29838 | auto *A = new (Ctx) TargetVersionAttr(Ctx, CommonInfo, NamesStr); |
||
29839 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29840 | A->setAttributeSpellingListIndex(0); |
||
29841 | return A; |
||
29842 | } |
||
29843 | |||
29844 | TargetVersionAttr *TargetVersionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef NamesStr, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29845 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29846 | return CreateImplicit(Ctx, NamesStr, I); |
||
29847 | } |
||
29848 | |||
29849 | TargetVersionAttr *TargetVersionAttr::Create(ASTContext &Ctx, llvm::StringRef NamesStr, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29850 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29851 | return Create(Ctx, NamesStr, I); |
||
29852 | } |
||
29853 | |||
29854 | TargetVersionAttr::TargetVersionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29855 | , llvm::StringRef NamesStr |
||
29856 | ) |
||
29857 | : InheritableAttr(Ctx, CommonInfo, attr::TargetVersion, false, false) |
||
29858 | , namesStrLength(NamesStr.size()),namesStr(new (Ctx, 1) char[namesStrLength]) |
||
29859 | { |
||
29860 | if (!NamesStr.empty()) |
||
29861 | std::memcpy(namesStr, NamesStr.data(), namesStrLength); |
||
29862 | } |
||
29863 | |||
29864 | |||
29865 | |||
29866 | TargetVersionAttr *TargetVersionAttr::clone(ASTContext &C) const { |
||
29867 | auto *A = new (C) TargetVersionAttr(C, *this, getNamesStr()); |
||
29868 | A->Inherited = Inherited; |
||
29869 | A->IsPackExpansion = IsPackExpansion; |
||
29870 | A->setImplicit(Implicit); |
||
29871 | return A; |
||
29872 | } |
||
29873 | |||
29874 | void TargetVersionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29875 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29876 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29877 | switch (getAttributeSpellingListIndex()) { |
||
29878 | default: |
||
29879 | llvm_unreachable("Unknown attribute spelling!"); |
||
29880 | break; |
||
29881 | case 0 : { |
||
29882 | OS << " __attribute__((target_version"; |
||
29883 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29884 | OS << "\"" << getNamesStr() << "\""; |
||
29885 | if (!IsFirstArgument) |
||
29886 | OS << ")"; |
||
29887 | OS << "))"; |
||
29888 | break; |
||
29889 | } |
||
29890 | case 1 : { |
||
29891 | OS << " [[gnu::target_version"; |
||
29892 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29893 | OS << "\"" << getNamesStr() << "\""; |
||
29894 | if (!IsFirstArgument) |
||
29895 | OS << ")"; |
||
29896 | OS << "]]"; |
||
29897 | break; |
||
29898 | } |
||
29899 | case 2 : { |
||
29900 | OS << " [[gnu::target_version"; |
||
29901 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
29902 | OS << "\"" << getNamesStr() << "\""; |
||
29903 | if (!IsFirstArgument) |
||
29904 | OS << ")"; |
||
29905 | OS << "]]"; |
||
29906 | break; |
||
29907 | } |
||
29908 | } |
||
29909 | } |
||
29910 | |||
29911 | const char *TargetVersionAttr::getSpelling() const { |
||
29912 | switch (getAttributeSpellingListIndex()) { |
||
29913 | default: |
||
29914 | llvm_unreachable("Unknown attribute spelling!"); |
||
29915 | return "(No spelling)"; |
||
29916 | case 0: |
||
29917 | return "target_version"; |
||
29918 | case 1: |
||
29919 | return "target_version"; |
||
29920 | case 2: |
||
29921 | return "target_version"; |
||
29922 | } |
||
29923 | } |
||
29924 | |||
29925 | |||
29926 | // TestTypestateAttr implementation |
||
29927 | |||
29928 | TestTypestateAttr *TestTypestateAttr::CreateImplicit(ASTContext &Ctx, ConsumedState TestState, const AttributeCommonInfo &CommonInfo) { |
||
29929 | auto *A = new (Ctx) TestTypestateAttr(Ctx, CommonInfo, TestState); |
||
29930 | A->setImplicit(true); |
||
29931 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29932 | A->setAttributeSpellingListIndex(0); |
||
29933 | return A; |
||
29934 | } |
||
29935 | |||
29936 | TestTypestateAttr *TestTypestateAttr::Create(ASTContext &Ctx, ConsumedState TestState, const AttributeCommonInfo &CommonInfo) { |
||
29937 | auto *A = new (Ctx) TestTypestateAttr(Ctx, CommonInfo, TestState); |
||
29938 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
29939 | A->setAttributeSpellingListIndex(0); |
||
29940 | return A; |
||
29941 | } |
||
29942 | |||
29943 | TestTypestateAttr *TestTypestateAttr::CreateImplicit(ASTContext &Ctx, ConsumedState TestState, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29944 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29945 | return CreateImplicit(Ctx, TestState, I); |
||
29946 | } |
||
29947 | |||
29948 | TestTypestateAttr *TestTypestateAttr::Create(ASTContext &Ctx, ConsumedState TestState, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
29949 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
29950 | return Create(Ctx, TestState, I); |
||
29951 | } |
||
29952 | |||
29953 | TestTypestateAttr::TestTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
29954 | , ConsumedState TestState |
||
29955 | ) |
||
29956 | : InheritableAttr(Ctx, CommonInfo, attr::TestTypestate, false, false) |
||
29957 | , testState(TestState) |
||
29958 | { |
||
29959 | } |
||
29960 | |||
29961 | |||
29962 | |||
29963 | bool TestTypestateAttr::ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) { |
||
29964 | std::optional<ConsumedState> R = llvm::StringSwitch<std::optional<ConsumedState>>(Val) |
||
29965 | .Case("consumed", TestTypestateAttr::Consumed) |
||
29966 | .Case("unconsumed", TestTypestateAttr::Unconsumed) |
||
29967 | .Default(std::optional<ConsumedState>()); |
||
29968 | if (R) { |
||
29969 | Out = *R; |
||
29970 | return true; |
||
29971 | } |
||
29972 | return false; |
||
29973 | } |
||
29974 | |||
29975 | const char *TestTypestateAttr::ConvertConsumedStateToStr(ConsumedState Val) { |
||
29976 | switch(Val) { |
||
29977 | case TestTypestateAttr::Consumed: return "consumed"; |
||
29978 | case TestTypestateAttr::Unconsumed: return "unconsumed"; |
||
29979 | } |
||
29980 | llvm_unreachable("No enumerator with that value"); |
||
29981 | } |
||
29982 | TestTypestateAttr *TestTypestateAttr::clone(ASTContext &C) const { |
||
29983 | auto *A = new (C) TestTypestateAttr(C, *this, testState); |
||
29984 | A->Inherited = Inherited; |
||
29985 | A->IsPackExpansion = IsPackExpansion; |
||
29986 | A->setImplicit(Implicit); |
||
29987 | return A; |
||
29988 | } |
||
29989 | |||
29990 | void TestTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
29991 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
29992 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
29993 | switch (getAttributeSpellingListIndex()) { |
||
29994 | default: |
||
29995 | llvm_unreachable("Unknown attribute spelling!"); |
||
29996 | break; |
||
29997 | case 0 : { |
||
29998 | OS << " __attribute__((test_typestate"; |
||
29999 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30000 | OS << "\"" << TestTypestateAttr::ConvertConsumedStateToStr(getTestState()) << "\""; |
||
30001 | if (!IsFirstArgument) |
||
30002 | OS << ")"; |
||
30003 | OS << "))"; |
||
30004 | break; |
||
30005 | } |
||
30006 | case 1 : { |
||
30007 | OS << " [[clang::test_typestate"; |
||
30008 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30009 | OS << "\"" << TestTypestateAttr::ConvertConsumedStateToStr(getTestState()) << "\""; |
||
30010 | if (!IsFirstArgument) |
||
30011 | OS << ")"; |
||
30012 | OS << "]]"; |
||
30013 | break; |
||
30014 | } |
||
30015 | } |
||
30016 | } |
||
30017 | |||
30018 | const char *TestTypestateAttr::getSpelling() const { |
||
30019 | switch (getAttributeSpellingListIndex()) { |
||
30020 | default: |
||
30021 | llvm_unreachable("Unknown attribute spelling!"); |
||
30022 | return "(No spelling)"; |
||
30023 | case 0: |
||
30024 | return "test_typestate"; |
||
30025 | case 1: |
||
30026 | return "test_typestate"; |
||
30027 | } |
||
30028 | } |
||
30029 | |||
30030 | |||
30031 | // ThisCallAttr implementation |
||
30032 | |||
30033 | ThisCallAttr *ThisCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30034 | auto *A = new (Ctx) ThisCallAttr(Ctx, CommonInfo); |
||
30035 | A->setImplicit(true); |
||
30036 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30037 | A->setAttributeSpellingListIndex(0); |
||
30038 | return A; |
||
30039 | } |
||
30040 | |||
30041 | ThisCallAttr *ThisCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30042 | auto *A = new (Ctx) ThisCallAttr(Ctx, CommonInfo); |
||
30043 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30044 | A->setAttributeSpellingListIndex(0); |
||
30045 | return A; |
||
30046 | } |
||
30047 | |||
30048 | ThisCallAttr *ThisCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30049 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30050 | return CreateImplicit(Ctx, I); |
||
30051 | } |
||
30052 | |||
30053 | ThisCallAttr *ThisCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30054 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30055 | return Create(Ctx, I); |
||
30056 | } |
||
30057 | |||
30058 | ThisCallAttr::ThisCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30059 | ) |
||
30060 | : InheritableAttr(Ctx, CommonInfo, attr::ThisCall, false, false) |
||
30061 | { |
||
30062 | } |
||
30063 | |||
30064 | ThisCallAttr *ThisCallAttr::clone(ASTContext &C) const { |
||
30065 | auto *A = new (C) ThisCallAttr(C, *this); |
||
30066 | A->Inherited = Inherited; |
||
30067 | A->IsPackExpansion = IsPackExpansion; |
||
30068 | A->setImplicit(Implicit); |
||
30069 | return A; |
||
30070 | } |
||
30071 | |||
30072 | void ThisCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30073 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30074 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30075 | switch (getAttributeSpellingListIndex()) { |
||
30076 | default: |
||
30077 | llvm_unreachable("Unknown attribute spelling!"); |
||
30078 | break; |
||
30079 | case 0 : { |
||
30080 | OS << " __attribute__((thiscall"; |
||
30081 | OS << "))"; |
||
30082 | break; |
||
30083 | } |
||
30084 | case 1 : { |
||
30085 | OS << " [[gnu::thiscall"; |
||
30086 | OS << "]]"; |
||
30087 | break; |
||
30088 | } |
||
30089 | case 2 : { |
||
30090 | OS << " [[gnu::thiscall"; |
||
30091 | OS << "]]"; |
||
30092 | break; |
||
30093 | } |
||
30094 | case 3 : { |
||
30095 | OS << " __thiscall"; |
||
30096 | OS << ""; |
||
30097 | break; |
||
30098 | } |
||
30099 | case 4 : { |
||
30100 | OS << " _thiscall"; |
||
30101 | OS << ""; |
||
30102 | break; |
||
30103 | } |
||
30104 | } |
||
30105 | } |
||
30106 | |||
30107 | const char *ThisCallAttr::getSpelling() const { |
||
30108 | switch (getAttributeSpellingListIndex()) { |
||
30109 | default: |
||
30110 | llvm_unreachable("Unknown attribute spelling!"); |
||
30111 | return "(No spelling)"; |
||
30112 | case 0: |
||
30113 | return "thiscall"; |
||
30114 | case 1: |
||
30115 | return "thiscall"; |
||
30116 | case 2: |
||
30117 | return "thiscall"; |
||
30118 | case 3: |
||
30119 | return "__thiscall"; |
||
30120 | case 4: |
||
30121 | return "_thiscall"; |
||
30122 | } |
||
30123 | } |
||
30124 | |||
30125 | |||
30126 | // ThreadAttr implementation |
||
30127 | |||
30128 | ThreadAttr *ThreadAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30129 | auto *A = new (Ctx) ThreadAttr(Ctx, CommonInfo); |
||
30130 | A->setImplicit(true); |
||
30131 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30132 | A->setAttributeSpellingListIndex(0); |
||
30133 | return A; |
||
30134 | } |
||
30135 | |||
30136 | ThreadAttr *ThreadAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30137 | auto *A = new (Ctx) ThreadAttr(Ctx, CommonInfo); |
||
30138 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30139 | A->setAttributeSpellingListIndex(0); |
||
30140 | return A; |
||
30141 | } |
||
30142 | |||
30143 | ThreadAttr *ThreadAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30144 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30145 | return CreateImplicit(Ctx, I); |
||
30146 | } |
||
30147 | |||
30148 | ThreadAttr *ThreadAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30149 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30150 | return Create(Ctx, I); |
||
30151 | } |
||
30152 | |||
30153 | ThreadAttr::ThreadAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30154 | ) |
||
30155 | : Attr(Ctx, CommonInfo, attr::Thread, false) |
||
30156 | { |
||
30157 | } |
||
30158 | |||
30159 | ThreadAttr *ThreadAttr::clone(ASTContext &C) const { |
||
30160 | auto *A = new (C) ThreadAttr(C, *this); |
||
30161 | A->Inherited = Inherited; |
||
30162 | A->IsPackExpansion = IsPackExpansion; |
||
30163 | A->setImplicit(Implicit); |
||
30164 | return A; |
||
30165 | } |
||
30166 | |||
30167 | void ThreadAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30168 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30169 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30170 | switch (getAttributeSpellingListIndex()) { |
||
30171 | default: |
||
30172 | llvm_unreachable("Unknown attribute spelling!"); |
||
30173 | break; |
||
30174 | case 0 : { |
||
30175 | OS << " __declspec(thread"; |
||
30176 | OS << ")"; |
||
30177 | break; |
||
30178 | } |
||
30179 | } |
||
30180 | } |
||
30181 | |||
30182 | const char *ThreadAttr::getSpelling() const { |
||
30183 | switch (getAttributeSpellingListIndex()) { |
||
30184 | default: |
||
30185 | llvm_unreachable("Unknown attribute spelling!"); |
||
30186 | return "(No spelling)"; |
||
30187 | case 0: |
||
30188 | return "thread"; |
||
30189 | } |
||
30190 | } |
||
30191 | |||
30192 | |||
30193 | // TransparentUnionAttr implementation |
||
30194 | |||
30195 | TransparentUnionAttr *TransparentUnionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30196 | auto *A = new (Ctx) TransparentUnionAttr(Ctx, CommonInfo); |
||
30197 | A->setImplicit(true); |
||
30198 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30199 | A->setAttributeSpellingListIndex(0); |
||
30200 | return A; |
||
30201 | } |
||
30202 | |||
30203 | TransparentUnionAttr *TransparentUnionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30204 | auto *A = new (Ctx) TransparentUnionAttr(Ctx, CommonInfo); |
||
30205 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30206 | A->setAttributeSpellingListIndex(0); |
||
30207 | return A; |
||
30208 | } |
||
30209 | |||
30210 | TransparentUnionAttr *TransparentUnionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30211 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30212 | return CreateImplicit(Ctx, I); |
||
30213 | } |
||
30214 | |||
30215 | TransparentUnionAttr *TransparentUnionAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30216 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30217 | return Create(Ctx, I); |
||
30218 | } |
||
30219 | |||
30220 | TransparentUnionAttr::TransparentUnionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30221 | ) |
||
30222 | : InheritableAttr(Ctx, CommonInfo, attr::TransparentUnion, false, false) |
||
30223 | { |
||
30224 | } |
||
30225 | |||
30226 | TransparentUnionAttr *TransparentUnionAttr::clone(ASTContext &C) const { |
||
30227 | auto *A = new (C) TransparentUnionAttr(C, *this); |
||
30228 | A->Inherited = Inherited; |
||
30229 | A->IsPackExpansion = IsPackExpansion; |
||
30230 | A->setImplicit(Implicit); |
||
30231 | return A; |
||
30232 | } |
||
30233 | |||
30234 | void TransparentUnionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30235 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30236 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30237 | switch (getAttributeSpellingListIndex()) { |
||
30238 | default: |
||
30239 | llvm_unreachable("Unknown attribute spelling!"); |
||
30240 | break; |
||
30241 | case 0 : { |
||
30242 | OS << " __attribute__((transparent_union"; |
||
30243 | OS << "))"; |
||
30244 | break; |
||
30245 | } |
||
30246 | case 1 : { |
||
30247 | OS << " [[gnu::transparent_union"; |
||
30248 | OS << "]]"; |
||
30249 | break; |
||
30250 | } |
||
30251 | case 2 : { |
||
30252 | OS << " [[gnu::transparent_union"; |
||
30253 | OS << "]]"; |
||
30254 | break; |
||
30255 | } |
||
30256 | } |
||
30257 | } |
||
30258 | |||
30259 | const char *TransparentUnionAttr::getSpelling() const { |
||
30260 | switch (getAttributeSpellingListIndex()) { |
||
30261 | default: |
||
30262 | llvm_unreachable("Unknown attribute spelling!"); |
||
30263 | return "(No spelling)"; |
||
30264 | case 0: |
||
30265 | return "transparent_union"; |
||
30266 | case 1: |
||
30267 | return "transparent_union"; |
||
30268 | case 2: |
||
30269 | return "transparent_union"; |
||
30270 | } |
||
30271 | } |
||
30272 | |||
30273 | |||
30274 | // TrivialABIAttr implementation |
||
30275 | |||
30276 | TrivialABIAttr *TrivialABIAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30277 | auto *A = new (Ctx) TrivialABIAttr(Ctx, CommonInfo); |
||
30278 | A->setImplicit(true); |
||
30279 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30280 | A->setAttributeSpellingListIndex(0); |
||
30281 | return A; |
||
30282 | } |
||
30283 | |||
30284 | TrivialABIAttr *TrivialABIAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30285 | auto *A = new (Ctx) TrivialABIAttr(Ctx, CommonInfo); |
||
30286 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30287 | A->setAttributeSpellingListIndex(0); |
||
30288 | return A; |
||
30289 | } |
||
30290 | |||
30291 | TrivialABIAttr *TrivialABIAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30292 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30293 | return CreateImplicit(Ctx, I); |
||
30294 | } |
||
30295 | |||
30296 | TrivialABIAttr *TrivialABIAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30297 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30298 | return Create(Ctx, I); |
||
30299 | } |
||
30300 | |||
30301 | TrivialABIAttr::TrivialABIAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30302 | ) |
||
30303 | : InheritableAttr(Ctx, CommonInfo, attr::TrivialABI, false, false) |
||
30304 | { |
||
30305 | } |
||
30306 | |||
30307 | TrivialABIAttr *TrivialABIAttr::clone(ASTContext &C) const { |
||
30308 | auto *A = new (C) TrivialABIAttr(C, *this); |
||
30309 | A->Inherited = Inherited; |
||
30310 | A->IsPackExpansion = IsPackExpansion; |
||
30311 | A->setImplicit(Implicit); |
||
30312 | return A; |
||
30313 | } |
||
30314 | |||
30315 | void TrivialABIAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30316 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30317 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30318 | switch (getAttributeSpellingListIndex()) { |
||
30319 | default: |
||
30320 | llvm_unreachable("Unknown attribute spelling!"); |
||
30321 | break; |
||
30322 | case 0 : { |
||
30323 | OS << " __attribute__((trivial_abi"; |
||
30324 | OS << "))"; |
||
30325 | break; |
||
30326 | } |
||
30327 | case 1 : { |
||
30328 | OS << " [[clang::trivial_abi"; |
||
30329 | OS << "]]"; |
||
30330 | break; |
||
30331 | } |
||
30332 | } |
||
30333 | } |
||
30334 | |||
30335 | const char *TrivialABIAttr::getSpelling() const { |
||
30336 | switch (getAttributeSpellingListIndex()) { |
||
30337 | default: |
||
30338 | llvm_unreachable("Unknown attribute spelling!"); |
||
30339 | return "(No spelling)"; |
||
30340 | case 0: |
||
30341 | return "trivial_abi"; |
||
30342 | case 1: |
||
30343 | return "trivial_abi"; |
||
30344 | } |
||
30345 | } |
||
30346 | |||
30347 | |||
30348 | // TryAcquireCapabilityAttr implementation |
||
30349 | |||
30350 | TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
30351 | auto *A = new (Ctx) TryAcquireCapabilityAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); |
||
30352 | A->setImplicit(true); |
||
30353 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30354 | A->setAttributeSpellingListIndex(0); |
||
30355 | return A; |
||
30356 | } |
||
30357 | |||
30358 | TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { |
||
30359 | auto *A = new (Ctx) TryAcquireCapabilityAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); |
||
30360 | return A; |
||
30361 | } |
||
30362 | |||
30363 | TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, TryAcquireCapabilityAttr::Spelling S) { |
||
30364 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
30365 | return CreateImplicit(Ctx, SuccessValue, Args, ArgsSize, I); |
||
30366 | } |
||
30367 | |||
30368 | TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, AttributeCommonInfo::Syntax Syntax, TryAcquireCapabilityAttr::Spelling S) { |
||
30369 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
30370 | return Create(Ctx, SuccessValue, Args, ArgsSize, I); |
||
30371 | } |
||
30372 | |||
30373 | TryAcquireCapabilityAttr::TryAcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30374 | , Expr * SuccessValue |
||
30375 | , Expr * *Args, unsigned ArgsSize |
||
30376 | ) |
||
30377 | : InheritableAttr(Ctx, CommonInfo, attr::TryAcquireCapability, true, true) |
||
30378 | , successValue(SuccessValue) |
||
30379 | , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) |
||
30380 | { |
||
30381 | std::copy(Args, Args + args_Size, args_); |
||
30382 | } |
||
30383 | |||
30384 | TryAcquireCapabilityAttr::TryAcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30385 | , Expr * SuccessValue |
||
30386 | ) |
||
30387 | : InheritableAttr(Ctx, CommonInfo, attr::TryAcquireCapability, true, true) |
||
30388 | , successValue(SuccessValue) |
||
30389 | , args_Size(0), args_(nullptr) |
||
30390 | { |
||
30391 | } |
||
30392 | |||
30393 | TryAcquireCapabilityAttr::Spelling TryAcquireCapabilityAttr::getSemanticSpelling() const { |
||
30394 | switch (getAttributeSpellingListIndex()) { |
||
30395 | default: llvm_unreachable("Unknown spelling list index"); |
||
30396 | case 0: return GNU_try_acquire_capability; |
||
30397 | case 1: return CXX11_clang_try_acquire_capability; |
||
30398 | case 2: return GNU_try_acquire_shared_capability; |
||
30399 | case 3: return CXX11_clang_try_acquire_shared_capability; |
||
30400 | } |
||
30401 | } |
||
30402 | |||
30403 | |||
30404 | |||
30405 | |||
30406 | TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::clone(ASTContext &C) const { |
||
30407 | auto *A = new (C) TryAcquireCapabilityAttr(C, *this, successValue, args_, args_Size); |
||
30408 | A->Inherited = Inherited; |
||
30409 | A->IsPackExpansion = IsPackExpansion; |
||
30410 | A->setImplicit(Implicit); |
||
30411 | return A; |
||
30412 | } |
||
30413 | |||
30414 | void TryAcquireCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30415 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30416 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30417 | switch (getAttributeSpellingListIndex()) { |
||
30418 | default: |
||
30419 | llvm_unreachable("Unknown attribute spelling!"); |
||
30420 | break; |
||
30421 | case 0 : { |
||
30422 | OS << " __attribute__((try_acquire_capability"; |
||
30423 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30424 | OS << ""; |
||
30425 | getSuccessValue()->printPretty(OS, nullptr, Policy); |
||
30426 | OS << ""; |
||
30427 | OS << ""; |
||
30428 | for (const auto &Val : args()) { |
||
30429 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30430 | OS << Val; |
||
30431 | } |
||
30432 | OS << ""; |
||
30433 | if (!IsFirstArgument) |
||
30434 | OS << ")"; |
||
30435 | OS << "))"; |
||
30436 | break; |
||
30437 | } |
||
30438 | case 1 : { |
||
30439 | OS << " [[clang::try_acquire_capability"; |
||
30440 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30441 | OS << ""; |
||
30442 | getSuccessValue()->printPretty(OS, nullptr, Policy); |
||
30443 | OS << ""; |
||
30444 | OS << ""; |
||
30445 | for (const auto &Val : args()) { |
||
30446 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30447 | OS << Val; |
||
30448 | } |
||
30449 | OS << ""; |
||
30450 | if (!IsFirstArgument) |
||
30451 | OS << ")"; |
||
30452 | OS << "]]"; |
||
30453 | break; |
||
30454 | } |
||
30455 | case 2 : { |
||
30456 | OS << " __attribute__((try_acquire_shared_capability"; |
||
30457 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30458 | OS << ""; |
||
30459 | getSuccessValue()->printPretty(OS, nullptr, Policy); |
||
30460 | OS << ""; |
||
30461 | OS << ""; |
||
30462 | for (const auto &Val : args()) { |
||
30463 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30464 | OS << Val; |
||
30465 | } |
||
30466 | OS << ""; |
||
30467 | if (!IsFirstArgument) |
||
30468 | OS << ")"; |
||
30469 | OS << "))"; |
||
30470 | break; |
||
30471 | } |
||
30472 | case 3 : { |
||
30473 | OS << " [[clang::try_acquire_shared_capability"; |
||
30474 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30475 | OS << ""; |
||
30476 | getSuccessValue()->printPretty(OS, nullptr, Policy); |
||
30477 | OS << ""; |
||
30478 | OS << ""; |
||
30479 | for (const auto &Val : args()) { |
||
30480 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30481 | OS << Val; |
||
30482 | } |
||
30483 | OS << ""; |
||
30484 | if (!IsFirstArgument) |
||
30485 | OS << ")"; |
||
30486 | OS << "]]"; |
||
30487 | break; |
||
30488 | } |
||
30489 | } |
||
30490 | } |
||
30491 | |||
30492 | const char *TryAcquireCapabilityAttr::getSpelling() const { |
||
30493 | switch (getAttributeSpellingListIndex()) { |
||
30494 | default: |
||
30495 | llvm_unreachable("Unknown attribute spelling!"); |
||
30496 | return "(No spelling)"; |
||
30497 | case 0: |
||
30498 | return "try_acquire_capability"; |
||
30499 | case 1: |
||
30500 | return "try_acquire_capability"; |
||
30501 | case 2: |
||
30502 | return "try_acquire_shared_capability"; |
||
30503 | case 3: |
||
30504 | return "try_acquire_shared_capability"; |
||
30505 | } |
||
30506 | } |
||
30507 | |||
30508 | |||
30509 | // TypeNonNullAttr implementation |
||
30510 | |||
30511 | TypeNonNullAttr *TypeNonNullAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30512 | auto *A = new (Ctx) TypeNonNullAttr(Ctx, CommonInfo); |
||
30513 | A->setImplicit(true); |
||
30514 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30515 | A->setAttributeSpellingListIndex(0); |
||
30516 | return A; |
||
30517 | } |
||
30518 | |||
30519 | TypeNonNullAttr *TypeNonNullAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30520 | auto *A = new (Ctx) TypeNonNullAttr(Ctx, CommonInfo); |
||
30521 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30522 | A->setAttributeSpellingListIndex(0); |
||
30523 | return A; |
||
30524 | } |
||
30525 | |||
30526 | TypeNonNullAttr *TypeNonNullAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30527 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30528 | return CreateImplicit(Ctx, I); |
||
30529 | } |
||
30530 | |||
30531 | TypeNonNullAttr *TypeNonNullAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30532 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30533 | return Create(Ctx, I); |
||
30534 | } |
||
30535 | |||
30536 | TypeNonNullAttr::TypeNonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30537 | ) |
||
30538 | : TypeAttr(Ctx, CommonInfo, attr::TypeNonNull, false) |
||
30539 | { |
||
30540 | } |
||
30541 | |||
30542 | TypeNonNullAttr *TypeNonNullAttr::clone(ASTContext &C) const { |
||
30543 | auto *A = new (C) TypeNonNullAttr(C, *this); |
||
30544 | A->Inherited = Inherited; |
||
30545 | A->IsPackExpansion = IsPackExpansion; |
||
30546 | A->setImplicit(Implicit); |
||
30547 | return A; |
||
30548 | } |
||
30549 | |||
30550 | void TypeNonNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30551 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30552 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30553 | switch (getAttributeSpellingListIndex()) { |
||
30554 | default: |
||
30555 | llvm_unreachable("Unknown attribute spelling!"); |
||
30556 | break; |
||
30557 | case 0 : { |
||
30558 | OS << " _Nonnull"; |
||
30559 | OS << ""; |
||
30560 | break; |
||
30561 | } |
||
30562 | } |
||
30563 | } |
||
30564 | |||
30565 | const char *TypeNonNullAttr::getSpelling() const { |
||
30566 | switch (getAttributeSpellingListIndex()) { |
||
30567 | default: |
||
30568 | llvm_unreachable("Unknown attribute spelling!"); |
||
30569 | return "(No spelling)"; |
||
30570 | case 0: |
||
30571 | return "_Nonnull"; |
||
30572 | } |
||
30573 | } |
||
30574 | |||
30575 | |||
30576 | // TypeNullUnspecifiedAttr implementation |
||
30577 | |||
30578 | TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30579 | auto *A = new (Ctx) TypeNullUnspecifiedAttr(Ctx, CommonInfo); |
||
30580 | A->setImplicit(true); |
||
30581 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30582 | A->setAttributeSpellingListIndex(0); |
||
30583 | return A; |
||
30584 | } |
||
30585 | |||
30586 | TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30587 | auto *A = new (Ctx) TypeNullUnspecifiedAttr(Ctx, CommonInfo); |
||
30588 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30589 | A->setAttributeSpellingListIndex(0); |
||
30590 | return A; |
||
30591 | } |
||
30592 | |||
30593 | TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30594 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30595 | return CreateImplicit(Ctx, I); |
||
30596 | } |
||
30597 | |||
30598 | TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30599 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30600 | return Create(Ctx, I); |
||
30601 | } |
||
30602 | |||
30603 | TypeNullUnspecifiedAttr::TypeNullUnspecifiedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30604 | ) |
||
30605 | : TypeAttr(Ctx, CommonInfo, attr::TypeNullUnspecified, false) |
||
30606 | { |
||
30607 | } |
||
30608 | |||
30609 | TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::clone(ASTContext &C) const { |
||
30610 | auto *A = new (C) TypeNullUnspecifiedAttr(C, *this); |
||
30611 | A->Inherited = Inherited; |
||
30612 | A->IsPackExpansion = IsPackExpansion; |
||
30613 | A->setImplicit(Implicit); |
||
30614 | return A; |
||
30615 | } |
||
30616 | |||
30617 | void TypeNullUnspecifiedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30618 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30619 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30620 | switch (getAttributeSpellingListIndex()) { |
||
30621 | default: |
||
30622 | llvm_unreachable("Unknown attribute spelling!"); |
||
30623 | break; |
||
30624 | case 0 : { |
||
30625 | OS << " _Null_unspecified"; |
||
30626 | OS << ""; |
||
30627 | break; |
||
30628 | } |
||
30629 | } |
||
30630 | } |
||
30631 | |||
30632 | const char *TypeNullUnspecifiedAttr::getSpelling() const { |
||
30633 | switch (getAttributeSpellingListIndex()) { |
||
30634 | default: |
||
30635 | llvm_unreachable("Unknown attribute spelling!"); |
||
30636 | return "(No spelling)"; |
||
30637 | case 0: |
||
30638 | return "_Null_unspecified"; |
||
30639 | } |
||
30640 | } |
||
30641 | |||
30642 | |||
30643 | // TypeNullableAttr implementation |
||
30644 | |||
30645 | TypeNullableAttr *TypeNullableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30646 | auto *A = new (Ctx) TypeNullableAttr(Ctx, CommonInfo); |
||
30647 | A->setImplicit(true); |
||
30648 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30649 | A->setAttributeSpellingListIndex(0); |
||
30650 | return A; |
||
30651 | } |
||
30652 | |||
30653 | TypeNullableAttr *TypeNullableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30654 | auto *A = new (Ctx) TypeNullableAttr(Ctx, CommonInfo); |
||
30655 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30656 | A->setAttributeSpellingListIndex(0); |
||
30657 | return A; |
||
30658 | } |
||
30659 | |||
30660 | TypeNullableAttr *TypeNullableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30661 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30662 | return CreateImplicit(Ctx, I); |
||
30663 | } |
||
30664 | |||
30665 | TypeNullableAttr *TypeNullableAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30666 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30667 | return Create(Ctx, I); |
||
30668 | } |
||
30669 | |||
30670 | TypeNullableAttr::TypeNullableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30671 | ) |
||
30672 | : TypeAttr(Ctx, CommonInfo, attr::TypeNullable, false) |
||
30673 | { |
||
30674 | } |
||
30675 | |||
30676 | TypeNullableAttr *TypeNullableAttr::clone(ASTContext &C) const { |
||
30677 | auto *A = new (C) TypeNullableAttr(C, *this); |
||
30678 | A->Inherited = Inherited; |
||
30679 | A->IsPackExpansion = IsPackExpansion; |
||
30680 | A->setImplicit(Implicit); |
||
30681 | return A; |
||
30682 | } |
||
30683 | |||
30684 | void TypeNullableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30685 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30686 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30687 | switch (getAttributeSpellingListIndex()) { |
||
30688 | default: |
||
30689 | llvm_unreachable("Unknown attribute spelling!"); |
||
30690 | break; |
||
30691 | case 0 : { |
||
30692 | OS << " _Nullable"; |
||
30693 | OS << ""; |
||
30694 | break; |
||
30695 | } |
||
30696 | } |
||
30697 | } |
||
30698 | |||
30699 | const char *TypeNullableAttr::getSpelling() const { |
||
30700 | switch (getAttributeSpellingListIndex()) { |
||
30701 | default: |
||
30702 | llvm_unreachable("Unknown attribute spelling!"); |
||
30703 | return "(No spelling)"; |
||
30704 | case 0: |
||
30705 | return "_Nullable"; |
||
30706 | } |
||
30707 | } |
||
30708 | |||
30709 | |||
30710 | // TypeNullableResultAttr implementation |
||
30711 | |||
30712 | TypeNullableResultAttr *TypeNullableResultAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30713 | auto *A = new (Ctx) TypeNullableResultAttr(Ctx, CommonInfo); |
||
30714 | A->setImplicit(true); |
||
30715 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30716 | A->setAttributeSpellingListIndex(0); |
||
30717 | return A; |
||
30718 | } |
||
30719 | |||
30720 | TypeNullableResultAttr *TypeNullableResultAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
30721 | auto *A = new (Ctx) TypeNullableResultAttr(Ctx, CommonInfo); |
||
30722 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30723 | A->setAttributeSpellingListIndex(0); |
||
30724 | return A; |
||
30725 | } |
||
30726 | |||
30727 | TypeNullableResultAttr *TypeNullableResultAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30728 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30729 | return CreateImplicit(Ctx, I); |
||
30730 | } |
||
30731 | |||
30732 | TypeNullableResultAttr *TypeNullableResultAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30733 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30734 | return Create(Ctx, I); |
||
30735 | } |
||
30736 | |||
30737 | TypeNullableResultAttr::TypeNullableResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30738 | ) |
||
30739 | : TypeAttr(Ctx, CommonInfo, attr::TypeNullableResult, false) |
||
30740 | { |
||
30741 | } |
||
30742 | |||
30743 | TypeNullableResultAttr *TypeNullableResultAttr::clone(ASTContext &C) const { |
||
30744 | auto *A = new (C) TypeNullableResultAttr(C, *this); |
||
30745 | A->Inherited = Inherited; |
||
30746 | A->IsPackExpansion = IsPackExpansion; |
||
30747 | A->setImplicit(Implicit); |
||
30748 | return A; |
||
30749 | } |
||
30750 | |||
30751 | void TypeNullableResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30752 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30753 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30754 | switch (getAttributeSpellingListIndex()) { |
||
30755 | default: |
||
30756 | llvm_unreachable("Unknown attribute spelling!"); |
||
30757 | break; |
||
30758 | case 0 : { |
||
30759 | OS << " _Nullable_result"; |
||
30760 | OS << ""; |
||
30761 | break; |
||
30762 | } |
||
30763 | } |
||
30764 | } |
||
30765 | |||
30766 | const char *TypeNullableResultAttr::getSpelling() const { |
||
30767 | switch (getAttributeSpellingListIndex()) { |
||
30768 | default: |
||
30769 | llvm_unreachable("Unknown attribute spelling!"); |
||
30770 | return "(No spelling)"; |
||
30771 | case 0: |
||
30772 | return "_Nullable_result"; |
||
30773 | } |
||
30774 | } |
||
30775 | |||
30776 | |||
30777 | // TypeTagForDatatypeAttr implementation |
||
30778 | |||
30779 | TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, const AttributeCommonInfo &CommonInfo) { |
||
30780 | auto *A = new (Ctx) TypeTagForDatatypeAttr(Ctx, CommonInfo, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull); |
||
30781 | A->setImplicit(true); |
||
30782 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30783 | A->setAttributeSpellingListIndex(0); |
||
30784 | return A; |
||
30785 | } |
||
30786 | |||
30787 | TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, const AttributeCommonInfo &CommonInfo) { |
||
30788 | auto *A = new (Ctx) TypeTagForDatatypeAttr(Ctx, CommonInfo, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull); |
||
30789 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30790 | A->setAttributeSpellingListIndex(0); |
||
30791 | return A; |
||
30792 | } |
||
30793 | |||
30794 | TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30795 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30796 | return CreateImplicit(Ctx, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull, I); |
||
30797 | } |
||
30798 | |||
30799 | TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30800 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30801 | return Create(Ctx, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull, I); |
||
30802 | } |
||
30803 | |||
30804 | TypeTagForDatatypeAttr::TypeTagForDatatypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30805 | , IdentifierInfo * ArgumentKind |
||
30806 | , TypeSourceInfo * MatchingCType |
||
30807 | , bool LayoutCompatible |
||
30808 | , bool MustBeNull |
||
30809 | ) |
||
30810 | : InheritableAttr(Ctx, CommonInfo, attr::TypeTagForDatatype, false, false) |
||
30811 | , argumentKind(ArgumentKind) |
||
30812 | , matchingCType(MatchingCType) |
||
30813 | , layoutCompatible(LayoutCompatible) |
||
30814 | , mustBeNull(MustBeNull) |
||
30815 | { |
||
30816 | } |
||
30817 | |||
30818 | |||
30819 | |||
30820 | |||
30821 | |||
30822 | |||
30823 | |||
30824 | |||
30825 | |||
30826 | TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::clone(ASTContext &C) const { |
||
30827 | auto *A = new (C) TypeTagForDatatypeAttr(C, *this, argumentKind, matchingCType, layoutCompatible, mustBeNull); |
||
30828 | A->Inherited = Inherited; |
||
30829 | A->IsPackExpansion = IsPackExpansion; |
||
30830 | A->setImplicit(Implicit); |
||
30831 | return A; |
||
30832 | } |
||
30833 | |||
30834 | void TypeTagForDatatypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30835 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30836 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30837 | switch (getAttributeSpellingListIndex()) { |
||
30838 | default: |
||
30839 | llvm_unreachable("Unknown attribute spelling!"); |
||
30840 | break; |
||
30841 | case 0 : { |
||
30842 | OS << " __attribute__((type_tag_for_datatype"; |
||
30843 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30844 | OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; |
||
30845 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30846 | OS << "" << getMatchingCType().getAsString() << ""; |
||
30847 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30848 | OS << "" << getLayoutCompatible() << ""; |
||
30849 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30850 | OS << "" << getMustBeNull() << ""; |
||
30851 | if (!IsFirstArgument) |
||
30852 | OS << ")"; |
||
30853 | OS << "))"; |
||
30854 | break; |
||
30855 | } |
||
30856 | case 1 : { |
||
30857 | OS << " [[clang::type_tag_for_datatype"; |
||
30858 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30859 | OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; |
||
30860 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30861 | OS << "" << getMatchingCType().getAsString() << ""; |
||
30862 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30863 | OS << "" << getLayoutCompatible() << ""; |
||
30864 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30865 | OS << "" << getMustBeNull() << ""; |
||
30866 | if (!IsFirstArgument) |
||
30867 | OS << ")"; |
||
30868 | OS << "]]"; |
||
30869 | break; |
||
30870 | } |
||
30871 | case 2 : { |
||
30872 | OS << " [[clang::type_tag_for_datatype"; |
||
30873 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30874 | OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; |
||
30875 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30876 | OS << "" << getMatchingCType().getAsString() << ""; |
||
30877 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30878 | OS << "" << getLayoutCompatible() << ""; |
||
30879 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30880 | OS << "" << getMustBeNull() << ""; |
||
30881 | if (!IsFirstArgument) |
||
30882 | OS << ")"; |
||
30883 | OS << "]]"; |
||
30884 | break; |
||
30885 | } |
||
30886 | } |
||
30887 | } |
||
30888 | |||
30889 | const char *TypeTagForDatatypeAttr::getSpelling() const { |
||
30890 | switch (getAttributeSpellingListIndex()) { |
||
30891 | default: |
||
30892 | llvm_unreachable("Unknown attribute spelling!"); |
||
30893 | return "(No spelling)"; |
||
30894 | case 0: |
||
30895 | return "type_tag_for_datatype"; |
||
30896 | case 1: |
||
30897 | return "type_tag_for_datatype"; |
||
30898 | case 2: |
||
30899 | return "type_tag_for_datatype"; |
||
30900 | } |
||
30901 | } |
||
30902 | |||
30903 | |||
30904 | // TypeVisibilityAttr implementation |
||
30905 | |||
30906 | TypeVisibilityAttr *TypeVisibilityAttr::CreateImplicit(ASTContext &Ctx, VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) { |
||
30907 | auto *A = new (Ctx) TypeVisibilityAttr(Ctx, CommonInfo, Visibility); |
||
30908 | A->setImplicit(true); |
||
30909 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30910 | A->setAttributeSpellingListIndex(0); |
||
30911 | return A; |
||
30912 | } |
||
30913 | |||
30914 | TypeVisibilityAttr *TypeVisibilityAttr::Create(ASTContext &Ctx, VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) { |
||
30915 | auto *A = new (Ctx) TypeVisibilityAttr(Ctx, CommonInfo, Visibility); |
||
30916 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
30917 | A->setAttributeSpellingListIndex(0); |
||
30918 | return A; |
||
30919 | } |
||
30920 | |||
30921 | TypeVisibilityAttr *TypeVisibilityAttr::CreateImplicit(ASTContext &Ctx, VisibilityType Visibility, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30922 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30923 | return CreateImplicit(Ctx, Visibility, I); |
||
30924 | } |
||
30925 | |||
30926 | TypeVisibilityAttr *TypeVisibilityAttr::Create(ASTContext &Ctx, VisibilityType Visibility, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
30927 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
30928 | return Create(Ctx, Visibility, I); |
||
30929 | } |
||
30930 | |||
30931 | TypeVisibilityAttr::TypeVisibilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
30932 | , VisibilityType Visibility |
||
30933 | ) |
||
30934 | : InheritableAttr(Ctx, CommonInfo, attr::TypeVisibility, false, false) |
||
30935 | , visibility(Visibility) |
||
30936 | { |
||
30937 | } |
||
30938 | |||
30939 | |||
30940 | |||
30941 | bool TypeVisibilityAttr::ConvertStrToVisibilityType(StringRef Val, VisibilityType &Out) { |
||
30942 | std::optional<VisibilityType> R = llvm::StringSwitch<std::optional<VisibilityType>>(Val) |
||
30943 | .Case("default", TypeVisibilityAttr::Default) |
||
30944 | .Case("hidden", TypeVisibilityAttr::Hidden) |
||
30945 | .Case("internal", TypeVisibilityAttr::Hidden) |
||
30946 | .Case("protected", TypeVisibilityAttr::Protected) |
||
30947 | .Default(std::optional<VisibilityType>()); |
||
30948 | if (R) { |
||
30949 | Out = *R; |
||
30950 | return true; |
||
30951 | } |
||
30952 | return false; |
||
30953 | } |
||
30954 | |||
30955 | const char *TypeVisibilityAttr::ConvertVisibilityTypeToStr(VisibilityType Val) { |
||
30956 | switch(Val) { |
||
30957 | case TypeVisibilityAttr::Default: return "default"; |
||
30958 | case TypeVisibilityAttr::Hidden: return "hidden"; |
||
30959 | case TypeVisibilityAttr::Protected: return "protected"; |
||
30960 | } |
||
30961 | llvm_unreachable("No enumerator with that value"); |
||
30962 | } |
||
30963 | TypeVisibilityAttr *TypeVisibilityAttr::clone(ASTContext &C) const { |
||
30964 | auto *A = new (C) TypeVisibilityAttr(C, *this, visibility); |
||
30965 | A->Inherited = Inherited; |
||
30966 | A->IsPackExpansion = IsPackExpansion; |
||
30967 | A->setImplicit(Implicit); |
||
30968 | return A; |
||
30969 | } |
||
30970 | |||
30971 | void TypeVisibilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
30972 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
30973 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
30974 | switch (getAttributeSpellingListIndex()) { |
||
30975 | default: |
||
30976 | llvm_unreachable("Unknown attribute spelling!"); |
||
30977 | break; |
||
30978 | case 0 : { |
||
30979 | OS << " __attribute__((type_visibility"; |
||
30980 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30981 | OS << "\"" << TypeVisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; |
||
30982 | if (!IsFirstArgument) |
||
30983 | OS << ")"; |
||
30984 | OS << "))"; |
||
30985 | break; |
||
30986 | } |
||
30987 | case 1 : { |
||
30988 | OS << " [[clang::type_visibility"; |
||
30989 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30990 | OS << "\"" << TypeVisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; |
||
30991 | if (!IsFirstArgument) |
||
30992 | OS << ")"; |
||
30993 | OS << "]]"; |
||
30994 | break; |
||
30995 | } |
||
30996 | case 2 : { |
||
30997 | OS << " [[clang::type_visibility"; |
||
30998 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
30999 | OS << "\"" << TypeVisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; |
||
31000 | if (!IsFirstArgument) |
||
31001 | OS << ")"; |
||
31002 | OS << "]]"; |
||
31003 | break; |
||
31004 | } |
||
31005 | } |
||
31006 | } |
||
31007 | |||
31008 | const char *TypeVisibilityAttr::getSpelling() const { |
||
31009 | switch (getAttributeSpellingListIndex()) { |
||
31010 | default: |
||
31011 | llvm_unreachable("Unknown attribute spelling!"); |
||
31012 | return "(No spelling)"; |
||
31013 | case 0: |
||
31014 | return "type_visibility"; |
||
31015 | case 1: |
||
31016 | return "type_visibility"; |
||
31017 | case 2: |
||
31018 | return "type_visibility"; |
||
31019 | } |
||
31020 | } |
||
31021 | |||
31022 | |||
31023 | // UPtrAttr implementation |
||
31024 | |||
31025 | UPtrAttr *UPtrAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31026 | auto *A = new (Ctx) UPtrAttr(Ctx, CommonInfo); |
||
31027 | A->setImplicit(true); |
||
31028 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31029 | A->setAttributeSpellingListIndex(0); |
||
31030 | return A; |
||
31031 | } |
||
31032 | |||
31033 | UPtrAttr *UPtrAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31034 | auto *A = new (Ctx) UPtrAttr(Ctx, CommonInfo); |
||
31035 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31036 | A->setAttributeSpellingListIndex(0); |
||
31037 | return A; |
||
31038 | } |
||
31039 | |||
31040 | UPtrAttr *UPtrAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31041 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31042 | return CreateImplicit(Ctx, I); |
||
31043 | } |
||
31044 | |||
31045 | UPtrAttr *UPtrAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31046 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31047 | return Create(Ctx, I); |
||
31048 | } |
||
31049 | |||
31050 | UPtrAttr::UPtrAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31051 | ) |
||
31052 | : TypeAttr(Ctx, CommonInfo, attr::UPtr, false) |
||
31053 | { |
||
31054 | } |
||
31055 | |||
31056 | UPtrAttr *UPtrAttr::clone(ASTContext &C) const { |
||
31057 | auto *A = new (C) UPtrAttr(C, *this); |
||
31058 | A->Inherited = Inherited; |
||
31059 | A->IsPackExpansion = IsPackExpansion; |
||
31060 | A->setImplicit(Implicit); |
||
31061 | return A; |
||
31062 | } |
||
31063 | |||
31064 | void UPtrAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31065 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31066 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31067 | switch (getAttributeSpellingListIndex()) { |
||
31068 | default: |
||
31069 | llvm_unreachable("Unknown attribute spelling!"); |
||
31070 | break; |
||
31071 | case 0 : { |
||
31072 | OS << " __uptr"; |
||
31073 | OS << ""; |
||
31074 | break; |
||
31075 | } |
||
31076 | } |
||
31077 | } |
||
31078 | |||
31079 | const char *UPtrAttr::getSpelling() const { |
||
31080 | switch (getAttributeSpellingListIndex()) { |
||
31081 | default: |
||
31082 | llvm_unreachable("Unknown attribute spelling!"); |
||
31083 | return "(No spelling)"; |
||
31084 | case 0: |
||
31085 | return "__uptr"; |
||
31086 | } |
||
31087 | } |
||
31088 | |||
31089 | |||
31090 | // UnavailableAttr implementation |
||
31091 | |||
31092 | UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, ImplicitReason ImplicitReason, const AttributeCommonInfo &CommonInfo) { |
||
31093 | auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message, ImplicitReason); |
||
31094 | A->setImplicit(true); |
||
31095 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31096 | A->setAttributeSpellingListIndex(0); |
||
31097 | return A; |
||
31098 | } |
||
31099 | |||
31100 | UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, ImplicitReason ImplicitReason, const AttributeCommonInfo &CommonInfo) { |
||
31101 | auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message, ImplicitReason); |
||
31102 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31103 | A->setAttributeSpellingListIndex(0); |
||
31104 | return A; |
||
31105 | } |
||
31106 | |||
31107 | UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, ImplicitReason ImplicitReason, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31108 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31109 | return CreateImplicit(Ctx, Message, ImplicitReason, I); |
||
31110 | } |
||
31111 | |||
31112 | UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, ImplicitReason ImplicitReason, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31113 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31114 | return Create(Ctx, Message, ImplicitReason, I); |
||
31115 | } |
||
31116 | |||
31117 | UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { |
||
31118 | auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message); |
||
31119 | A->setImplicit(true); |
||
31120 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31121 | A->setAttributeSpellingListIndex(0); |
||
31122 | return A; |
||
31123 | } |
||
31124 | |||
31125 | UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { |
||
31126 | auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message); |
||
31127 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31128 | A->setAttributeSpellingListIndex(0); |
||
31129 | return A; |
||
31130 | } |
||
31131 | |||
31132 | UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31133 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31134 | return CreateImplicit(Ctx, Message, I); |
||
31135 | } |
||
31136 | |||
31137 | UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31138 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31139 | return Create(Ctx, Message, I); |
||
31140 | } |
||
31141 | |||
31142 | UnavailableAttr::UnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31143 | , llvm::StringRef Message |
||
31144 | , ImplicitReason ImplicitReason |
||
31145 | ) |
||
31146 | : InheritableAttr(Ctx, CommonInfo, attr::Unavailable, false, false) |
||
31147 | , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) |
||
31148 | , implicitReason(ImplicitReason) |
||
31149 | { |
||
31150 | if (!Message.empty()) |
||
31151 | std::memcpy(message, Message.data(), messageLength); |
||
31152 | } |
||
31153 | |||
31154 | UnavailableAttr::UnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31155 | , llvm::StringRef Message |
||
31156 | ) |
||
31157 | : InheritableAttr(Ctx, CommonInfo, attr::Unavailable, false, false) |
||
31158 | , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) |
||
31159 | , implicitReason(ImplicitReason(0)) |
||
31160 | { |
||
31161 | if (!Message.empty()) |
||
31162 | std::memcpy(message, Message.data(), messageLength); |
||
31163 | } |
||
31164 | |||
31165 | UnavailableAttr::UnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31166 | ) |
||
31167 | : InheritableAttr(Ctx, CommonInfo, attr::Unavailable, false, false) |
||
31168 | , messageLength(0),message(nullptr) |
||
31169 | , implicitReason(ImplicitReason(0)) |
||
31170 | { |
||
31171 | } |
||
31172 | |||
31173 | |||
31174 | |||
31175 | |||
31176 | |||
31177 | UnavailableAttr *UnavailableAttr::clone(ASTContext &C) const { |
||
31178 | auto *A = new (C) UnavailableAttr(C, *this, getMessage(), implicitReason); |
||
31179 | A->Inherited = Inherited; |
||
31180 | A->IsPackExpansion = IsPackExpansion; |
||
31181 | A->setImplicit(Implicit); |
||
31182 | return A; |
||
31183 | } |
||
31184 | |||
31185 | void UnavailableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31186 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31187 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31188 | switch (getAttributeSpellingListIndex()) { |
||
31189 | default: |
||
31190 | llvm_unreachable("Unknown attribute spelling!"); |
||
31191 | break; |
||
31192 | case 0 : { |
||
31193 | OS << " __attribute__((unavailable"; |
||
31194 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
31195 | OS << "\"" << getMessage() << "\""; |
||
31196 | if (!IsFirstArgument) |
||
31197 | OS << ")"; |
||
31198 | OS << "))"; |
||
31199 | break; |
||
31200 | } |
||
31201 | case 1 : { |
||
31202 | OS << " [[clang::unavailable"; |
||
31203 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
31204 | OS << "\"" << getMessage() << "\""; |
||
31205 | if (!IsFirstArgument) |
||
31206 | OS << ")"; |
||
31207 | OS << "]]"; |
||
31208 | break; |
||
31209 | } |
||
31210 | case 2 : { |
||
31211 | OS << " [[clang::unavailable"; |
||
31212 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
31213 | OS << "\"" << getMessage() << "\""; |
||
31214 | if (!IsFirstArgument) |
||
31215 | OS << ")"; |
||
31216 | OS << "]]"; |
||
31217 | break; |
||
31218 | } |
||
31219 | } |
||
31220 | } |
||
31221 | |||
31222 | const char *UnavailableAttr::getSpelling() const { |
||
31223 | switch (getAttributeSpellingListIndex()) { |
||
31224 | default: |
||
31225 | llvm_unreachable("Unknown attribute spelling!"); |
||
31226 | return "(No spelling)"; |
||
31227 | case 0: |
||
31228 | return "unavailable"; |
||
31229 | case 1: |
||
31230 | return "unavailable"; |
||
31231 | case 2: |
||
31232 | return "unavailable"; |
||
31233 | } |
||
31234 | } |
||
31235 | |||
31236 | |||
31237 | // UninitializedAttr implementation |
||
31238 | |||
31239 | UninitializedAttr *UninitializedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31240 | auto *A = new (Ctx) UninitializedAttr(Ctx, CommonInfo); |
||
31241 | A->setImplicit(true); |
||
31242 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31243 | A->setAttributeSpellingListIndex(0); |
||
31244 | return A; |
||
31245 | } |
||
31246 | |||
31247 | UninitializedAttr *UninitializedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31248 | auto *A = new (Ctx) UninitializedAttr(Ctx, CommonInfo); |
||
31249 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31250 | A->setAttributeSpellingListIndex(0); |
||
31251 | return A; |
||
31252 | } |
||
31253 | |||
31254 | UninitializedAttr *UninitializedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31255 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31256 | return CreateImplicit(Ctx, I); |
||
31257 | } |
||
31258 | |||
31259 | UninitializedAttr *UninitializedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31260 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31261 | return Create(Ctx, I); |
||
31262 | } |
||
31263 | |||
31264 | UninitializedAttr::UninitializedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31265 | ) |
||
31266 | : InheritableAttr(Ctx, CommonInfo, attr::Uninitialized, false, false) |
||
31267 | { |
||
31268 | } |
||
31269 | |||
31270 | UninitializedAttr *UninitializedAttr::clone(ASTContext &C) const { |
||
31271 | auto *A = new (C) UninitializedAttr(C, *this); |
||
31272 | A->Inherited = Inherited; |
||
31273 | A->IsPackExpansion = IsPackExpansion; |
||
31274 | A->setImplicit(Implicit); |
||
31275 | return A; |
||
31276 | } |
||
31277 | |||
31278 | void UninitializedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31279 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31280 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31281 | switch (getAttributeSpellingListIndex()) { |
||
31282 | default: |
||
31283 | llvm_unreachable("Unknown attribute spelling!"); |
||
31284 | break; |
||
31285 | case 0 : { |
||
31286 | OS << " __attribute__((uninitialized"; |
||
31287 | OS << "))"; |
||
31288 | break; |
||
31289 | } |
||
31290 | case 1 : { |
||
31291 | OS << " [[clang::uninitialized"; |
||
31292 | OS << "]]"; |
||
31293 | break; |
||
31294 | } |
||
31295 | } |
||
31296 | } |
||
31297 | |||
31298 | const char *UninitializedAttr::getSpelling() const { |
||
31299 | switch (getAttributeSpellingListIndex()) { |
||
31300 | default: |
||
31301 | llvm_unreachable("Unknown attribute spelling!"); |
||
31302 | return "(No spelling)"; |
||
31303 | case 0: |
||
31304 | return "uninitialized"; |
||
31305 | case 1: |
||
31306 | return "uninitialized"; |
||
31307 | } |
||
31308 | } |
||
31309 | |||
31310 | |||
31311 | // UnlikelyAttr implementation |
||
31312 | |||
31313 | UnlikelyAttr *UnlikelyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31314 | auto *A = new (Ctx) UnlikelyAttr(Ctx, CommonInfo); |
||
31315 | A->setImplicit(true); |
||
31316 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31317 | A->setAttributeSpellingListIndex(0); |
||
31318 | return A; |
||
31319 | } |
||
31320 | |||
31321 | UnlikelyAttr *UnlikelyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31322 | auto *A = new (Ctx) UnlikelyAttr(Ctx, CommonInfo); |
||
31323 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31324 | A->setAttributeSpellingListIndex(0); |
||
31325 | return A; |
||
31326 | } |
||
31327 | |||
31328 | UnlikelyAttr *UnlikelyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31329 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31330 | return CreateImplicit(Ctx, I); |
||
31331 | } |
||
31332 | |||
31333 | UnlikelyAttr *UnlikelyAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31334 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31335 | return Create(Ctx, I); |
||
31336 | } |
||
31337 | |||
31338 | UnlikelyAttr::UnlikelyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31339 | ) |
||
31340 | : StmtAttr(Ctx, CommonInfo, attr::Unlikely, false) |
||
31341 | { |
||
31342 | } |
||
31343 | |||
31344 | UnlikelyAttr *UnlikelyAttr::clone(ASTContext &C) const { |
||
31345 | auto *A = new (C) UnlikelyAttr(C, *this); |
||
31346 | A->Inherited = Inherited; |
||
31347 | A->IsPackExpansion = IsPackExpansion; |
||
31348 | A->setImplicit(Implicit); |
||
31349 | return A; |
||
31350 | } |
||
31351 | |||
31352 | void UnlikelyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31353 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31354 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31355 | switch (getAttributeSpellingListIndex()) { |
||
31356 | default: |
||
31357 | llvm_unreachable("Unknown attribute spelling!"); |
||
31358 | break; |
||
31359 | case 0 : { |
||
31360 | OS << " [[unlikely"; |
||
31361 | OS << "]]"; |
||
31362 | break; |
||
31363 | } |
||
31364 | case 1 : { |
||
31365 | OS << " [[clang::unlikely"; |
||
31366 | OS << "]]"; |
||
31367 | break; |
||
31368 | } |
||
31369 | } |
||
31370 | } |
||
31371 | |||
31372 | const char *UnlikelyAttr::getSpelling() const { |
||
31373 | switch (getAttributeSpellingListIndex()) { |
||
31374 | default: |
||
31375 | llvm_unreachable("Unknown attribute spelling!"); |
||
31376 | return "(No spelling)"; |
||
31377 | case 0: |
||
31378 | return "unlikely"; |
||
31379 | case 1: |
||
31380 | return "unlikely"; |
||
31381 | } |
||
31382 | } |
||
31383 | |||
31384 | |||
31385 | // UnusedAttr implementation |
||
31386 | |||
31387 | UnusedAttr *UnusedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31388 | auto *A = new (Ctx) UnusedAttr(Ctx, CommonInfo); |
||
31389 | A->setImplicit(true); |
||
31390 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31391 | A->setAttributeSpellingListIndex(0); |
||
31392 | return A; |
||
31393 | } |
||
31394 | |||
31395 | UnusedAttr *UnusedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31396 | auto *A = new (Ctx) UnusedAttr(Ctx, CommonInfo); |
||
31397 | return A; |
||
31398 | } |
||
31399 | |||
31400 | UnusedAttr *UnusedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, UnusedAttr::Spelling S) { |
||
31401 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
31402 | return CreateImplicit(Ctx, I); |
||
31403 | } |
||
31404 | |||
31405 | UnusedAttr *UnusedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, UnusedAttr::Spelling S) { |
||
31406 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
31407 | return Create(Ctx, I); |
||
31408 | } |
||
31409 | |||
31410 | UnusedAttr::UnusedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31411 | ) |
||
31412 | : InheritableAttr(Ctx, CommonInfo, attr::Unused, false, false) |
||
31413 | { |
||
31414 | } |
||
31415 | |||
31416 | UnusedAttr::Spelling UnusedAttr::getSemanticSpelling() const { |
||
31417 | switch (getAttributeSpellingListIndex()) { |
||
31418 | default: llvm_unreachable("Unknown spelling list index"); |
||
31419 | case 0: return CXX11_maybe_unused; |
||
31420 | case 1: return GNU_unused; |
||
31421 | case 2: return CXX11_gnu_unused; |
||
31422 | case 3: return C2x_gnu_unused; |
||
31423 | case 4: return C2x_maybe_unused; |
||
31424 | } |
||
31425 | } |
||
31426 | UnusedAttr *UnusedAttr::clone(ASTContext &C) const { |
||
31427 | auto *A = new (C) UnusedAttr(C, *this); |
||
31428 | A->Inherited = Inherited; |
||
31429 | A->IsPackExpansion = IsPackExpansion; |
||
31430 | A->setImplicit(Implicit); |
||
31431 | return A; |
||
31432 | } |
||
31433 | |||
31434 | void UnusedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31435 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31436 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31437 | switch (getAttributeSpellingListIndex()) { |
||
31438 | default: |
||
31439 | llvm_unreachable("Unknown attribute spelling!"); |
||
31440 | break; |
||
31441 | case 0 : { |
||
31442 | OS << " [[maybe_unused"; |
||
31443 | OS << "]]"; |
||
31444 | break; |
||
31445 | } |
||
31446 | case 1 : { |
||
31447 | OS << " __attribute__((unused"; |
||
31448 | OS << "))"; |
||
31449 | break; |
||
31450 | } |
||
31451 | case 2 : { |
||
31452 | OS << " [[gnu::unused"; |
||
31453 | OS << "]]"; |
||
31454 | break; |
||
31455 | } |
||
31456 | case 3 : { |
||
31457 | OS << " [[gnu::unused"; |
||
31458 | OS << "]]"; |
||
31459 | break; |
||
31460 | } |
||
31461 | case 4 : { |
||
31462 | OS << " [[maybe_unused"; |
||
31463 | OS << "]]"; |
||
31464 | break; |
||
31465 | } |
||
31466 | } |
||
31467 | } |
||
31468 | |||
31469 | const char *UnusedAttr::getSpelling() const { |
||
31470 | switch (getAttributeSpellingListIndex()) { |
||
31471 | default: |
||
31472 | llvm_unreachable("Unknown attribute spelling!"); |
||
31473 | return "(No spelling)"; |
||
31474 | case 0: |
||
31475 | return "maybe_unused"; |
||
31476 | case 1: |
||
31477 | return "unused"; |
||
31478 | case 2: |
||
31479 | return "unused"; |
||
31480 | case 3: |
||
31481 | return "unused"; |
||
31482 | case 4: |
||
31483 | return "maybe_unused"; |
||
31484 | } |
||
31485 | } |
||
31486 | |||
31487 | |||
31488 | // UseHandleAttr implementation |
||
31489 | |||
31490 | UseHandleAttr *UseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { |
||
31491 | auto *A = new (Ctx) UseHandleAttr(Ctx, CommonInfo, HandleType); |
||
31492 | A->setImplicit(true); |
||
31493 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31494 | A->setAttributeSpellingListIndex(0); |
||
31495 | return A; |
||
31496 | } |
||
31497 | |||
31498 | UseHandleAttr *UseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { |
||
31499 | auto *A = new (Ctx) UseHandleAttr(Ctx, CommonInfo, HandleType); |
||
31500 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31501 | A->setAttributeSpellingListIndex(0); |
||
31502 | return A; |
||
31503 | } |
||
31504 | |||
31505 | UseHandleAttr *UseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31506 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31507 | return CreateImplicit(Ctx, HandleType, I); |
||
31508 | } |
||
31509 | |||
31510 | UseHandleAttr *UseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31511 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31512 | return Create(Ctx, HandleType, I); |
||
31513 | } |
||
31514 | |||
31515 | UseHandleAttr::UseHandleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31516 | , llvm::StringRef HandleType |
||
31517 | ) |
||
31518 | : InheritableParamAttr(Ctx, CommonInfo, attr::UseHandle, false, false) |
||
31519 | , handleTypeLength(HandleType.size()),handleType(new (Ctx, 1) char[handleTypeLength]) |
||
31520 | { |
||
31521 | if (!HandleType.empty()) |
||
31522 | std::memcpy(handleType, HandleType.data(), handleTypeLength); |
||
31523 | } |
||
31524 | |||
31525 | |||
31526 | |||
31527 | UseHandleAttr *UseHandleAttr::clone(ASTContext &C) const { |
||
31528 | auto *A = new (C) UseHandleAttr(C, *this, getHandleType()); |
||
31529 | A->Inherited = Inherited; |
||
31530 | A->IsPackExpansion = IsPackExpansion; |
||
31531 | A->setImplicit(Implicit); |
||
31532 | return A; |
||
31533 | } |
||
31534 | |||
31535 | void UseHandleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31536 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31537 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31538 | switch (getAttributeSpellingListIndex()) { |
||
31539 | default: |
||
31540 | llvm_unreachable("Unknown attribute spelling!"); |
||
31541 | break; |
||
31542 | case 0 : { |
||
31543 | OS << " __attribute__((use_handle"; |
||
31544 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
31545 | OS << "\"" << getHandleType() << "\""; |
||
31546 | if (!IsFirstArgument) |
||
31547 | OS << ")"; |
||
31548 | OS << "))"; |
||
31549 | break; |
||
31550 | } |
||
31551 | case 1 : { |
||
31552 | OS << " [[clang::use_handle"; |
||
31553 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
31554 | OS << "\"" << getHandleType() << "\""; |
||
31555 | if (!IsFirstArgument) |
||
31556 | OS << ")"; |
||
31557 | OS << "]]"; |
||
31558 | break; |
||
31559 | } |
||
31560 | case 2 : { |
||
31561 | OS << " [[clang::use_handle"; |
||
31562 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
31563 | OS << "\"" << getHandleType() << "\""; |
||
31564 | if (!IsFirstArgument) |
||
31565 | OS << ")"; |
||
31566 | OS << "]]"; |
||
31567 | break; |
||
31568 | } |
||
31569 | } |
||
31570 | } |
||
31571 | |||
31572 | const char *UseHandleAttr::getSpelling() const { |
||
31573 | switch (getAttributeSpellingListIndex()) { |
||
31574 | default: |
||
31575 | llvm_unreachable("Unknown attribute spelling!"); |
||
31576 | return "(No spelling)"; |
||
31577 | case 0: |
||
31578 | return "use_handle"; |
||
31579 | case 1: |
||
31580 | return "use_handle"; |
||
31581 | case 2: |
||
31582 | return "use_handle"; |
||
31583 | } |
||
31584 | } |
||
31585 | |||
31586 | |||
31587 | // UsedAttr implementation |
||
31588 | |||
31589 | UsedAttr *UsedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31590 | auto *A = new (Ctx) UsedAttr(Ctx, CommonInfo); |
||
31591 | A->setImplicit(true); |
||
31592 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31593 | A->setAttributeSpellingListIndex(0); |
||
31594 | return A; |
||
31595 | } |
||
31596 | |||
31597 | UsedAttr *UsedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31598 | auto *A = new (Ctx) UsedAttr(Ctx, CommonInfo); |
||
31599 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31600 | A->setAttributeSpellingListIndex(0); |
||
31601 | return A; |
||
31602 | } |
||
31603 | |||
31604 | UsedAttr *UsedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31605 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31606 | return CreateImplicit(Ctx, I); |
||
31607 | } |
||
31608 | |||
31609 | UsedAttr *UsedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31610 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31611 | return Create(Ctx, I); |
||
31612 | } |
||
31613 | |||
31614 | UsedAttr::UsedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31615 | ) |
||
31616 | : InheritableAttr(Ctx, CommonInfo, attr::Used, false, false) |
||
31617 | { |
||
31618 | } |
||
31619 | |||
31620 | UsedAttr *UsedAttr::clone(ASTContext &C) const { |
||
31621 | auto *A = new (C) UsedAttr(C, *this); |
||
31622 | A->Inherited = Inherited; |
||
31623 | A->IsPackExpansion = IsPackExpansion; |
||
31624 | A->setImplicit(Implicit); |
||
31625 | return A; |
||
31626 | } |
||
31627 | |||
31628 | void UsedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31629 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31630 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31631 | switch (getAttributeSpellingListIndex()) { |
||
31632 | default: |
||
31633 | llvm_unreachable("Unknown attribute spelling!"); |
||
31634 | break; |
||
31635 | case 0 : { |
||
31636 | OS << " __attribute__((used"; |
||
31637 | OS << "))"; |
||
31638 | break; |
||
31639 | } |
||
31640 | case 1 : { |
||
31641 | OS << " [[gnu::used"; |
||
31642 | OS << "]]"; |
||
31643 | break; |
||
31644 | } |
||
31645 | case 2 : { |
||
31646 | OS << " [[gnu::used"; |
||
31647 | OS << "]]"; |
||
31648 | break; |
||
31649 | } |
||
31650 | } |
||
31651 | } |
||
31652 | |||
31653 | const char *UsedAttr::getSpelling() const { |
||
31654 | switch (getAttributeSpellingListIndex()) { |
||
31655 | default: |
||
31656 | llvm_unreachable("Unknown attribute spelling!"); |
||
31657 | return "(No spelling)"; |
||
31658 | case 0: |
||
31659 | return "used"; |
||
31660 | case 1: |
||
31661 | return "used"; |
||
31662 | case 2: |
||
31663 | return "used"; |
||
31664 | } |
||
31665 | } |
||
31666 | |||
31667 | |||
31668 | // UsingIfExistsAttr implementation |
||
31669 | |||
31670 | UsingIfExistsAttr *UsingIfExistsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31671 | auto *A = new (Ctx) UsingIfExistsAttr(Ctx, CommonInfo); |
||
31672 | A->setImplicit(true); |
||
31673 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31674 | A->setAttributeSpellingListIndex(0); |
||
31675 | return A; |
||
31676 | } |
||
31677 | |||
31678 | UsingIfExistsAttr *UsingIfExistsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31679 | auto *A = new (Ctx) UsingIfExistsAttr(Ctx, CommonInfo); |
||
31680 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31681 | A->setAttributeSpellingListIndex(0); |
||
31682 | return A; |
||
31683 | } |
||
31684 | |||
31685 | UsingIfExistsAttr *UsingIfExistsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31686 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31687 | return CreateImplicit(Ctx, I); |
||
31688 | } |
||
31689 | |||
31690 | UsingIfExistsAttr *UsingIfExistsAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31691 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31692 | return Create(Ctx, I); |
||
31693 | } |
||
31694 | |||
31695 | UsingIfExistsAttr::UsingIfExistsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31696 | ) |
||
31697 | : InheritableAttr(Ctx, CommonInfo, attr::UsingIfExists, false, false) |
||
31698 | { |
||
31699 | } |
||
31700 | |||
31701 | UsingIfExistsAttr *UsingIfExistsAttr::clone(ASTContext &C) const { |
||
31702 | auto *A = new (C) UsingIfExistsAttr(C, *this); |
||
31703 | A->Inherited = Inherited; |
||
31704 | A->IsPackExpansion = IsPackExpansion; |
||
31705 | A->setImplicit(Implicit); |
||
31706 | return A; |
||
31707 | } |
||
31708 | |||
31709 | void UsingIfExistsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31710 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31711 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31712 | switch (getAttributeSpellingListIndex()) { |
||
31713 | default: |
||
31714 | llvm_unreachable("Unknown attribute spelling!"); |
||
31715 | break; |
||
31716 | case 0 : { |
||
31717 | OS << " __attribute__((using_if_exists"; |
||
31718 | OS << "))"; |
||
31719 | break; |
||
31720 | } |
||
31721 | case 1 : { |
||
31722 | OS << " [[clang::using_if_exists"; |
||
31723 | OS << "]]"; |
||
31724 | break; |
||
31725 | } |
||
31726 | } |
||
31727 | } |
||
31728 | |||
31729 | const char *UsingIfExistsAttr::getSpelling() const { |
||
31730 | switch (getAttributeSpellingListIndex()) { |
||
31731 | default: |
||
31732 | llvm_unreachable("Unknown attribute spelling!"); |
||
31733 | return "(No spelling)"; |
||
31734 | case 0: |
||
31735 | return "using_if_exists"; |
||
31736 | case 1: |
||
31737 | return "using_if_exists"; |
||
31738 | } |
||
31739 | } |
||
31740 | |||
31741 | |||
31742 | // UuidAttr implementation |
||
31743 | |||
31744 | UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, const AttributeCommonInfo &CommonInfo) { |
||
31745 | auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid, GuidDecl); |
||
31746 | A->setImplicit(true); |
||
31747 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31748 | A->setAttributeSpellingListIndex(0); |
||
31749 | return A; |
||
31750 | } |
||
31751 | |||
31752 | UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, const AttributeCommonInfo &CommonInfo) { |
||
31753 | auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid, GuidDecl); |
||
31754 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31755 | A->setAttributeSpellingListIndex(0); |
||
31756 | return A; |
||
31757 | } |
||
31758 | |||
31759 | UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31760 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31761 | return CreateImplicit(Ctx, Guid, GuidDecl, I); |
||
31762 | } |
||
31763 | |||
31764 | UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31765 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31766 | return Create(Ctx, Guid, GuidDecl, I); |
||
31767 | } |
||
31768 | |||
31769 | UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, const AttributeCommonInfo &CommonInfo) { |
||
31770 | auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid); |
||
31771 | A->setImplicit(true); |
||
31772 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31773 | A->setAttributeSpellingListIndex(0); |
||
31774 | return A; |
||
31775 | } |
||
31776 | |||
31777 | UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, const AttributeCommonInfo &CommonInfo) { |
||
31778 | auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid); |
||
31779 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31780 | A->setAttributeSpellingListIndex(0); |
||
31781 | return A; |
||
31782 | } |
||
31783 | |||
31784 | UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31785 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31786 | return CreateImplicit(Ctx, Guid, I); |
||
31787 | } |
||
31788 | |||
31789 | UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31790 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31791 | return Create(Ctx, Guid, I); |
||
31792 | } |
||
31793 | |||
31794 | UuidAttr::UuidAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31795 | , llvm::StringRef Guid |
||
31796 | , MSGuidDecl * GuidDecl |
||
31797 | ) |
||
31798 | : InheritableAttr(Ctx, CommonInfo, attr::Uuid, false, false) |
||
31799 | , guidLength(Guid.size()),guid(new (Ctx, 1) char[guidLength]) |
||
31800 | , guidDecl(GuidDecl) |
||
31801 | { |
||
31802 | if (!Guid.empty()) |
||
31803 | std::memcpy(guid, Guid.data(), guidLength); |
||
31804 | } |
||
31805 | |||
31806 | UuidAttr::UuidAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31807 | , llvm::StringRef Guid |
||
31808 | ) |
||
31809 | : InheritableAttr(Ctx, CommonInfo, attr::Uuid, false, false) |
||
31810 | , guidLength(Guid.size()),guid(new (Ctx, 1) char[guidLength]) |
||
31811 | , guidDecl() |
||
31812 | { |
||
31813 | if (!Guid.empty()) |
||
31814 | std::memcpy(guid, Guid.data(), guidLength); |
||
31815 | } |
||
31816 | |||
31817 | |||
31818 | |||
31819 | |||
31820 | |||
31821 | UuidAttr *UuidAttr::clone(ASTContext &C) const { |
||
31822 | auto *A = new (C) UuidAttr(C, *this, getGuid(), guidDecl); |
||
31823 | A->Inherited = Inherited; |
||
31824 | A->IsPackExpansion = IsPackExpansion; |
||
31825 | A->setImplicit(Implicit); |
||
31826 | return A; |
||
31827 | } |
||
31828 | |||
31829 | void UuidAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31830 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31831 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31832 | switch (getAttributeSpellingListIndex()) { |
||
31833 | default: |
||
31834 | llvm_unreachable("Unknown attribute spelling!"); |
||
31835 | break; |
||
31836 | case 0 : { |
||
31837 | OS << " __declspec(uuid"; |
||
31838 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
31839 | OS << "\"" << getGuid() << "\""; |
||
31840 | if (!IsFirstArgument) |
||
31841 | OS << ")"; |
||
31842 | OS << ")"; |
||
31843 | break; |
||
31844 | } |
||
31845 | case 1 : { |
||
31846 | OS << "[uuid"; |
||
31847 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
31848 | OS << "\"" << getGuid() << "\""; |
||
31849 | if (!IsFirstArgument) |
||
31850 | OS << ")"; |
||
31851 | OS << "]"; |
||
31852 | break; |
||
31853 | } |
||
31854 | } |
||
31855 | } |
||
31856 | |||
31857 | const char *UuidAttr::getSpelling() const { |
||
31858 | switch (getAttributeSpellingListIndex()) { |
||
31859 | default: |
||
31860 | llvm_unreachable("Unknown attribute spelling!"); |
||
31861 | return "(No spelling)"; |
||
31862 | case 0: |
||
31863 | return "uuid"; |
||
31864 | case 1: |
||
31865 | return "uuid"; |
||
31866 | } |
||
31867 | } |
||
31868 | |||
31869 | |||
31870 | // VecReturnAttr implementation |
||
31871 | |||
31872 | VecReturnAttr *VecReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31873 | auto *A = new (Ctx) VecReturnAttr(Ctx, CommonInfo); |
||
31874 | A->setImplicit(true); |
||
31875 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31876 | A->setAttributeSpellingListIndex(0); |
||
31877 | return A; |
||
31878 | } |
||
31879 | |||
31880 | VecReturnAttr *VecReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
31881 | auto *A = new (Ctx) VecReturnAttr(Ctx, CommonInfo); |
||
31882 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31883 | A->setAttributeSpellingListIndex(0); |
||
31884 | return A; |
||
31885 | } |
||
31886 | |||
31887 | VecReturnAttr *VecReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31888 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31889 | return CreateImplicit(Ctx, I); |
||
31890 | } |
||
31891 | |||
31892 | VecReturnAttr *VecReturnAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31893 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31894 | return Create(Ctx, I); |
||
31895 | } |
||
31896 | |||
31897 | VecReturnAttr::VecReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31898 | ) |
||
31899 | : InheritableAttr(Ctx, CommonInfo, attr::VecReturn, false, false) |
||
31900 | { |
||
31901 | } |
||
31902 | |||
31903 | VecReturnAttr *VecReturnAttr::clone(ASTContext &C) const { |
||
31904 | auto *A = new (C) VecReturnAttr(C, *this); |
||
31905 | A->Inherited = Inherited; |
||
31906 | A->IsPackExpansion = IsPackExpansion; |
||
31907 | A->setImplicit(Implicit); |
||
31908 | return A; |
||
31909 | } |
||
31910 | |||
31911 | void VecReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31912 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31913 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31914 | switch (getAttributeSpellingListIndex()) { |
||
31915 | default: |
||
31916 | llvm_unreachable("Unknown attribute spelling!"); |
||
31917 | break; |
||
31918 | case 0 : { |
||
31919 | OS << " __attribute__((vecreturn"; |
||
31920 | OS << "))"; |
||
31921 | break; |
||
31922 | } |
||
31923 | case 1 : { |
||
31924 | OS << " [[clang::vecreturn"; |
||
31925 | OS << "]]"; |
||
31926 | break; |
||
31927 | } |
||
31928 | } |
||
31929 | } |
||
31930 | |||
31931 | const char *VecReturnAttr::getSpelling() const { |
||
31932 | switch (getAttributeSpellingListIndex()) { |
||
31933 | default: |
||
31934 | llvm_unreachable("Unknown attribute spelling!"); |
||
31935 | return "(No spelling)"; |
||
31936 | case 0: |
||
31937 | return "vecreturn"; |
||
31938 | case 1: |
||
31939 | return "vecreturn"; |
||
31940 | } |
||
31941 | } |
||
31942 | |||
31943 | |||
31944 | // VecTypeHintAttr implementation |
||
31945 | |||
31946 | VecTypeHintAttr *VecTypeHintAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypeHint, const AttributeCommonInfo &CommonInfo) { |
||
31947 | auto *A = new (Ctx) VecTypeHintAttr(Ctx, CommonInfo, TypeHint); |
||
31948 | A->setImplicit(true); |
||
31949 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31950 | A->setAttributeSpellingListIndex(0); |
||
31951 | return A; |
||
31952 | } |
||
31953 | |||
31954 | VecTypeHintAttr *VecTypeHintAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypeHint, const AttributeCommonInfo &CommonInfo) { |
||
31955 | auto *A = new (Ctx) VecTypeHintAttr(Ctx, CommonInfo, TypeHint); |
||
31956 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
31957 | A->setAttributeSpellingListIndex(0); |
||
31958 | return A; |
||
31959 | } |
||
31960 | |||
31961 | VecTypeHintAttr *VecTypeHintAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypeHint, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31962 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31963 | return CreateImplicit(Ctx, TypeHint, I); |
||
31964 | } |
||
31965 | |||
31966 | VecTypeHintAttr *VecTypeHintAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypeHint, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
31967 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
31968 | return Create(Ctx, TypeHint, I); |
||
31969 | } |
||
31970 | |||
31971 | VecTypeHintAttr::VecTypeHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
31972 | , TypeSourceInfo * TypeHint |
||
31973 | ) |
||
31974 | : InheritableAttr(Ctx, CommonInfo, attr::VecTypeHint, false, false) |
||
31975 | , typeHint(TypeHint) |
||
31976 | { |
||
31977 | } |
||
31978 | |||
31979 | |||
31980 | |||
31981 | VecTypeHintAttr *VecTypeHintAttr::clone(ASTContext &C) const { |
||
31982 | auto *A = new (C) VecTypeHintAttr(C, *this, typeHint); |
||
31983 | A->Inherited = Inherited; |
||
31984 | A->IsPackExpansion = IsPackExpansion; |
||
31985 | A->setImplicit(Implicit); |
||
31986 | return A; |
||
31987 | } |
||
31988 | |||
31989 | void VecTypeHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
31990 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
31991 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
31992 | switch (getAttributeSpellingListIndex()) { |
||
31993 | default: |
||
31994 | llvm_unreachable("Unknown attribute spelling!"); |
||
31995 | break; |
||
31996 | case 0 : { |
||
31997 | OS << " __attribute__((vec_type_hint"; |
||
31998 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
31999 | OS << "" << getTypeHint().getAsString() << ""; |
||
32000 | if (!IsFirstArgument) |
||
32001 | OS << ")"; |
||
32002 | OS << "))"; |
||
32003 | break; |
||
32004 | } |
||
32005 | } |
||
32006 | } |
||
32007 | |||
32008 | const char *VecTypeHintAttr::getSpelling() const { |
||
32009 | switch (getAttributeSpellingListIndex()) { |
||
32010 | default: |
||
32011 | llvm_unreachable("Unknown attribute spelling!"); |
||
32012 | return "(No spelling)"; |
||
32013 | case 0: |
||
32014 | return "vec_type_hint"; |
||
32015 | } |
||
32016 | } |
||
32017 | |||
32018 | |||
32019 | // VectorCallAttr implementation |
||
32020 | |||
32021 | VectorCallAttr *VectorCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
32022 | auto *A = new (Ctx) VectorCallAttr(Ctx, CommonInfo); |
||
32023 | A->setImplicit(true); |
||
32024 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32025 | A->setAttributeSpellingListIndex(0); |
||
32026 | return A; |
||
32027 | } |
||
32028 | |||
32029 | VectorCallAttr *VectorCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
32030 | auto *A = new (Ctx) VectorCallAttr(Ctx, CommonInfo); |
||
32031 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32032 | A->setAttributeSpellingListIndex(0); |
||
32033 | return A; |
||
32034 | } |
||
32035 | |||
32036 | VectorCallAttr *VectorCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32037 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32038 | return CreateImplicit(Ctx, I); |
||
32039 | } |
||
32040 | |||
32041 | VectorCallAttr *VectorCallAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32042 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32043 | return Create(Ctx, I); |
||
32044 | } |
||
32045 | |||
32046 | VectorCallAttr::VectorCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32047 | ) |
||
32048 | : InheritableAttr(Ctx, CommonInfo, attr::VectorCall, false, false) |
||
32049 | { |
||
32050 | } |
||
32051 | |||
32052 | VectorCallAttr *VectorCallAttr::clone(ASTContext &C) const { |
||
32053 | auto *A = new (C) VectorCallAttr(C, *this); |
||
32054 | A->Inherited = Inherited; |
||
32055 | A->IsPackExpansion = IsPackExpansion; |
||
32056 | A->setImplicit(Implicit); |
||
32057 | return A; |
||
32058 | } |
||
32059 | |||
32060 | void VectorCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32061 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32062 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32063 | switch (getAttributeSpellingListIndex()) { |
||
32064 | default: |
||
32065 | llvm_unreachable("Unknown attribute spelling!"); |
||
32066 | break; |
||
32067 | case 0 : { |
||
32068 | OS << " __attribute__((vectorcall"; |
||
32069 | OS << "))"; |
||
32070 | break; |
||
32071 | } |
||
32072 | case 1 : { |
||
32073 | OS << " [[clang::vectorcall"; |
||
32074 | OS << "]]"; |
||
32075 | break; |
||
32076 | } |
||
32077 | case 2 : { |
||
32078 | OS << " [[clang::vectorcall"; |
||
32079 | OS << "]]"; |
||
32080 | break; |
||
32081 | } |
||
32082 | case 3 : { |
||
32083 | OS << " __vectorcall"; |
||
32084 | OS << ""; |
||
32085 | break; |
||
32086 | } |
||
32087 | case 4 : { |
||
32088 | OS << " _vectorcall"; |
||
32089 | OS << ""; |
||
32090 | break; |
||
32091 | } |
||
32092 | } |
||
32093 | } |
||
32094 | |||
32095 | const char *VectorCallAttr::getSpelling() const { |
||
32096 | switch (getAttributeSpellingListIndex()) { |
||
32097 | default: |
||
32098 | llvm_unreachable("Unknown attribute spelling!"); |
||
32099 | return "(No spelling)"; |
||
32100 | case 0: |
||
32101 | return "vectorcall"; |
||
32102 | case 1: |
||
32103 | return "vectorcall"; |
||
32104 | case 2: |
||
32105 | return "vectorcall"; |
||
32106 | case 3: |
||
32107 | return "__vectorcall"; |
||
32108 | case 4: |
||
32109 | return "_vectorcall"; |
||
32110 | } |
||
32111 | } |
||
32112 | |||
32113 | |||
32114 | // VisibilityAttr implementation |
||
32115 | |||
32116 | VisibilityAttr *VisibilityAttr::CreateImplicit(ASTContext &Ctx, VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) { |
||
32117 | auto *A = new (Ctx) VisibilityAttr(Ctx, CommonInfo, Visibility); |
||
32118 | A->setImplicit(true); |
||
32119 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32120 | A->setAttributeSpellingListIndex(0); |
||
32121 | return A; |
||
32122 | } |
||
32123 | |||
32124 | VisibilityAttr *VisibilityAttr::Create(ASTContext &Ctx, VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) { |
||
32125 | auto *A = new (Ctx) VisibilityAttr(Ctx, CommonInfo, Visibility); |
||
32126 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32127 | A->setAttributeSpellingListIndex(0); |
||
32128 | return A; |
||
32129 | } |
||
32130 | |||
32131 | VisibilityAttr *VisibilityAttr::CreateImplicit(ASTContext &Ctx, VisibilityType Visibility, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32132 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32133 | return CreateImplicit(Ctx, Visibility, I); |
||
32134 | } |
||
32135 | |||
32136 | VisibilityAttr *VisibilityAttr::Create(ASTContext &Ctx, VisibilityType Visibility, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32137 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32138 | return Create(Ctx, Visibility, I); |
||
32139 | } |
||
32140 | |||
32141 | VisibilityAttr::VisibilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32142 | , VisibilityType Visibility |
||
32143 | ) |
||
32144 | : InheritableAttr(Ctx, CommonInfo, attr::Visibility, false, false) |
||
32145 | , visibility(Visibility) |
||
32146 | { |
||
32147 | } |
||
32148 | |||
32149 | |||
32150 | |||
32151 | bool VisibilityAttr::ConvertStrToVisibilityType(StringRef Val, VisibilityType &Out) { |
||
32152 | std::optional<VisibilityType> R = llvm::StringSwitch<std::optional<VisibilityType>>(Val) |
||
32153 | .Case("default", VisibilityAttr::Default) |
||
32154 | .Case("hidden", VisibilityAttr::Hidden) |
||
32155 | .Case("internal", VisibilityAttr::Hidden) |
||
32156 | .Case("protected", VisibilityAttr::Protected) |
||
32157 | .Default(std::optional<VisibilityType>()); |
||
32158 | if (R) { |
||
32159 | Out = *R; |
||
32160 | return true; |
||
32161 | } |
||
32162 | return false; |
||
32163 | } |
||
32164 | |||
32165 | const char *VisibilityAttr::ConvertVisibilityTypeToStr(VisibilityType Val) { |
||
32166 | switch(Val) { |
||
32167 | case VisibilityAttr::Default: return "default"; |
||
32168 | case VisibilityAttr::Hidden: return "hidden"; |
||
32169 | case VisibilityAttr::Protected: return "protected"; |
||
32170 | } |
||
32171 | llvm_unreachable("No enumerator with that value"); |
||
32172 | } |
||
32173 | VisibilityAttr *VisibilityAttr::clone(ASTContext &C) const { |
||
32174 | auto *A = new (C) VisibilityAttr(C, *this, visibility); |
||
32175 | A->Inherited = Inherited; |
||
32176 | A->IsPackExpansion = IsPackExpansion; |
||
32177 | A->setImplicit(Implicit); |
||
32178 | return A; |
||
32179 | } |
||
32180 | |||
32181 | void VisibilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32182 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32183 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32184 | switch (getAttributeSpellingListIndex()) { |
||
32185 | default: |
||
32186 | llvm_unreachable("Unknown attribute spelling!"); |
||
32187 | break; |
||
32188 | case 0 : { |
||
32189 | OS << " __attribute__((visibility"; |
||
32190 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32191 | OS << "\"" << VisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; |
||
32192 | if (!IsFirstArgument) |
||
32193 | OS << ")"; |
||
32194 | OS << "))"; |
||
32195 | break; |
||
32196 | } |
||
32197 | case 1 : { |
||
32198 | OS << " [[gnu::visibility"; |
||
32199 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32200 | OS << "\"" << VisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; |
||
32201 | if (!IsFirstArgument) |
||
32202 | OS << ")"; |
||
32203 | OS << "]]"; |
||
32204 | break; |
||
32205 | } |
||
32206 | case 2 : { |
||
32207 | OS << " [[gnu::visibility"; |
||
32208 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32209 | OS << "\"" << VisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; |
||
32210 | if (!IsFirstArgument) |
||
32211 | OS << ")"; |
||
32212 | OS << "]]"; |
||
32213 | break; |
||
32214 | } |
||
32215 | } |
||
32216 | } |
||
32217 | |||
32218 | const char *VisibilityAttr::getSpelling() const { |
||
32219 | switch (getAttributeSpellingListIndex()) { |
||
32220 | default: |
||
32221 | llvm_unreachable("Unknown attribute spelling!"); |
||
32222 | return "(No spelling)"; |
||
32223 | case 0: |
||
32224 | return "visibility"; |
||
32225 | case 1: |
||
32226 | return "visibility"; |
||
32227 | case 2: |
||
32228 | return "visibility"; |
||
32229 | } |
||
32230 | } |
||
32231 | |||
32232 | |||
32233 | // WarnUnusedAttr implementation |
||
32234 | |||
32235 | WarnUnusedAttr *WarnUnusedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
32236 | auto *A = new (Ctx) WarnUnusedAttr(Ctx, CommonInfo); |
||
32237 | A->setImplicit(true); |
||
32238 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32239 | A->setAttributeSpellingListIndex(0); |
||
32240 | return A; |
||
32241 | } |
||
32242 | |||
32243 | WarnUnusedAttr *WarnUnusedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
32244 | auto *A = new (Ctx) WarnUnusedAttr(Ctx, CommonInfo); |
||
32245 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32246 | A->setAttributeSpellingListIndex(0); |
||
32247 | return A; |
||
32248 | } |
||
32249 | |||
32250 | WarnUnusedAttr *WarnUnusedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32251 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32252 | return CreateImplicit(Ctx, I); |
||
32253 | } |
||
32254 | |||
32255 | WarnUnusedAttr *WarnUnusedAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32256 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32257 | return Create(Ctx, I); |
||
32258 | } |
||
32259 | |||
32260 | WarnUnusedAttr::WarnUnusedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32261 | ) |
||
32262 | : InheritableAttr(Ctx, CommonInfo, attr::WarnUnused, false, false) |
||
32263 | { |
||
32264 | } |
||
32265 | |||
32266 | WarnUnusedAttr *WarnUnusedAttr::clone(ASTContext &C) const { |
||
32267 | auto *A = new (C) WarnUnusedAttr(C, *this); |
||
32268 | A->Inherited = Inherited; |
||
32269 | A->IsPackExpansion = IsPackExpansion; |
||
32270 | A->setImplicit(Implicit); |
||
32271 | return A; |
||
32272 | } |
||
32273 | |||
32274 | void WarnUnusedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32275 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32276 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32277 | switch (getAttributeSpellingListIndex()) { |
||
32278 | default: |
||
32279 | llvm_unreachable("Unknown attribute spelling!"); |
||
32280 | break; |
||
32281 | case 0 : { |
||
32282 | OS << " __attribute__((warn_unused"; |
||
32283 | OS << "))"; |
||
32284 | break; |
||
32285 | } |
||
32286 | case 1 : { |
||
32287 | OS << " [[gnu::warn_unused"; |
||
32288 | OS << "]]"; |
||
32289 | break; |
||
32290 | } |
||
32291 | case 2 : { |
||
32292 | OS << " [[gnu::warn_unused"; |
||
32293 | OS << "]]"; |
||
32294 | break; |
||
32295 | } |
||
32296 | } |
||
32297 | } |
||
32298 | |||
32299 | const char *WarnUnusedAttr::getSpelling() const { |
||
32300 | switch (getAttributeSpellingListIndex()) { |
||
32301 | default: |
||
32302 | llvm_unreachable("Unknown attribute spelling!"); |
||
32303 | return "(No spelling)"; |
||
32304 | case 0: |
||
32305 | return "warn_unused"; |
||
32306 | case 1: |
||
32307 | return "warn_unused"; |
||
32308 | case 2: |
||
32309 | return "warn_unused"; |
||
32310 | } |
||
32311 | } |
||
32312 | |||
32313 | |||
32314 | // WarnUnusedResultAttr implementation |
||
32315 | |||
32316 | WarnUnusedResultAttr *WarnUnusedResultAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { |
||
32317 | auto *A = new (Ctx) WarnUnusedResultAttr(Ctx, CommonInfo, Message); |
||
32318 | A->setImplicit(true); |
||
32319 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32320 | A->setAttributeSpellingListIndex(0); |
||
32321 | return A; |
||
32322 | } |
||
32323 | |||
32324 | WarnUnusedResultAttr *WarnUnusedResultAttr::Create(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { |
||
32325 | auto *A = new (Ctx) WarnUnusedResultAttr(Ctx, CommonInfo, Message); |
||
32326 | return A; |
||
32327 | } |
||
32328 | |||
32329 | WarnUnusedResultAttr *WarnUnusedResultAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, AttributeCommonInfo::Syntax Syntax, WarnUnusedResultAttr::Spelling S) { |
||
32330 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
32331 | return CreateImplicit(Ctx, Message, I); |
||
32332 | } |
||
32333 | |||
32334 | WarnUnusedResultAttr *WarnUnusedResultAttr::Create(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, AttributeCommonInfo::Syntax Syntax, WarnUnusedResultAttr::Spelling S) { |
||
32335 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
32336 | return Create(Ctx, Message, I); |
||
32337 | } |
||
32338 | |||
32339 | WarnUnusedResultAttr::WarnUnusedResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32340 | , llvm::StringRef Message |
||
32341 | ) |
||
32342 | : InheritableAttr(Ctx, CommonInfo, attr::WarnUnusedResult, false, false) |
||
32343 | , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) |
||
32344 | { |
||
32345 | if (!Message.empty()) |
||
32346 | std::memcpy(message, Message.data(), messageLength); |
||
32347 | } |
||
32348 | |||
32349 | WarnUnusedResultAttr::WarnUnusedResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32350 | ) |
||
32351 | : InheritableAttr(Ctx, CommonInfo, attr::WarnUnusedResult, false, false) |
||
32352 | , messageLength(0),message(nullptr) |
||
32353 | { |
||
32354 | } |
||
32355 | |||
32356 | WarnUnusedResultAttr::Spelling WarnUnusedResultAttr::getSemanticSpelling() const { |
||
32357 | switch (getAttributeSpellingListIndex()) { |
||
32358 | default: llvm_unreachable("Unknown spelling list index"); |
||
32359 | case 0: return CXX11_nodiscard; |
||
32360 | case 1: return C2x_nodiscard; |
||
32361 | case 2: return CXX11_clang_warn_unused_result; |
||
32362 | case 3: return GNU_warn_unused_result; |
||
32363 | case 4: return CXX11_gnu_warn_unused_result; |
||
32364 | case 5: return C2x_gnu_warn_unused_result; |
||
32365 | } |
||
32366 | } |
||
32367 | |||
32368 | |||
32369 | WarnUnusedResultAttr *WarnUnusedResultAttr::clone(ASTContext &C) const { |
||
32370 | auto *A = new (C) WarnUnusedResultAttr(C, *this, getMessage()); |
||
32371 | A->Inherited = Inherited; |
||
32372 | A->IsPackExpansion = IsPackExpansion; |
||
32373 | A->setImplicit(Implicit); |
||
32374 | return A; |
||
32375 | } |
||
32376 | |||
32377 | void WarnUnusedResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32378 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32379 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32380 | switch (getAttributeSpellingListIndex()) { |
||
32381 | default: |
||
32382 | llvm_unreachable("Unknown attribute spelling!"); |
||
32383 | break; |
||
32384 | case 0 : { |
||
32385 | OS << " [[nodiscard"; |
||
32386 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32387 | OS << "\"" << getMessage() << "\""; |
||
32388 | if (!IsFirstArgument) |
||
32389 | OS << ")"; |
||
32390 | OS << "]]"; |
||
32391 | break; |
||
32392 | } |
||
32393 | case 1 : { |
||
32394 | OS << " [[nodiscard"; |
||
32395 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32396 | OS << "\"" << getMessage() << "\""; |
||
32397 | if (!IsFirstArgument) |
||
32398 | OS << ")"; |
||
32399 | OS << "]]"; |
||
32400 | break; |
||
32401 | } |
||
32402 | case 2 : { |
||
32403 | OS << " [[clang::warn_unused_result"; |
||
32404 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32405 | OS << "\"" << getMessage() << "\""; |
||
32406 | if (!IsFirstArgument) |
||
32407 | OS << ")"; |
||
32408 | OS << "]]"; |
||
32409 | break; |
||
32410 | } |
||
32411 | case 3 : { |
||
32412 | OS << " __attribute__((warn_unused_result"; |
||
32413 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32414 | OS << "\"" << getMessage() << "\""; |
||
32415 | if (!IsFirstArgument) |
||
32416 | OS << ")"; |
||
32417 | OS << "))"; |
||
32418 | break; |
||
32419 | } |
||
32420 | case 4 : { |
||
32421 | OS << " [[gnu::warn_unused_result"; |
||
32422 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32423 | OS << "\"" << getMessage() << "\""; |
||
32424 | if (!IsFirstArgument) |
||
32425 | OS << ")"; |
||
32426 | OS << "]]"; |
||
32427 | break; |
||
32428 | } |
||
32429 | case 5 : { |
||
32430 | OS << " [[gnu::warn_unused_result"; |
||
32431 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32432 | OS << "\"" << getMessage() << "\""; |
||
32433 | if (!IsFirstArgument) |
||
32434 | OS << ")"; |
||
32435 | OS << "]]"; |
||
32436 | break; |
||
32437 | } |
||
32438 | } |
||
32439 | } |
||
32440 | |||
32441 | const char *WarnUnusedResultAttr::getSpelling() const { |
||
32442 | switch (getAttributeSpellingListIndex()) { |
||
32443 | default: |
||
32444 | llvm_unreachable("Unknown attribute spelling!"); |
||
32445 | return "(No spelling)"; |
||
32446 | case 0: |
||
32447 | return "nodiscard"; |
||
32448 | case 1: |
||
32449 | return "nodiscard"; |
||
32450 | case 2: |
||
32451 | return "warn_unused_result"; |
||
32452 | case 3: |
||
32453 | return "warn_unused_result"; |
||
32454 | case 4: |
||
32455 | return "warn_unused_result"; |
||
32456 | case 5: |
||
32457 | return "warn_unused_result"; |
||
32458 | } |
||
32459 | } |
||
32460 | |||
32461 | |||
32462 | // WeakAttr implementation |
||
32463 | |||
32464 | WeakAttr *WeakAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
32465 | auto *A = new (Ctx) WeakAttr(Ctx, CommonInfo); |
||
32466 | A->setImplicit(true); |
||
32467 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32468 | A->setAttributeSpellingListIndex(0); |
||
32469 | return A; |
||
32470 | } |
||
32471 | |||
32472 | WeakAttr *WeakAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
32473 | auto *A = new (Ctx) WeakAttr(Ctx, CommonInfo); |
||
32474 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32475 | A->setAttributeSpellingListIndex(0); |
||
32476 | return A; |
||
32477 | } |
||
32478 | |||
32479 | WeakAttr *WeakAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32480 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32481 | return CreateImplicit(Ctx, I); |
||
32482 | } |
||
32483 | |||
32484 | WeakAttr *WeakAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32485 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32486 | return Create(Ctx, I); |
||
32487 | } |
||
32488 | |||
32489 | WeakAttr::WeakAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32490 | ) |
||
32491 | : InheritableAttr(Ctx, CommonInfo, attr::Weak, false, false) |
||
32492 | { |
||
32493 | } |
||
32494 | |||
32495 | WeakAttr *WeakAttr::clone(ASTContext &C) const { |
||
32496 | auto *A = new (C) WeakAttr(C, *this); |
||
32497 | A->Inherited = Inherited; |
||
32498 | A->IsPackExpansion = IsPackExpansion; |
||
32499 | A->setImplicit(Implicit); |
||
32500 | return A; |
||
32501 | } |
||
32502 | |||
32503 | void WeakAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32504 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32505 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32506 | switch (getAttributeSpellingListIndex()) { |
||
32507 | default: |
||
32508 | llvm_unreachable("Unknown attribute spelling!"); |
||
32509 | break; |
||
32510 | case 0 : { |
||
32511 | OS << " __attribute__((weak"; |
||
32512 | OS << "))"; |
||
32513 | break; |
||
32514 | } |
||
32515 | case 1 : { |
||
32516 | OS << " [[gnu::weak"; |
||
32517 | OS << "]]"; |
||
32518 | break; |
||
32519 | } |
||
32520 | case 2 : { |
||
32521 | OS << " [[gnu::weak"; |
||
32522 | OS << "]]"; |
||
32523 | break; |
||
32524 | } |
||
32525 | } |
||
32526 | } |
||
32527 | |||
32528 | const char *WeakAttr::getSpelling() const { |
||
32529 | switch (getAttributeSpellingListIndex()) { |
||
32530 | default: |
||
32531 | llvm_unreachable("Unknown attribute spelling!"); |
||
32532 | return "(No spelling)"; |
||
32533 | case 0: |
||
32534 | return "weak"; |
||
32535 | case 1: |
||
32536 | return "weak"; |
||
32537 | case 2: |
||
32538 | return "weak"; |
||
32539 | } |
||
32540 | } |
||
32541 | |||
32542 | |||
32543 | // WeakImportAttr implementation |
||
32544 | |||
32545 | WeakImportAttr *WeakImportAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
32546 | auto *A = new (Ctx) WeakImportAttr(Ctx, CommonInfo); |
||
32547 | A->setImplicit(true); |
||
32548 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32549 | A->setAttributeSpellingListIndex(0); |
||
32550 | return A; |
||
32551 | } |
||
32552 | |||
32553 | WeakImportAttr *WeakImportAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
32554 | auto *A = new (Ctx) WeakImportAttr(Ctx, CommonInfo); |
||
32555 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32556 | A->setAttributeSpellingListIndex(0); |
||
32557 | return A; |
||
32558 | } |
||
32559 | |||
32560 | WeakImportAttr *WeakImportAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32561 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32562 | return CreateImplicit(Ctx, I); |
||
32563 | } |
||
32564 | |||
32565 | WeakImportAttr *WeakImportAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32566 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32567 | return Create(Ctx, I); |
||
32568 | } |
||
32569 | |||
32570 | WeakImportAttr::WeakImportAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32571 | ) |
||
32572 | : InheritableAttr(Ctx, CommonInfo, attr::WeakImport, false, false) |
||
32573 | { |
||
32574 | } |
||
32575 | |||
32576 | WeakImportAttr *WeakImportAttr::clone(ASTContext &C) const { |
||
32577 | auto *A = new (C) WeakImportAttr(C, *this); |
||
32578 | A->Inherited = Inherited; |
||
32579 | A->IsPackExpansion = IsPackExpansion; |
||
32580 | A->setImplicit(Implicit); |
||
32581 | return A; |
||
32582 | } |
||
32583 | |||
32584 | void WeakImportAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32585 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32586 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32587 | switch (getAttributeSpellingListIndex()) { |
||
32588 | default: |
||
32589 | llvm_unreachable("Unknown attribute spelling!"); |
||
32590 | break; |
||
32591 | case 0 : { |
||
32592 | OS << " __attribute__((weak_import"; |
||
32593 | OS << "))"; |
||
32594 | break; |
||
32595 | } |
||
32596 | case 1 : { |
||
32597 | OS << " [[clang::weak_import"; |
||
32598 | OS << "]]"; |
||
32599 | break; |
||
32600 | } |
||
32601 | case 2 : { |
||
32602 | OS << " [[clang::weak_import"; |
||
32603 | OS << "]]"; |
||
32604 | break; |
||
32605 | } |
||
32606 | } |
||
32607 | } |
||
32608 | |||
32609 | const char *WeakImportAttr::getSpelling() const { |
||
32610 | switch (getAttributeSpellingListIndex()) { |
||
32611 | default: |
||
32612 | llvm_unreachable("Unknown attribute spelling!"); |
||
32613 | return "(No spelling)"; |
||
32614 | case 0: |
||
32615 | return "weak_import"; |
||
32616 | case 1: |
||
32617 | return "weak_import"; |
||
32618 | case 2: |
||
32619 | return "weak_import"; |
||
32620 | } |
||
32621 | } |
||
32622 | |||
32623 | |||
32624 | // WeakRefAttr implementation |
||
32625 | |||
32626 | WeakRefAttr *WeakRefAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) { |
||
32627 | auto *A = new (Ctx) WeakRefAttr(Ctx, CommonInfo, Aliasee); |
||
32628 | A->setImplicit(true); |
||
32629 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32630 | A->setAttributeSpellingListIndex(0); |
||
32631 | return A; |
||
32632 | } |
||
32633 | |||
32634 | WeakRefAttr *WeakRefAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) { |
||
32635 | auto *A = new (Ctx) WeakRefAttr(Ctx, CommonInfo, Aliasee); |
||
32636 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32637 | A->setAttributeSpellingListIndex(0); |
||
32638 | return A; |
||
32639 | } |
||
32640 | |||
32641 | WeakRefAttr *WeakRefAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32642 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32643 | return CreateImplicit(Ctx, Aliasee, I); |
||
32644 | } |
||
32645 | |||
32646 | WeakRefAttr *WeakRefAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32647 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32648 | return Create(Ctx, Aliasee, I); |
||
32649 | } |
||
32650 | |||
32651 | WeakRefAttr::WeakRefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32652 | , llvm::StringRef Aliasee |
||
32653 | ) |
||
32654 | : InheritableAttr(Ctx, CommonInfo, attr::WeakRef, false, false) |
||
32655 | , aliaseeLength(Aliasee.size()),aliasee(new (Ctx, 1) char[aliaseeLength]) |
||
32656 | { |
||
32657 | if (!Aliasee.empty()) |
||
32658 | std::memcpy(aliasee, Aliasee.data(), aliaseeLength); |
||
32659 | } |
||
32660 | |||
32661 | WeakRefAttr::WeakRefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32662 | ) |
||
32663 | : InheritableAttr(Ctx, CommonInfo, attr::WeakRef, false, false) |
||
32664 | , aliaseeLength(0),aliasee(nullptr) |
||
32665 | { |
||
32666 | } |
||
32667 | |||
32668 | |||
32669 | |||
32670 | WeakRefAttr *WeakRefAttr::clone(ASTContext &C) const { |
||
32671 | auto *A = new (C) WeakRefAttr(C, *this, getAliasee()); |
||
32672 | A->Inherited = Inherited; |
||
32673 | A->IsPackExpansion = IsPackExpansion; |
||
32674 | A->setImplicit(Implicit); |
||
32675 | return A; |
||
32676 | } |
||
32677 | |||
32678 | void WeakRefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32679 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32680 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32681 | switch (getAttributeSpellingListIndex()) { |
||
32682 | default: |
||
32683 | llvm_unreachable("Unknown attribute spelling!"); |
||
32684 | break; |
||
32685 | case 0 : { |
||
32686 | OS << " __attribute__((weakref"; |
||
32687 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32688 | OS << "\"" << getAliasee() << "\""; |
||
32689 | if (!IsFirstArgument) |
||
32690 | OS << ")"; |
||
32691 | OS << "))"; |
||
32692 | break; |
||
32693 | } |
||
32694 | case 1 : { |
||
32695 | OS << " [[gnu::weakref"; |
||
32696 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32697 | OS << "\"" << getAliasee() << "\""; |
||
32698 | if (!IsFirstArgument) |
||
32699 | OS << ")"; |
||
32700 | OS << "]]"; |
||
32701 | break; |
||
32702 | } |
||
32703 | case 2 : { |
||
32704 | OS << " [[gnu::weakref"; |
||
32705 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32706 | OS << "\"" << getAliasee() << "\""; |
||
32707 | if (!IsFirstArgument) |
||
32708 | OS << ")"; |
||
32709 | OS << "]]"; |
||
32710 | break; |
||
32711 | } |
||
32712 | } |
||
32713 | } |
||
32714 | |||
32715 | const char *WeakRefAttr::getSpelling() const { |
||
32716 | switch (getAttributeSpellingListIndex()) { |
||
32717 | default: |
||
32718 | llvm_unreachable("Unknown attribute spelling!"); |
||
32719 | return "(No spelling)"; |
||
32720 | case 0: |
||
32721 | return "weakref"; |
||
32722 | case 1: |
||
32723 | return "weakref"; |
||
32724 | case 2: |
||
32725 | return "weakref"; |
||
32726 | } |
||
32727 | } |
||
32728 | |||
32729 | |||
32730 | // WebAssemblyExportNameAttr implementation |
||
32731 | |||
32732 | WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ExportName, const AttributeCommonInfo &CommonInfo) { |
||
32733 | auto *A = new (Ctx) WebAssemblyExportNameAttr(Ctx, CommonInfo, ExportName); |
||
32734 | A->setImplicit(true); |
||
32735 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32736 | A->setAttributeSpellingListIndex(0); |
||
32737 | return A; |
||
32738 | } |
||
32739 | |||
32740 | WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ExportName, const AttributeCommonInfo &CommonInfo) { |
||
32741 | auto *A = new (Ctx) WebAssemblyExportNameAttr(Ctx, CommonInfo, ExportName); |
||
32742 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32743 | A->setAttributeSpellingListIndex(0); |
||
32744 | return A; |
||
32745 | } |
||
32746 | |||
32747 | WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ExportName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32748 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32749 | return CreateImplicit(Ctx, ExportName, I); |
||
32750 | } |
||
32751 | |||
32752 | WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ExportName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32753 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32754 | return Create(Ctx, ExportName, I); |
||
32755 | } |
||
32756 | |||
32757 | WebAssemblyExportNameAttr::WebAssemblyExportNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32758 | , llvm::StringRef ExportName |
||
32759 | ) |
||
32760 | : InheritableAttr(Ctx, CommonInfo, attr::WebAssemblyExportName, false, false) |
||
32761 | , exportNameLength(ExportName.size()),exportName(new (Ctx, 1) char[exportNameLength]) |
||
32762 | { |
||
32763 | if (!ExportName.empty()) |
||
32764 | std::memcpy(exportName, ExportName.data(), exportNameLength); |
||
32765 | } |
||
32766 | |||
32767 | |||
32768 | |||
32769 | WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::clone(ASTContext &C) const { |
||
32770 | auto *A = new (C) WebAssemblyExportNameAttr(C, *this, getExportName()); |
||
32771 | A->Inherited = Inherited; |
||
32772 | A->IsPackExpansion = IsPackExpansion; |
||
32773 | A->setImplicit(Implicit); |
||
32774 | return A; |
||
32775 | } |
||
32776 | |||
32777 | void WebAssemblyExportNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32778 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32779 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32780 | switch (getAttributeSpellingListIndex()) { |
||
32781 | default: |
||
32782 | llvm_unreachable("Unknown attribute spelling!"); |
||
32783 | break; |
||
32784 | case 0 : { |
||
32785 | OS << " __attribute__((export_name"; |
||
32786 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32787 | OS << "\"" << getExportName() << "\""; |
||
32788 | if (!IsFirstArgument) |
||
32789 | OS << ")"; |
||
32790 | OS << "))"; |
||
32791 | break; |
||
32792 | } |
||
32793 | case 1 : { |
||
32794 | OS << " [[clang::export_name"; |
||
32795 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32796 | OS << "\"" << getExportName() << "\""; |
||
32797 | if (!IsFirstArgument) |
||
32798 | OS << ")"; |
||
32799 | OS << "]]"; |
||
32800 | break; |
||
32801 | } |
||
32802 | case 2 : { |
||
32803 | OS << " [[clang::export_name"; |
||
32804 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32805 | OS << "\"" << getExportName() << "\""; |
||
32806 | if (!IsFirstArgument) |
||
32807 | OS << ")"; |
||
32808 | OS << "]]"; |
||
32809 | break; |
||
32810 | } |
||
32811 | } |
||
32812 | } |
||
32813 | |||
32814 | const char *WebAssemblyExportNameAttr::getSpelling() const { |
||
32815 | switch (getAttributeSpellingListIndex()) { |
||
32816 | default: |
||
32817 | llvm_unreachable("Unknown attribute spelling!"); |
||
32818 | return "(No spelling)"; |
||
32819 | case 0: |
||
32820 | return "export_name"; |
||
32821 | case 1: |
||
32822 | return "export_name"; |
||
32823 | case 2: |
||
32824 | return "export_name"; |
||
32825 | } |
||
32826 | } |
||
32827 | |||
32828 | |||
32829 | // WebAssemblyImportModuleAttr implementation |
||
32830 | |||
32831 | WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportModule, const AttributeCommonInfo &CommonInfo) { |
||
32832 | auto *A = new (Ctx) WebAssemblyImportModuleAttr(Ctx, CommonInfo, ImportModule); |
||
32833 | A->setImplicit(true); |
||
32834 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32835 | A->setAttributeSpellingListIndex(0); |
||
32836 | return A; |
||
32837 | } |
||
32838 | |||
32839 | WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::Create(ASTContext &Ctx, llvm::StringRef ImportModule, const AttributeCommonInfo &CommonInfo) { |
||
32840 | auto *A = new (Ctx) WebAssemblyImportModuleAttr(Ctx, CommonInfo, ImportModule); |
||
32841 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32842 | A->setAttributeSpellingListIndex(0); |
||
32843 | return A; |
||
32844 | } |
||
32845 | |||
32846 | WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportModule, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32847 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32848 | return CreateImplicit(Ctx, ImportModule, I); |
||
32849 | } |
||
32850 | |||
32851 | WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::Create(ASTContext &Ctx, llvm::StringRef ImportModule, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32852 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32853 | return Create(Ctx, ImportModule, I); |
||
32854 | } |
||
32855 | |||
32856 | WebAssemblyImportModuleAttr::WebAssemblyImportModuleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32857 | , llvm::StringRef ImportModule |
||
32858 | ) |
||
32859 | : InheritableAttr(Ctx, CommonInfo, attr::WebAssemblyImportModule, false, false) |
||
32860 | , importModuleLength(ImportModule.size()),importModule(new (Ctx, 1) char[importModuleLength]) |
||
32861 | { |
||
32862 | if (!ImportModule.empty()) |
||
32863 | std::memcpy(importModule, ImportModule.data(), importModuleLength); |
||
32864 | } |
||
32865 | |||
32866 | |||
32867 | |||
32868 | WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::clone(ASTContext &C) const { |
||
32869 | auto *A = new (C) WebAssemblyImportModuleAttr(C, *this, getImportModule()); |
||
32870 | A->Inherited = Inherited; |
||
32871 | A->IsPackExpansion = IsPackExpansion; |
||
32872 | A->setImplicit(Implicit); |
||
32873 | return A; |
||
32874 | } |
||
32875 | |||
32876 | void WebAssemblyImportModuleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32877 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32878 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32879 | switch (getAttributeSpellingListIndex()) { |
||
32880 | default: |
||
32881 | llvm_unreachable("Unknown attribute spelling!"); |
||
32882 | break; |
||
32883 | case 0 : { |
||
32884 | OS << " __attribute__((import_module"; |
||
32885 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32886 | OS << "\"" << getImportModule() << "\""; |
||
32887 | if (!IsFirstArgument) |
||
32888 | OS << ")"; |
||
32889 | OS << "))"; |
||
32890 | break; |
||
32891 | } |
||
32892 | case 1 : { |
||
32893 | OS << " [[clang::import_module"; |
||
32894 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32895 | OS << "\"" << getImportModule() << "\""; |
||
32896 | if (!IsFirstArgument) |
||
32897 | OS << ")"; |
||
32898 | OS << "]]"; |
||
32899 | break; |
||
32900 | } |
||
32901 | case 2 : { |
||
32902 | OS << " [[clang::import_module"; |
||
32903 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32904 | OS << "\"" << getImportModule() << "\""; |
||
32905 | if (!IsFirstArgument) |
||
32906 | OS << ")"; |
||
32907 | OS << "]]"; |
||
32908 | break; |
||
32909 | } |
||
32910 | } |
||
32911 | } |
||
32912 | |||
32913 | const char *WebAssemblyImportModuleAttr::getSpelling() const { |
||
32914 | switch (getAttributeSpellingListIndex()) { |
||
32915 | default: |
||
32916 | llvm_unreachable("Unknown attribute spelling!"); |
||
32917 | return "(No spelling)"; |
||
32918 | case 0: |
||
32919 | return "import_module"; |
||
32920 | case 1: |
||
32921 | return "import_module"; |
||
32922 | case 2: |
||
32923 | return "import_module"; |
||
32924 | } |
||
32925 | } |
||
32926 | |||
32927 | |||
32928 | // WebAssemblyImportNameAttr implementation |
||
32929 | |||
32930 | WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportName, const AttributeCommonInfo &CommonInfo) { |
||
32931 | auto *A = new (Ctx) WebAssemblyImportNameAttr(Ctx, CommonInfo, ImportName); |
||
32932 | A->setImplicit(true); |
||
32933 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32934 | A->setAttributeSpellingListIndex(0); |
||
32935 | return A; |
||
32936 | } |
||
32937 | |||
32938 | WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ImportName, const AttributeCommonInfo &CommonInfo) { |
||
32939 | auto *A = new (Ctx) WebAssemblyImportNameAttr(Ctx, CommonInfo, ImportName); |
||
32940 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
32941 | A->setAttributeSpellingListIndex(0); |
||
32942 | return A; |
||
32943 | } |
||
32944 | |||
32945 | WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32946 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32947 | return CreateImplicit(Ctx, ImportName, I); |
||
32948 | } |
||
32949 | |||
32950 | WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ImportName, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
32951 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
32952 | return Create(Ctx, ImportName, I); |
||
32953 | } |
||
32954 | |||
32955 | WebAssemblyImportNameAttr::WebAssemblyImportNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
32956 | , llvm::StringRef ImportName |
||
32957 | ) |
||
32958 | : InheritableAttr(Ctx, CommonInfo, attr::WebAssemblyImportName, false, false) |
||
32959 | , importNameLength(ImportName.size()),importName(new (Ctx, 1) char[importNameLength]) |
||
32960 | { |
||
32961 | if (!ImportName.empty()) |
||
32962 | std::memcpy(importName, ImportName.data(), importNameLength); |
||
32963 | } |
||
32964 | |||
32965 | |||
32966 | |||
32967 | WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::clone(ASTContext &C) const { |
||
32968 | auto *A = new (C) WebAssemblyImportNameAttr(C, *this, getImportName()); |
||
32969 | A->Inherited = Inherited; |
||
32970 | A->IsPackExpansion = IsPackExpansion; |
||
32971 | A->setImplicit(Implicit); |
||
32972 | return A; |
||
32973 | } |
||
32974 | |||
32975 | void WebAssemblyImportNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
32976 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
32977 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
32978 | switch (getAttributeSpellingListIndex()) { |
||
32979 | default: |
||
32980 | llvm_unreachable("Unknown attribute spelling!"); |
||
32981 | break; |
||
32982 | case 0 : { |
||
32983 | OS << " __attribute__((import_name"; |
||
32984 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32985 | OS << "\"" << getImportName() << "\""; |
||
32986 | if (!IsFirstArgument) |
||
32987 | OS << ")"; |
||
32988 | OS << "))"; |
||
32989 | break; |
||
32990 | } |
||
32991 | case 1 : { |
||
32992 | OS << " [[clang::import_name"; |
||
32993 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
32994 | OS << "\"" << getImportName() << "\""; |
||
32995 | if (!IsFirstArgument) |
||
32996 | OS << ")"; |
||
32997 | OS << "]]"; |
||
32998 | break; |
||
32999 | } |
||
33000 | case 2 : { |
||
33001 | OS << " [[clang::import_name"; |
||
33002 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33003 | OS << "\"" << getImportName() << "\""; |
||
33004 | if (!IsFirstArgument) |
||
33005 | OS << ")"; |
||
33006 | OS << "]]"; |
||
33007 | break; |
||
33008 | } |
||
33009 | } |
||
33010 | } |
||
33011 | |||
33012 | const char *WebAssemblyImportNameAttr::getSpelling() const { |
||
33013 | switch (getAttributeSpellingListIndex()) { |
||
33014 | default: |
||
33015 | llvm_unreachable("Unknown attribute spelling!"); |
||
33016 | return "(No spelling)"; |
||
33017 | case 0: |
||
33018 | return "import_name"; |
||
33019 | case 1: |
||
33020 | return "import_name"; |
||
33021 | case 2: |
||
33022 | return "import_name"; |
||
33023 | } |
||
33024 | } |
||
33025 | |||
33026 | |||
33027 | // WorkGroupSizeHintAttr implementation |
||
33028 | |||
33029 | WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) { |
||
33030 | auto *A = new (Ctx) WorkGroupSizeHintAttr(Ctx, CommonInfo, XDim, YDim, ZDim); |
||
33031 | A->setImplicit(true); |
||
33032 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
33033 | A->setAttributeSpellingListIndex(0); |
||
33034 | return A; |
||
33035 | } |
||
33036 | |||
33037 | WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) { |
||
33038 | auto *A = new (Ctx) WorkGroupSizeHintAttr(Ctx, CommonInfo, XDim, YDim, ZDim); |
||
33039 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
33040 | A->setAttributeSpellingListIndex(0); |
||
33041 | return A; |
||
33042 | } |
||
33043 | |||
33044 | WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
33045 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
33046 | return CreateImplicit(Ctx, XDim, YDim, ZDim, I); |
||
33047 | } |
||
33048 | |||
33049 | WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
33050 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
33051 | return Create(Ctx, XDim, YDim, ZDim, I); |
||
33052 | } |
||
33053 | |||
33054 | WorkGroupSizeHintAttr::WorkGroupSizeHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
33055 | , unsigned XDim |
||
33056 | , unsigned YDim |
||
33057 | , unsigned ZDim |
||
33058 | ) |
||
33059 | : InheritableAttr(Ctx, CommonInfo, attr::WorkGroupSizeHint, false, false) |
||
33060 | , xDim(XDim) |
||
33061 | , yDim(YDim) |
||
33062 | , zDim(ZDim) |
||
33063 | { |
||
33064 | } |
||
33065 | |||
33066 | |||
33067 | |||
33068 | |||
33069 | |||
33070 | |||
33071 | |||
33072 | WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::clone(ASTContext &C) const { |
||
33073 | auto *A = new (C) WorkGroupSizeHintAttr(C, *this, xDim, yDim, zDim); |
||
33074 | A->Inherited = Inherited; |
||
33075 | A->IsPackExpansion = IsPackExpansion; |
||
33076 | A->setImplicit(Implicit); |
||
33077 | return A; |
||
33078 | } |
||
33079 | |||
33080 | void WorkGroupSizeHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
33081 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
33082 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
33083 | switch (getAttributeSpellingListIndex()) { |
||
33084 | default: |
||
33085 | llvm_unreachable("Unknown attribute spelling!"); |
||
33086 | break; |
||
33087 | case 0 : { |
||
33088 | OS << " __attribute__((work_group_size_hint"; |
||
33089 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33090 | OS << "" << getXDim() << ""; |
||
33091 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33092 | OS << "" << getYDim() << ""; |
||
33093 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33094 | OS << "" << getZDim() << ""; |
||
33095 | if (!IsFirstArgument) |
||
33096 | OS << ")"; |
||
33097 | OS << "))"; |
||
33098 | break; |
||
33099 | } |
||
33100 | } |
||
33101 | } |
||
33102 | |||
33103 | const char *WorkGroupSizeHintAttr::getSpelling() const { |
||
33104 | switch (getAttributeSpellingListIndex()) { |
||
33105 | default: |
||
33106 | llvm_unreachable("Unknown attribute spelling!"); |
||
33107 | return "(No spelling)"; |
||
33108 | case 0: |
||
33109 | return "work_group_size_hint"; |
||
33110 | } |
||
33111 | } |
||
33112 | |||
33113 | |||
33114 | // X86ForceAlignArgPointerAttr implementation |
||
33115 | |||
33116 | X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
33117 | auto *A = new (Ctx) X86ForceAlignArgPointerAttr(Ctx, CommonInfo); |
||
33118 | A->setImplicit(true); |
||
33119 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
33120 | A->setAttributeSpellingListIndex(0); |
||
33121 | return A; |
||
33122 | } |
||
33123 | |||
33124 | X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
33125 | auto *A = new (Ctx) X86ForceAlignArgPointerAttr(Ctx, CommonInfo); |
||
33126 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
33127 | A->setAttributeSpellingListIndex(0); |
||
33128 | return A; |
||
33129 | } |
||
33130 | |||
33131 | X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
33132 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
33133 | return CreateImplicit(Ctx, I); |
||
33134 | } |
||
33135 | |||
33136 | X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
33137 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
33138 | return Create(Ctx, I); |
||
33139 | } |
||
33140 | |||
33141 | X86ForceAlignArgPointerAttr::X86ForceAlignArgPointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
33142 | ) |
||
33143 | : InheritableAttr(Ctx, CommonInfo, attr::X86ForceAlignArgPointer, false, false) |
||
33144 | { |
||
33145 | } |
||
33146 | |||
33147 | X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::clone(ASTContext &C) const { |
||
33148 | auto *A = new (C) X86ForceAlignArgPointerAttr(C, *this); |
||
33149 | A->Inherited = Inherited; |
||
33150 | A->IsPackExpansion = IsPackExpansion; |
||
33151 | A->setImplicit(Implicit); |
||
33152 | return A; |
||
33153 | } |
||
33154 | |||
33155 | void X86ForceAlignArgPointerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
33156 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
33157 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
33158 | switch (getAttributeSpellingListIndex()) { |
||
33159 | default: |
||
33160 | llvm_unreachable("Unknown attribute spelling!"); |
||
33161 | break; |
||
33162 | case 0 : { |
||
33163 | OS << " __attribute__((force_align_arg_pointer"; |
||
33164 | OS << "))"; |
||
33165 | break; |
||
33166 | } |
||
33167 | case 1 : { |
||
33168 | OS << " [[gnu::force_align_arg_pointer"; |
||
33169 | OS << "]]"; |
||
33170 | break; |
||
33171 | } |
||
33172 | case 2 : { |
||
33173 | OS << " [[gnu::force_align_arg_pointer"; |
||
33174 | OS << "]]"; |
||
33175 | break; |
||
33176 | } |
||
33177 | } |
||
33178 | } |
||
33179 | |||
33180 | const char *X86ForceAlignArgPointerAttr::getSpelling() const { |
||
33181 | switch (getAttributeSpellingListIndex()) { |
||
33182 | default: |
||
33183 | llvm_unreachable("Unknown attribute spelling!"); |
||
33184 | return "(No spelling)"; |
||
33185 | case 0: |
||
33186 | return "force_align_arg_pointer"; |
||
33187 | case 1: |
||
33188 | return "force_align_arg_pointer"; |
||
33189 | case 2: |
||
33190 | return "force_align_arg_pointer"; |
||
33191 | } |
||
33192 | } |
||
33193 | |||
33194 | |||
33195 | // XRayInstrumentAttr implementation |
||
33196 | |||
33197 | XRayInstrumentAttr *XRayInstrumentAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
33198 | auto *A = new (Ctx) XRayInstrumentAttr(Ctx, CommonInfo); |
||
33199 | A->setImplicit(true); |
||
33200 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
33201 | A->setAttributeSpellingListIndex(0); |
||
33202 | return A; |
||
33203 | } |
||
33204 | |||
33205 | XRayInstrumentAttr *XRayInstrumentAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { |
||
33206 | auto *A = new (Ctx) XRayInstrumentAttr(Ctx, CommonInfo); |
||
33207 | return A; |
||
33208 | } |
||
33209 | |||
33210 | XRayInstrumentAttr *XRayInstrumentAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, XRayInstrumentAttr::Spelling S) { |
||
33211 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
33212 | return CreateImplicit(Ctx, I); |
||
33213 | } |
||
33214 | |||
33215 | XRayInstrumentAttr *XRayInstrumentAttr::Create(ASTContext &Ctx, SourceRange Range, AttributeCommonInfo::Syntax Syntax, XRayInstrumentAttr::Spelling S) { |
||
33216 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax, S); |
||
33217 | return Create(Ctx, I); |
||
33218 | } |
||
33219 | |||
33220 | XRayInstrumentAttr::XRayInstrumentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
33221 | ) |
||
33222 | : InheritableAttr(Ctx, CommonInfo, attr::XRayInstrument, false, false) |
||
33223 | { |
||
33224 | } |
||
33225 | |||
33226 | XRayInstrumentAttr::Spelling XRayInstrumentAttr::getSemanticSpelling() const { |
||
33227 | switch (getAttributeSpellingListIndex()) { |
||
33228 | default: llvm_unreachable("Unknown spelling list index"); |
||
33229 | case 0: return GNU_xray_always_instrument; |
||
33230 | case 1: return CXX11_clang_xray_always_instrument; |
||
33231 | case 2: return C2x_clang_xray_always_instrument; |
||
33232 | case 3: return GNU_xray_never_instrument; |
||
33233 | case 4: return CXX11_clang_xray_never_instrument; |
||
33234 | case 5: return C2x_clang_xray_never_instrument; |
||
33235 | } |
||
33236 | } |
||
33237 | XRayInstrumentAttr *XRayInstrumentAttr::clone(ASTContext &C) const { |
||
33238 | auto *A = new (C) XRayInstrumentAttr(C, *this); |
||
33239 | A->Inherited = Inherited; |
||
33240 | A->IsPackExpansion = IsPackExpansion; |
||
33241 | A->setImplicit(Implicit); |
||
33242 | return A; |
||
33243 | } |
||
33244 | |||
33245 | void XRayInstrumentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
33246 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
33247 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
33248 | switch (getAttributeSpellingListIndex()) { |
||
33249 | default: |
||
33250 | llvm_unreachable("Unknown attribute spelling!"); |
||
33251 | break; |
||
33252 | case 0 : { |
||
33253 | OS << " __attribute__((xray_always_instrument"; |
||
33254 | OS << "))"; |
||
33255 | break; |
||
33256 | } |
||
33257 | case 1 : { |
||
33258 | OS << " [[clang::xray_always_instrument"; |
||
33259 | OS << "]]"; |
||
33260 | break; |
||
33261 | } |
||
33262 | case 2 : { |
||
33263 | OS << " [[clang::xray_always_instrument"; |
||
33264 | OS << "]]"; |
||
33265 | break; |
||
33266 | } |
||
33267 | case 3 : { |
||
33268 | OS << " __attribute__((xray_never_instrument"; |
||
33269 | OS << "))"; |
||
33270 | break; |
||
33271 | } |
||
33272 | case 4 : { |
||
33273 | OS << " [[clang::xray_never_instrument"; |
||
33274 | OS << "]]"; |
||
33275 | break; |
||
33276 | } |
||
33277 | case 5 : { |
||
33278 | OS << " [[clang::xray_never_instrument"; |
||
33279 | OS << "]]"; |
||
33280 | break; |
||
33281 | } |
||
33282 | } |
||
33283 | } |
||
33284 | |||
33285 | const char *XRayInstrumentAttr::getSpelling() const { |
||
33286 | switch (getAttributeSpellingListIndex()) { |
||
33287 | default: |
||
33288 | llvm_unreachable("Unknown attribute spelling!"); |
||
33289 | return "(No spelling)"; |
||
33290 | case 0: |
||
33291 | return "xray_always_instrument"; |
||
33292 | case 1: |
||
33293 | return "xray_always_instrument"; |
||
33294 | case 2: |
||
33295 | return "xray_always_instrument"; |
||
33296 | case 3: |
||
33297 | return "xray_never_instrument"; |
||
33298 | case 4: |
||
33299 | return "xray_never_instrument"; |
||
33300 | case 5: |
||
33301 | return "xray_never_instrument"; |
||
33302 | } |
||
33303 | } |
||
33304 | |||
33305 | |||
33306 | // XRayLogArgsAttr implementation |
||
33307 | |||
33308 | XRayLogArgsAttr *XRayLogArgsAttr::CreateImplicit(ASTContext &Ctx, unsigned ArgumentCount, const AttributeCommonInfo &CommonInfo) { |
||
33309 | auto *A = new (Ctx) XRayLogArgsAttr(Ctx, CommonInfo, ArgumentCount); |
||
33310 | A->setImplicit(true); |
||
33311 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
33312 | A->setAttributeSpellingListIndex(0); |
||
33313 | return A; |
||
33314 | } |
||
33315 | |||
33316 | XRayLogArgsAttr *XRayLogArgsAttr::Create(ASTContext &Ctx, unsigned ArgumentCount, const AttributeCommonInfo &CommonInfo) { |
||
33317 | auto *A = new (Ctx) XRayLogArgsAttr(Ctx, CommonInfo, ArgumentCount); |
||
33318 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
33319 | A->setAttributeSpellingListIndex(0); |
||
33320 | return A; |
||
33321 | } |
||
33322 | |||
33323 | XRayLogArgsAttr *XRayLogArgsAttr::CreateImplicit(ASTContext &Ctx, unsigned ArgumentCount, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
33324 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
33325 | return CreateImplicit(Ctx, ArgumentCount, I); |
||
33326 | } |
||
33327 | |||
33328 | XRayLogArgsAttr *XRayLogArgsAttr::Create(ASTContext &Ctx, unsigned ArgumentCount, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
33329 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
33330 | return Create(Ctx, ArgumentCount, I); |
||
33331 | } |
||
33332 | |||
33333 | XRayLogArgsAttr::XRayLogArgsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
33334 | , unsigned ArgumentCount |
||
33335 | ) |
||
33336 | : InheritableAttr(Ctx, CommonInfo, attr::XRayLogArgs, false, false) |
||
33337 | , argumentCount(ArgumentCount) |
||
33338 | { |
||
33339 | } |
||
33340 | |||
33341 | |||
33342 | |||
33343 | XRayLogArgsAttr *XRayLogArgsAttr::clone(ASTContext &C) const { |
||
33344 | auto *A = new (C) XRayLogArgsAttr(C, *this, argumentCount); |
||
33345 | A->Inherited = Inherited; |
||
33346 | A->IsPackExpansion = IsPackExpansion; |
||
33347 | A->setImplicit(Implicit); |
||
33348 | return A; |
||
33349 | } |
||
33350 | |||
33351 | void XRayLogArgsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
33352 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
33353 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
33354 | switch (getAttributeSpellingListIndex()) { |
||
33355 | default: |
||
33356 | llvm_unreachable("Unknown attribute spelling!"); |
||
33357 | break; |
||
33358 | case 0 : { |
||
33359 | OS << " __attribute__((xray_log_args"; |
||
33360 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33361 | OS << "" << getArgumentCount() << ""; |
||
33362 | if (!IsFirstArgument) |
||
33363 | OS << ")"; |
||
33364 | OS << "))"; |
||
33365 | break; |
||
33366 | } |
||
33367 | case 1 : { |
||
33368 | OS << " [[clang::xray_log_args"; |
||
33369 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33370 | OS << "" << getArgumentCount() << ""; |
||
33371 | if (!IsFirstArgument) |
||
33372 | OS << ")"; |
||
33373 | OS << "]]"; |
||
33374 | break; |
||
33375 | } |
||
33376 | case 2 : { |
||
33377 | OS << " [[clang::xray_log_args"; |
||
33378 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33379 | OS << "" << getArgumentCount() << ""; |
||
33380 | if (!IsFirstArgument) |
||
33381 | OS << ")"; |
||
33382 | OS << "]]"; |
||
33383 | break; |
||
33384 | } |
||
33385 | } |
||
33386 | } |
||
33387 | |||
33388 | const char *XRayLogArgsAttr::getSpelling() const { |
||
33389 | switch (getAttributeSpellingListIndex()) { |
||
33390 | default: |
||
33391 | llvm_unreachable("Unknown attribute spelling!"); |
||
33392 | return "(No spelling)"; |
||
33393 | case 0: |
||
33394 | return "xray_log_args"; |
||
33395 | case 1: |
||
33396 | return "xray_log_args"; |
||
33397 | case 2: |
||
33398 | return "xray_log_args"; |
||
33399 | } |
||
33400 | } |
||
33401 | |||
33402 | |||
33403 | // ZeroCallUsedRegsAttr implementation |
||
33404 | |||
33405 | ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::CreateImplicit(ASTContext &Ctx, ZeroCallUsedRegsKind ZeroCallUsedRegs, const AttributeCommonInfo &CommonInfo) { |
||
33406 | auto *A = new (Ctx) ZeroCallUsedRegsAttr(Ctx, CommonInfo, ZeroCallUsedRegs); |
||
33407 | A->setImplicit(true); |
||
33408 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
33409 | A->setAttributeSpellingListIndex(0); |
||
33410 | return A; |
||
33411 | } |
||
33412 | |||
33413 | ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::Create(ASTContext &Ctx, ZeroCallUsedRegsKind ZeroCallUsedRegs, const AttributeCommonInfo &CommonInfo) { |
||
33414 | auto *A = new (Ctx) ZeroCallUsedRegsAttr(Ctx, CommonInfo, ZeroCallUsedRegs); |
||
33415 | if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) |
||
33416 | A->setAttributeSpellingListIndex(0); |
||
33417 | return A; |
||
33418 | } |
||
33419 | |||
33420 | ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::CreateImplicit(ASTContext &Ctx, ZeroCallUsedRegsKind ZeroCallUsedRegs, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
33421 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
33422 | return CreateImplicit(Ctx, ZeroCallUsedRegs, I); |
||
33423 | } |
||
33424 | |||
33425 | ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::Create(ASTContext &Ctx, ZeroCallUsedRegsKind ZeroCallUsedRegs, SourceRange Range, AttributeCommonInfo::Syntax Syntax) { |
||
33426 | AttributeCommonInfo I(Range, NoSemaHandlerAttribute, Syntax); |
||
33427 | return Create(Ctx, ZeroCallUsedRegs, I); |
||
33428 | } |
||
33429 | |||
33430 | ZeroCallUsedRegsAttr::ZeroCallUsedRegsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo |
||
33431 | , ZeroCallUsedRegsKind ZeroCallUsedRegs |
||
33432 | ) |
||
33433 | : InheritableAttr(Ctx, CommonInfo, attr::ZeroCallUsedRegs, false, false) |
||
33434 | , zeroCallUsedRegs(ZeroCallUsedRegs) |
||
33435 | { |
||
33436 | } |
||
33437 | |||
33438 | |||
33439 | |||
33440 | bool ZeroCallUsedRegsAttr::ConvertStrToZeroCallUsedRegsKind(StringRef Val, ZeroCallUsedRegsKind &Out) { |
||
33441 | std::optional<ZeroCallUsedRegsKind> R = llvm::StringSwitch<std::optional<ZeroCallUsedRegsKind>>(Val) |
||
33442 | .Case("skip", ZeroCallUsedRegsAttr::Skip) |
||
33443 | .Case("used-gpr-arg", ZeroCallUsedRegsAttr::UsedGPRArg) |
||
33444 | .Case("used-gpr", ZeroCallUsedRegsAttr::UsedGPR) |
||
33445 | .Case("used-arg", ZeroCallUsedRegsAttr::UsedArg) |
||
33446 | .Case("used", ZeroCallUsedRegsAttr::Used) |
||
33447 | .Case("all-gpr-arg", ZeroCallUsedRegsAttr::AllGPRArg) |
||
33448 | .Case("all-gpr", ZeroCallUsedRegsAttr::AllGPR) |
||
33449 | .Case("all-arg", ZeroCallUsedRegsAttr::AllArg) |
||
33450 | .Case("all", ZeroCallUsedRegsAttr::All) |
||
33451 | .Default(std::optional<ZeroCallUsedRegsKind>()); |
||
33452 | if (R) { |
||
33453 | Out = *R; |
||
33454 | return true; |
||
33455 | } |
||
33456 | return false; |
||
33457 | } |
||
33458 | |||
33459 | const char *ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(ZeroCallUsedRegsKind Val) { |
||
33460 | switch(Val) { |
||
33461 | case ZeroCallUsedRegsAttr::Skip: return "skip"; |
||
33462 | case ZeroCallUsedRegsAttr::UsedGPRArg: return "used-gpr-arg"; |
||
33463 | case ZeroCallUsedRegsAttr::UsedGPR: return "used-gpr"; |
||
33464 | case ZeroCallUsedRegsAttr::UsedArg: return "used-arg"; |
||
33465 | case ZeroCallUsedRegsAttr::Used: return "used"; |
||
33466 | case ZeroCallUsedRegsAttr::AllGPRArg: return "all-gpr-arg"; |
||
33467 | case ZeroCallUsedRegsAttr::AllGPR: return "all-gpr"; |
||
33468 | case ZeroCallUsedRegsAttr::AllArg: return "all-arg"; |
||
33469 | case ZeroCallUsedRegsAttr::All: return "all"; |
||
33470 | } |
||
33471 | llvm_unreachable("No enumerator with that value"); |
||
33472 | } |
||
33473 | ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::clone(ASTContext &C) const { |
||
33474 | auto *A = new (C) ZeroCallUsedRegsAttr(C, *this, zeroCallUsedRegs); |
||
33475 | A->Inherited = Inherited; |
||
33476 | A->IsPackExpansion = IsPackExpansion; |
||
33477 | A->setImplicit(Implicit); |
||
33478 | return A; |
||
33479 | } |
||
33480 | |||
33481 | void ZeroCallUsedRegsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
33482 | bool IsFirstArgument = true; (void)IsFirstArgument; |
||
33483 | unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; |
||
33484 | switch (getAttributeSpellingListIndex()) { |
||
33485 | default: |
||
33486 | llvm_unreachable("Unknown attribute spelling!"); |
||
33487 | break; |
||
33488 | case 0 : { |
||
33489 | OS << " __attribute__((zero_call_used_regs"; |
||
33490 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33491 | OS << "\"" << ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(getZeroCallUsedRegs()) << "\""; |
||
33492 | if (!IsFirstArgument) |
||
33493 | OS << ")"; |
||
33494 | OS << "))"; |
||
33495 | break; |
||
33496 | } |
||
33497 | case 1 : { |
||
33498 | OS << " [[gnu::zero_call_used_regs"; |
||
33499 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33500 | OS << "\"" << ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(getZeroCallUsedRegs()) << "\""; |
||
33501 | if (!IsFirstArgument) |
||
33502 | OS << ")"; |
||
33503 | OS << "]]"; |
||
33504 | break; |
||
33505 | } |
||
33506 | case 2 : { |
||
33507 | OS << " [[gnu::zero_call_used_regs"; |
||
33508 | DelimitAttributeArgument(OS, IsFirstArgument); |
||
33509 | OS << "\"" << ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(getZeroCallUsedRegs()) << "\""; |
||
33510 | if (!IsFirstArgument) |
||
33511 | OS << ")"; |
||
33512 | OS << "]]"; |
||
33513 | break; |
||
33514 | } |
||
33515 | } |
||
33516 | } |
||
33517 | |||
33518 | const char *ZeroCallUsedRegsAttr::getSpelling() const { |
||
33519 | switch (getAttributeSpellingListIndex()) { |
||
33520 | default: |
||
33521 | llvm_unreachable("Unknown attribute spelling!"); |
||
33522 | return "(No spelling)"; |
||
33523 | case 0: |
||
33524 | return "zero_call_used_regs"; |
||
33525 | case 1: |
||
33526 | return "zero_call_used_regs"; |
||
33527 | case 2: |
||
33528 | return "zero_call_used_regs"; |
||
33529 | } |
||
33530 | } |
||
33531 | |||
33532 | const char *Attr::getSpelling() const { |
||
33533 | switch (getKind()) { |
||
33534 | case attr::AArch64SVEPcs: |
||
33535 | return cast<AArch64SVEPcsAttr>(this)->getSpelling(); |
||
33536 | case attr::AArch64VectorPcs: |
||
33537 | return cast<AArch64VectorPcsAttr>(this)->getSpelling(); |
||
33538 | case attr::AMDGPUFlatWorkGroupSize: |
||
33539 | return cast<AMDGPUFlatWorkGroupSizeAttr>(this)->getSpelling(); |
||
33540 | case attr::AMDGPUKernelCall: |
||
33541 | return cast<AMDGPUKernelCallAttr>(this)->getSpelling(); |
||
33542 | case attr::AMDGPUNumSGPR: |
||
33543 | return cast<AMDGPUNumSGPRAttr>(this)->getSpelling(); |
||
33544 | case attr::AMDGPUNumVGPR: |
||
33545 | return cast<AMDGPUNumVGPRAttr>(this)->getSpelling(); |
||
33546 | case attr::AMDGPUWavesPerEU: |
||
33547 | return cast<AMDGPUWavesPerEUAttr>(this)->getSpelling(); |
||
33548 | case attr::ARMInterrupt: |
||
33549 | return cast<ARMInterruptAttr>(this)->getSpelling(); |
||
33550 | case attr::AVRInterrupt: |
||
33551 | return cast<AVRInterruptAttr>(this)->getSpelling(); |
||
33552 | case attr::AVRSignal: |
||
33553 | return cast<AVRSignalAttr>(this)->getSpelling(); |
||
33554 | case attr::AbiTag: |
||
33555 | return cast<AbiTagAttr>(this)->getSpelling(); |
||
33556 | case attr::AcquireCapability: |
||
33557 | return cast<AcquireCapabilityAttr>(this)->getSpelling(); |
||
33558 | case attr::AcquireHandle: |
||
33559 | return cast<AcquireHandleAttr>(this)->getSpelling(); |
||
33560 | case attr::AcquiredAfter: |
||
33561 | return cast<AcquiredAfterAttr>(this)->getSpelling(); |
||
33562 | case attr::AcquiredBefore: |
||
33563 | return cast<AcquiredBeforeAttr>(this)->getSpelling(); |
||
33564 | case attr::AddressSpace: |
||
33565 | return cast<AddressSpaceAttr>(this)->getSpelling(); |
||
33566 | case attr::Alias: |
||
33567 | return cast<AliasAttr>(this)->getSpelling(); |
||
33568 | case attr::AlignMac68k: |
||
33569 | return cast<AlignMac68kAttr>(this)->getSpelling(); |
||
33570 | case attr::AlignNatural: |
||
33571 | return cast<AlignNaturalAttr>(this)->getSpelling(); |
||
33572 | case attr::AlignValue: |
||
33573 | return cast<AlignValueAttr>(this)->getSpelling(); |
||
33574 | case attr::Aligned: |
||
33575 | return cast<AlignedAttr>(this)->getSpelling(); |
||
33576 | case attr::AllocAlign: |
||
33577 | return cast<AllocAlignAttr>(this)->getSpelling(); |
||
33578 | case attr::AllocSize: |
||
33579 | return cast<AllocSizeAttr>(this)->getSpelling(); |
||
33580 | case attr::AlwaysDestroy: |
||
33581 | return cast<AlwaysDestroyAttr>(this)->getSpelling(); |
||
33582 | case attr::AlwaysInline: |
||
33583 | return cast<AlwaysInlineAttr>(this)->getSpelling(); |
||
33584 | case attr::AnalyzerNoReturn: |
||
33585 | return cast<AnalyzerNoReturnAttr>(this)->getSpelling(); |
||
33586 | case attr::Annotate: |
||
33587 | return cast<AnnotateAttr>(this)->getSpelling(); |
||
33588 | case attr::AnnotateType: |
||
33589 | return cast<AnnotateTypeAttr>(this)->getSpelling(); |
||
33590 | case attr::AnyX86Interrupt: |
||
33591 | return cast<AnyX86InterruptAttr>(this)->getSpelling(); |
||
33592 | case attr::AnyX86NoCallerSavedRegisters: |
||
33593 | return cast<AnyX86NoCallerSavedRegistersAttr>(this)->getSpelling(); |
||
33594 | case attr::AnyX86NoCfCheck: |
||
33595 | return cast<AnyX86NoCfCheckAttr>(this)->getSpelling(); |
||
33596 | case attr::ArcWeakrefUnavailable: |
||
33597 | return cast<ArcWeakrefUnavailableAttr>(this)->getSpelling(); |
||
33598 | case attr::ArgumentWithTypeTag: |
||
33599 | return cast<ArgumentWithTypeTagAttr>(this)->getSpelling(); |
||
33600 | case attr::ArmBuiltinAlias: |
||
33601 | return cast<ArmBuiltinAliasAttr>(this)->getSpelling(); |
||
33602 | case attr::ArmMveStrictPolymorphism: |
||
33603 | return cast<ArmMveStrictPolymorphismAttr>(this)->getSpelling(); |
||
33604 | case attr::Artificial: |
||
33605 | return cast<ArtificialAttr>(this)->getSpelling(); |
||
33606 | case attr::AsmLabel: |
||
33607 | return cast<AsmLabelAttr>(this)->getSpelling(); |
||
33608 | case attr::AssertCapability: |
||
33609 | return cast<AssertCapabilityAttr>(this)->getSpelling(); |
||
33610 | case attr::AssertExclusiveLock: |
||
33611 | return cast<AssertExclusiveLockAttr>(this)->getSpelling(); |
||
33612 | case attr::AssertSharedLock: |
||
33613 | return cast<AssertSharedLockAttr>(this)->getSpelling(); |
||
33614 | case attr::AssumeAligned: |
||
33615 | return cast<AssumeAlignedAttr>(this)->getSpelling(); |
||
33616 | case attr::Assumption: |
||
33617 | return cast<AssumptionAttr>(this)->getSpelling(); |
||
33618 | case attr::Availability: |
||
33619 | return cast<AvailabilityAttr>(this)->getSpelling(); |
||
33620 | case attr::BPFPreserveAccessIndex: |
||
33621 | return cast<BPFPreserveAccessIndexAttr>(this)->getSpelling(); |
||
33622 | case attr::BTFDeclTag: |
||
33623 | return cast<BTFDeclTagAttr>(this)->getSpelling(); |
||
33624 | case attr::BTFTypeTag: |
||
33625 | return cast<BTFTypeTagAttr>(this)->getSpelling(); |
||
33626 | case attr::Blocks: |
||
33627 | return cast<BlocksAttr>(this)->getSpelling(); |
||
33628 | case attr::Builtin: |
||
33629 | return cast<BuiltinAttr>(this)->getSpelling(); |
||
33630 | case attr::BuiltinAlias: |
||
33631 | return cast<BuiltinAliasAttr>(this)->getSpelling(); |
||
33632 | case attr::C11NoReturn: |
||
33633 | return cast<C11NoReturnAttr>(this)->getSpelling(); |
||
33634 | case attr::CDecl: |
||
33635 | return cast<CDeclAttr>(this)->getSpelling(); |
||
33636 | case attr::CFAuditedTransfer: |
||
33637 | return cast<CFAuditedTransferAttr>(this)->getSpelling(); |
||
33638 | case attr::CFConsumed: |
||
33639 | return cast<CFConsumedAttr>(this)->getSpelling(); |
||
33640 | case attr::CFGuard: |
||
33641 | return cast<CFGuardAttr>(this)->getSpelling(); |
||
33642 | case attr::CFICanonicalJumpTable: |
||
33643 | return cast<CFICanonicalJumpTableAttr>(this)->getSpelling(); |
||
33644 | case attr::CFReturnsNotRetained: |
||
33645 | return cast<CFReturnsNotRetainedAttr>(this)->getSpelling(); |
||
33646 | case attr::CFReturnsRetained: |
||
33647 | return cast<CFReturnsRetainedAttr>(this)->getSpelling(); |
||
33648 | case attr::CFUnknownTransfer: |
||
33649 | return cast<CFUnknownTransferAttr>(this)->getSpelling(); |
||
33650 | case attr::CPUDispatch: |
||
33651 | return cast<CPUDispatchAttr>(this)->getSpelling(); |
||
33652 | case attr::CPUSpecific: |
||
33653 | return cast<CPUSpecificAttr>(this)->getSpelling(); |
||
33654 | case attr::CUDAConstant: |
||
33655 | return cast<CUDAConstantAttr>(this)->getSpelling(); |
||
33656 | case attr::CUDADevice: |
||
33657 | return cast<CUDADeviceAttr>(this)->getSpelling(); |
||
33658 | case attr::CUDADeviceBuiltinSurfaceType: |
||
33659 | return cast<CUDADeviceBuiltinSurfaceTypeAttr>(this)->getSpelling(); |
||
33660 | case attr::CUDADeviceBuiltinTextureType: |
||
33661 | return cast<CUDADeviceBuiltinTextureTypeAttr>(this)->getSpelling(); |
||
33662 | case attr::CUDAGlobal: |
||
33663 | return cast<CUDAGlobalAttr>(this)->getSpelling(); |
||
33664 | case attr::CUDAHost: |
||
33665 | return cast<CUDAHostAttr>(this)->getSpelling(); |
||
33666 | case attr::CUDAInvalidTarget: |
||
33667 | return cast<CUDAInvalidTargetAttr>(this)->getSpelling(); |
||
33668 | case attr::CUDALaunchBounds: |
||
33669 | return cast<CUDALaunchBoundsAttr>(this)->getSpelling(); |
||
33670 | case attr::CUDAShared: |
||
33671 | return cast<CUDASharedAttr>(this)->getSpelling(); |
||
33672 | case attr::CXX11NoReturn: |
||
33673 | return cast<CXX11NoReturnAttr>(this)->getSpelling(); |
||
33674 | case attr::CallableWhen: |
||
33675 | return cast<CallableWhenAttr>(this)->getSpelling(); |
||
33676 | case attr::Callback: |
||
33677 | return cast<CallbackAttr>(this)->getSpelling(); |
||
33678 | case attr::CalledOnce: |
||
33679 | return cast<CalledOnceAttr>(this)->getSpelling(); |
||
33680 | case attr::Capability: |
||
33681 | return cast<CapabilityAttr>(this)->getSpelling(); |
||
33682 | case attr::CapturedRecord: |
||
33683 | return cast<CapturedRecordAttr>(this)->getSpelling(); |
||
33684 | case attr::CarriesDependency: |
||
33685 | return cast<CarriesDependencyAttr>(this)->getSpelling(); |
||
33686 | case attr::Cleanup: |
||
33687 | return cast<CleanupAttr>(this)->getSpelling(); |
||
33688 | case attr::CmseNSCall: |
||
33689 | return cast<CmseNSCallAttr>(this)->getSpelling(); |
||
33690 | case attr::CmseNSEntry: |
||
33691 | return cast<CmseNSEntryAttr>(this)->getSpelling(); |
||
33692 | case attr::CodeSeg: |
||
33693 | return cast<CodeSegAttr>(this)->getSpelling(); |
||
33694 | case attr::Cold: |
||
33695 | return cast<ColdAttr>(this)->getSpelling(); |
||
33696 | case attr::Common: |
||
33697 | return cast<CommonAttr>(this)->getSpelling(); |
||
33698 | case attr::Const: |
||
33699 | return cast<ConstAttr>(this)->getSpelling(); |
||
33700 | case attr::ConstInit: |
||
33701 | return cast<ConstInitAttr>(this)->getSpelling(); |
||
33702 | case attr::Constructor: |
||
33703 | return cast<ConstructorAttr>(this)->getSpelling(); |
||
33704 | case attr::Consumable: |
||
33705 | return cast<ConsumableAttr>(this)->getSpelling(); |
||
33706 | case attr::ConsumableAutoCast: |
||
33707 | return cast<ConsumableAutoCastAttr>(this)->getSpelling(); |
||
33708 | case attr::ConsumableSetOnRead: |
||
33709 | return cast<ConsumableSetOnReadAttr>(this)->getSpelling(); |
||
33710 | case attr::Convergent: |
||
33711 | return cast<ConvergentAttr>(this)->getSpelling(); |
||
33712 | case attr::DLLExport: |
||
33713 | return cast<DLLExportAttr>(this)->getSpelling(); |
||
33714 | case attr::DLLExportStaticLocal: |
||
33715 | return cast<DLLExportStaticLocalAttr>(this)->getSpelling(); |
||
33716 | case attr::DLLImport: |
||
33717 | return cast<DLLImportAttr>(this)->getSpelling(); |
||
33718 | case attr::DLLImportStaticLocal: |
||
33719 | return cast<DLLImportStaticLocalAttr>(this)->getSpelling(); |
||
33720 | case attr::Deprecated: |
||
33721 | return cast<DeprecatedAttr>(this)->getSpelling(); |
||
33722 | case attr::Destructor: |
||
33723 | return cast<DestructorAttr>(this)->getSpelling(); |
||
33724 | case attr::DiagnoseAsBuiltin: |
||
33725 | return cast<DiagnoseAsBuiltinAttr>(this)->getSpelling(); |
||
33726 | case attr::DiagnoseIf: |
||
33727 | return cast<DiagnoseIfAttr>(this)->getSpelling(); |
||
33728 | case attr::DisableSanitizerInstrumentation: |
||
33729 | return cast<DisableSanitizerInstrumentationAttr>(this)->getSpelling(); |
||
33730 | case attr::DisableTailCalls: |
||
33731 | return cast<DisableTailCallsAttr>(this)->getSpelling(); |
||
33732 | case attr::EmptyBases: |
||
33733 | return cast<EmptyBasesAttr>(this)->getSpelling(); |
||
33734 | case attr::EnableIf: |
||
33735 | return cast<EnableIfAttr>(this)->getSpelling(); |
||
33736 | case attr::EnforceTCB: |
||
33737 | return cast<EnforceTCBAttr>(this)->getSpelling(); |
||
33738 | case attr::EnforceTCBLeaf: |
||
33739 | return cast<EnforceTCBLeafAttr>(this)->getSpelling(); |
||
33740 | case attr::EnumExtensibility: |
||
33741 | return cast<EnumExtensibilityAttr>(this)->getSpelling(); |
||
33742 | case attr::Error: |
||
33743 | return cast<ErrorAttr>(this)->getSpelling(); |
||
33744 | case attr::ExcludeFromExplicitInstantiation: |
||
33745 | return cast<ExcludeFromExplicitInstantiationAttr>(this)->getSpelling(); |
||
33746 | case attr::ExclusiveTrylockFunction: |
||
33747 | return cast<ExclusiveTrylockFunctionAttr>(this)->getSpelling(); |
||
33748 | case attr::ExternalSourceSymbol: |
||
33749 | return cast<ExternalSourceSymbolAttr>(this)->getSpelling(); |
||
33750 | case attr::FallThrough: |
||
33751 | return cast<FallThroughAttr>(this)->getSpelling(); |
||
33752 | case attr::FastCall: |
||
33753 | return cast<FastCallAttr>(this)->getSpelling(); |
||
33754 | case attr::Final: |
||
33755 | return cast<FinalAttr>(this)->getSpelling(); |
||
33756 | case attr::FlagEnum: |
||
33757 | return cast<FlagEnumAttr>(this)->getSpelling(); |
||
33758 | case attr::Flatten: |
||
33759 | return cast<FlattenAttr>(this)->getSpelling(); |
||
33760 | case attr::Format: |
||
33761 | return cast<FormatAttr>(this)->getSpelling(); |
||
33762 | case attr::FormatArg: |
||
33763 | return cast<FormatArgAttr>(this)->getSpelling(); |
||
33764 | case attr::FunctionReturnThunks: |
||
33765 | return cast<FunctionReturnThunksAttr>(this)->getSpelling(); |
||
33766 | case attr::GNUInline: |
||
33767 | return cast<GNUInlineAttr>(this)->getSpelling(); |
||
33768 | case attr::GuardedBy: |
||
33769 | return cast<GuardedByAttr>(this)->getSpelling(); |
||
33770 | case attr::GuardedVar: |
||
33771 | return cast<GuardedVarAttr>(this)->getSpelling(); |
||
33772 | case attr::HIPManaged: |
||
33773 | return cast<HIPManagedAttr>(this)->getSpelling(); |
||
33774 | case attr::HLSLGroupSharedAddressSpace: |
||
33775 | return cast<HLSLGroupSharedAddressSpaceAttr>(this)->getSpelling(); |
||
33776 | case attr::HLSLNumThreads: |
||
33777 | return cast<HLSLNumThreadsAttr>(this)->getSpelling(); |
||
33778 | case attr::HLSLResource: |
||
33779 | return cast<HLSLResourceAttr>(this)->getSpelling(); |
||
33780 | case attr::HLSLResourceBinding: |
||
33781 | return cast<HLSLResourceBindingAttr>(this)->getSpelling(); |
||
33782 | case attr::HLSLSV_DispatchThreadID: |
||
33783 | return cast<HLSLSV_DispatchThreadIDAttr>(this)->getSpelling(); |
||
33784 | case attr::HLSLSV_GroupIndex: |
||
33785 | return cast<HLSLSV_GroupIndexAttr>(this)->getSpelling(); |
||
33786 | case attr::HLSLShader: |
||
33787 | return cast<HLSLShaderAttr>(this)->getSpelling(); |
||
33788 | case attr::Hot: |
||
33789 | return cast<HotAttr>(this)->getSpelling(); |
||
33790 | case attr::IBAction: |
||
33791 | return cast<IBActionAttr>(this)->getSpelling(); |
||
33792 | case attr::IBOutlet: |
||
33793 | return cast<IBOutletAttr>(this)->getSpelling(); |
||
33794 | case attr::IBOutletCollection: |
||
33795 | return cast<IBOutletCollectionAttr>(this)->getSpelling(); |
||
33796 | case attr::IFunc: |
||
33797 | return cast<IFuncAttr>(this)->getSpelling(); |
||
33798 | case attr::InitPriority: |
||
33799 | return cast<InitPriorityAttr>(this)->getSpelling(); |
||
33800 | case attr::InitSeg: |
||
33801 | return cast<InitSegAttr>(this)->getSpelling(); |
||
33802 | case attr::IntelOclBicc: |
||
33803 | return cast<IntelOclBiccAttr>(this)->getSpelling(); |
||
33804 | case attr::InternalLinkage: |
||
33805 | return cast<InternalLinkageAttr>(this)->getSpelling(); |
||
33806 | case attr::LTOVisibilityPublic: |
||
33807 | return cast<LTOVisibilityPublicAttr>(this)->getSpelling(); |
||
33808 | case attr::LayoutVersion: |
||
33809 | return cast<LayoutVersionAttr>(this)->getSpelling(); |
||
33810 | case attr::Leaf: |
||
33811 | return cast<LeafAttr>(this)->getSpelling(); |
||
33812 | case attr::LifetimeBound: |
||
33813 | return cast<LifetimeBoundAttr>(this)->getSpelling(); |
||
33814 | case attr::Likely: |
||
33815 | return cast<LikelyAttr>(this)->getSpelling(); |
||
33816 | case attr::LoaderUninitialized: |
||
33817 | return cast<LoaderUninitializedAttr>(this)->getSpelling(); |
||
33818 | case attr::LockReturned: |
||
33819 | return cast<LockReturnedAttr>(this)->getSpelling(); |
||
33820 | case attr::LocksExcluded: |
||
33821 | return cast<LocksExcludedAttr>(this)->getSpelling(); |
||
33822 | case attr::LoopHint: |
||
33823 | return cast<LoopHintAttr>(this)->getSpelling(); |
||
33824 | case attr::M68kInterrupt: |
||
33825 | return cast<M68kInterruptAttr>(this)->getSpelling(); |
||
33826 | case attr::MIGServerRoutine: |
||
33827 | return cast<MIGServerRoutineAttr>(this)->getSpelling(); |
||
33828 | case attr::MSABI: |
||
33829 | return cast<MSABIAttr>(this)->getSpelling(); |
||
33830 | case attr::MSAllocator: |
||
33831 | return cast<MSAllocatorAttr>(this)->getSpelling(); |
||
33832 | case attr::MSInheritance: |
||
33833 | return cast<MSInheritanceAttr>(this)->getSpelling(); |
||
33834 | case attr::MSNoVTable: |
||
33835 | return cast<MSNoVTableAttr>(this)->getSpelling(); |
||
33836 | case attr::MSP430Interrupt: |
||
33837 | return cast<MSP430InterruptAttr>(this)->getSpelling(); |
||
33838 | case attr::MSStruct: |
||
33839 | return cast<MSStructAttr>(this)->getSpelling(); |
||
33840 | case attr::MSVtorDisp: |
||
33841 | return cast<MSVtorDispAttr>(this)->getSpelling(); |
||
33842 | case attr::MaxFieldAlignment: |
||
33843 | return cast<MaxFieldAlignmentAttr>(this)->getSpelling(); |
||
33844 | case attr::MayAlias: |
||
33845 | return cast<MayAliasAttr>(this)->getSpelling(); |
||
33846 | case attr::MaybeUndef: |
||
33847 | return cast<MaybeUndefAttr>(this)->getSpelling(); |
||
33848 | case attr::MicroMips: |
||
33849 | return cast<MicroMipsAttr>(this)->getSpelling(); |
||
33850 | case attr::MinSize: |
||
33851 | return cast<MinSizeAttr>(this)->getSpelling(); |
||
33852 | case attr::MinVectorWidth: |
||
33853 | return cast<MinVectorWidthAttr>(this)->getSpelling(); |
||
33854 | case attr::Mips16: |
||
33855 | return cast<Mips16Attr>(this)->getSpelling(); |
||
33856 | case attr::MipsInterrupt: |
||
33857 | return cast<MipsInterruptAttr>(this)->getSpelling(); |
||
33858 | case attr::MipsLongCall: |
||
33859 | return cast<MipsLongCallAttr>(this)->getSpelling(); |
||
33860 | case attr::MipsShortCall: |
||
33861 | return cast<MipsShortCallAttr>(this)->getSpelling(); |
||
33862 | case attr::Mode: |
||
33863 | return cast<ModeAttr>(this)->getSpelling(); |
||
33864 | case attr::MustTail: |
||
33865 | return cast<MustTailAttr>(this)->getSpelling(); |
||
33866 | case attr::NSConsumed: |
||
33867 | return cast<NSConsumedAttr>(this)->getSpelling(); |
||
33868 | case attr::NSConsumesSelf: |
||
33869 | return cast<NSConsumesSelfAttr>(this)->getSpelling(); |
||
33870 | case attr::NSErrorDomain: |
||
33871 | return cast<NSErrorDomainAttr>(this)->getSpelling(); |
||
33872 | case attr::NSReturnsAutoreleased: |
||
33873 | return cast<NSReturnsAutoreleasedAttr>(this)->getSpelling(); |
||
33874 | case attr::NSReturnsNotRetained: |
||
33875 | return cast<NSReturnsNotRetainedAttr>(this)->getSpelling(); |
||
33876 | case attr::NSReturnsRetained: |
||
33877 | return cast<NSReturnsRetainedAttr>(this)->getSpelling(); |
||
33878 | case attr::Naked: |
||
33879 | return cast<NakedAttr>(this)->getSpelling(); |
||
33880 | case attr::NoAlias: |
||
33881 | return cast<NoAliasAttr>(this)->getSpelling(); |
||
33882 | case attr::NoBuiltin: |
||
33883 | return cast<NoBuiltinAttr>(this)->getSpelling(); |
||
33884 | case attr::NoCommon: |
||
33885 | return cast<NoCommonAttr>(this)->getSpelling(); |
||
33886 | case attr::NoDebug: |
||
33887 | return cast<NoDebugAttr>(this)->getSpelling(); |
||
33888 | case attr::NoDeref: |
||
33889 | return cast<NoDerefAttr>(this)->getSpelling(); |
||
33890 | case attr::NoDestroy: |
||
33891 | return cast<NoDestroyAttr>(this)->getSpelling(); |
||
33892 | case attr::NoDuplicate: |
||
33893 | return cast<NoDuplicateAttr>(this)->getSpelling(); |
||
33894 | case attr::NoEscape: |
||
33895 | return cast<NoEscapeAttr>(this)->getSpelling(); |
||
33896 | case attr::NoInline: |
||
33897 | return cast<NoInlineAttr>(this)->getSpelling(); |
||
33898 | case attr::NoInstrumentFunction: |
||
33899 | return cast<NoInstrumentFunctionAttr>(this)->getSpelling(); |
||
33900 | case attr::NoMerge: |
||
33901 | return cast<NoMergeAttr>(this)->getSpelling(); |
||
33902 | case attr::NoMicroMips: |
||
33903 | return cast<NoMicroMipsAttr>(this)->getSpelling(); |
||
33904 | case attr::NoMips16: |
||
33905 | return cast<NoMips16Attr>(this)->getSpelling(); |
||
33906 | case attr::NoProfileFunction: |
||
33907 | return cast<NoProfileFunctionAttr>(this)->getSpelling(); |
||
33908 | case attr::NoRandomizeLayout: |
||
33909 | return cast<NoRandomizeLayoutAttr>(this)->getSpelling(); |
||
33910 | case attr::NoReturn: |
||
33911 | return cast<NoReturnAttr>(this)->getSpelling(); |
||
33912 | case attr::NoSanitize: |
||
33913 | return cast<NoSanitizeAttr>(this)->getSpelling(); |
||
33914 | case attr::NoSpeculativeLoadHardening: |
||
33915 | return cast<NoSpeculativeLoadHardeningAttr>(this)->getSpelling(); |
||
33916 | case attr::NoSplitStack: |
||
33917 | return cast<NoSplitStackAttr>(this)->getSpelling(); |
||
33918 | case attr::NoStackProtector: |
||
33919 | return cast<NoStackProtectorAttr>(this)->getSpelling(); |
||
33920 | case attr::NoThreadSafetyAnalysis: |
||
33921 | return cast<NoThreadSafetyAnalysisAttr>(this)->getSpelling(); |
||
33922 | case attr::NoThrow: |
||
33923 | return cast<NoThrowAttr>(this)->getSpelling(); |
||
33924 | case attr::NoUniqueAddress: |
||
33925 | return cast<NoUniqueAddressAttr>(this)->getSpelling(); |
||
33926 | case attr::NoUwtable: |
||
33927 | return cast<NoUwtableAttr>(this)->getSpelling(); |
||
33928 | case attr::NonNull: |
||
33929 | return cast<NonNullAttr>(this)->getSpelling(); |
||
33930 | case attr::NotTailCalled: |
||
33931 | return cast<NotTailCalledAttr>(this)->getSpelling(); |
||
33932 | case attr::OMPAllocateDecl: |
||
33933 | return cast<OMPAllocateDeclAttr>(this)->getSpelling(); |
||
33934 | case attr::OMPCaptureKind: |
||
33935 | return cast<OMPCaptureKindAttr>(this)->getSpelling(); |
||
33936 | case attr::OMPCaptureNoInit: |
||
33937 | return cast<OMPCaptureNoInitAttr>(this)->getSpelling(); |
||
33938 | case attr::OMPDeclareSimdDecl: |
||
33939 | return cast<OMPDeclareSimdDeclAttr>(this)->getSpelling(); |
||
33940 | case attr::OMPDeclareTargetDecl: |
||
33941 | return cast<OMPDeclareTargetDeclAttr>(this)->getSpelling(); |
||
33942 | case attr::OMPDeclareVariant: |
||
33943 | return cast<OMPDeclareVariantAttr>(this)->getSpelling(); |
||
33944 | case attr::OMPReferencedVar: |
||
33945 | return cast<OMPReferencedVarAttr>(this)->getSpelling(); |
||
33946 | case attr::OMPThreadPrivateDecl: |
||
33947 | return cast<OMPThreadPrivateDeclAttr>(this)->getSpelling(); |
||
33948 | case attr::OSConsumed: |
||
33949 | return cast<OSConsumedAttr>(this)->getSpelling(); |
||
33950 | case attr::OSConsumesThis: |
||
33951 | return cast<OSConsumesThisAttr>(this)->getSpelling(); |
||
33952 | case attr::OSReturnsNotRetained: |
||
33953 | return cast<OSReturnsNotRetainedAttr>(this)->getSpelling(); |
||
33954 | case attr::OSReturnsRetained: |
||
33955 | return cast<OSReturnsRetainedAttr>(this)->getSpelling(); |
||
33956 | case attr::OSReturnsRetainedOnNonZero: |
||
33957 | return cast<OSReturnsRetainedOnNonZeroAttr>(this)->getSpelling(); |
||
33958 | case attr::OSReturnsRetainedOnZero: |
||
33959 | return cast<OSReturnsRetainedOnZeroAttr>(this)->getSpelling(); |
||
33960 | case attr::ObjCBoxable: |
||
33961 | return cast<ObjCBoxableAttr>(this)->getSpelling(); |
||
33962 | case attr::ObjCBridge: |
||
33963 | return cast<ObjCBridgeAttr>(this)->getSpelling(); |
||
33964 | case attr::ObjCBridgeMutable: |
||
33965 | return cast<ObjCBridgeMutableAttr>(this)->getSpelling(); |
||
33966 | case attr::ObjCBridgeRelated: |
||
33967 | return cast<ObjCBridgeRelatedAttr>(this)->getSpelling(); |
||
33968 | case attr::ObjCClassStub: |
||
33969 | return cast<ObjCClassStubAttr>(this)->getSpelling(); |
||
33970 | case attr::ObjCDesignatedInitializer: |
||
33971 | return cast<ObjCDesignatedInitializerAttr>(this)->getSpelling(); |
||
33972 | case attr::ObjCDirect: |
||
33973 | return cast<ObjCDirectAttr>(this)->getSpelling(); |
||
33974 | case attr::ObjCDirectMembers: |
||
33975 | return cast<ObjCDirectMembersAttr>(this)->getSpelling(); |
||
33976 | case attr::ObjCException: |
||
33977 | return cast<ObjCExceptionAttr>(this)->getSpelling(); |
||
33978 | case attr::ObjCExplicitProtocolImpl: |
||
33979 | return cast<ObjCExplicitProtocolImplAttr>(this)->getSpelling(); |
||
33980 | case attr::ObjCExternallyRetained: |
||
33981 | return cast<ObjCExternallyRetainedAttr>(this)->getSpelling(); |
||
33982 | case attr::ObjCGC: |
||
33983 | return cast<ObjCGCAttr>(this)->getSpelling(); |
||
33984 | case attr::ObjCIndependentClass: |
||
33985 | return cast<ObjCIndependentClassAttr>(this)->getSpelling(); |
||
33986 | case attr::ObjCInertUnsafeUnretained: |
||
33987 | return cast<ObjCInertUnsafeUnretainedAttr>(this)->getSpelling(); |
||
33988 | case attr::ObjCKindOf: |
||
33989 | return cast<ObjCKindOfAttr>(this)->getSpelling(); |
||
33990 | case attr::ObjCMethodFamily: |
||
33991 | return cast<ObjCMethodFamilyAttr>(this)->getSpelling(); |
||
33992 | case attr::ObjCNSObject: |
||
33993 | return cast<ObjCNSObjectAttr>(this)->getSpelling(); |
||
33994 | case attr::ObjCNonLazyClass: |
||
33995 | return cast<ObjCNonLazyClassAttr>(this)->getSpelling(); |
||
33996 | case attr::ObjCNonRuntimeProtocol: |
||
33997 | return cast<ObjCNonRuntimeProtocolAttr>(this)->getSpelling(); |
||
33998 | case attr::ObjCOwnership: |
||
33999 | return cast<ObjCOwnershipAttr>(this)->getSpelling(); |
||
34000 | case attr::ObjCPreciseLifetime: |
||
34001 | return cast<ObjCPreciseLifetimeAttr>(this)->getSpelling(); |
||
34002 | case attr::ObjCRequiresPropertyDefs: |
||
34003 | return cast<ObjCRequiresPropertyDefsAttr>(this)->getSpelling(); |
||
34004 | case attr::ObjCRequiresSuper: |
||
34005 | return cast<ObjCRequiresSuperAttr>(this)->getSpelling(); |
||
34006 | case attr::ObjCReturnsInnerPointer: |
||
34007 | return cast<ObjCReturnsInnerPointerAttr>(this)->getSpelling(); |
||
34008 | case attr::ObjCRootClass: |
||
34009 | return cast<ObjCRootClassAttr>(this)->getSpelling(); |
||
34010 | case attr::ObjCRuntimeName: |
||
34011 | return cast<ObjCRuntimeNameAttr>(this)->getSpelling(); |
||
34012 | case attr::ObjCRuntimeVisible: |
||
34013 | return cast<ObjCRuntimeVisibleAttr>(this)->getSpelling(); |
||
34014 | case attr::ObjCSubclassingRestricted: |
||
34015 | return cast<ObjCSubclassingRestrictedAttr>(this)->getSpelling(); |
||
34016 | case attr::OpenCLAccess: |
||
34017 | return cast<OpenCLAccessAttr>(this)->getSpelling(); |
||
34018 | case attr::OpenCLConstantAddressSpace: |
||
34019 | return cast<OpenCLConstantAddressSpaceAttr>(this)->getSpelling(); |
||
34020 | case attr::OpenCLGenericAddressSpace: |
||
34021 | return cast<OpenCLGenericAddressSpaceAttr>(this)->getSpelling(); |
||
34022 | case attr::OpenCLGlobalAddressSpace: |
||
34023 | return cast<OpenCLGlobalAddressSpaceAttr>(this)->getSpelling(); |
||
34024 | case attr::OpenCLGlobalDeviceAddressSpace: |
||
34025 | return cast<OpenCLGlobalDeviceAddressSpaceAttr>(this)->getSpelling(); |
||
34026 | case attr::OpenCLGlobalHostAddressSpace: |
||
34027 | return cast<OpenCLGlobalHostAddressSpaceAttr>(this)->getSpelling(); |
||
34028 | case attr::OpenCLIntelReqdSubGroupSize: |
||
34029 | return cast<OpenCLIntelReqdSubGroupSizeAttr>(this)->getSpelling(); |
||
34030 | case attr::OpenCLKernel: |
||
34031 | return cast<OpenCLKernelAttr>(this)->getSpelling(); |
||
34032 | case attr::OpenCLLocalAddressSpace: |
||
34033 | return cast<OpenCLLocalAddressSpaceAttr>(this)->getSpelling(); |
||
34034 | case attr::OpenCLPrivateAddressSpace: |
||
34035 | return cast<OpenCLPrivateAddressSpaceAttr>(this)->getSpelling(); |
||
34036 | case attr::OpenCLUnrollHint: |
||
34037 | return cast<OpenCLUnrollHintAttr>(this)->getSpelling(); |
||
34038 | case attr::OptimizeNone: |
||
34039 | return cast<OptimizeNoneAttr>(this)->getSpelling(); |
||
34040 | case attr::Overloadable: |
||
34041 | return cast<OverloadableAttr>(this)->getSpelling(); |
||
34042 | case attr::Override: |
||
34043 | return cast<OverrideAttr>(this)->getSpelling(); |
||
34044 | case attr::Owner: |
||
34045 | return cast<OwnerAttr>(this)->getSpelling(); |
||
34046 | case attr::Ownership: |
||
34047 | return cast<OwnershipAttr>(this)->getSpelling(); |
||
34048 | case attr::Packed: |
||
34049 | return cast<PackedAttr>(this)->getSpelling(); |
||
34050 | case attr::ParamTypestate: |
||
34051 | return cast<ParamTypestateAttr>(this)->getSpelling(); |
||
34052 | case attr::Pascal: |
||
34053 | return cast<PascalAttr>(this)->getSpelling(); |
||
34054 | case attr::PassObjectSize: |
||
34055 | return cast<PassObjectSizeAttr>(this)->getSpelling(); |
||
34056 | case attr::PatchableFunctionEntry: |
||
34057 | return cast<PatchableFunctionEntryAttr>(this)->getSpelling(); |
||
34058 | case attr::Pcs: |
||
34059 | return cast<PcsAttr>(this)->getSpelling(); |
||
34060 | case attr::Pointer: |
||
34061 | return cast<PointerAttr>(this)->getSpelling(); |
||
34062 | case attr::PragmaClangBSSSection: |
||
34063 | return cast<PragmaClangBSSSectionAttr>(this)->getSpelling(); |
||
34064 | case attr::PragmaClangDataSection: |
||
34065 | return cast<PragmaClangDataSectionAttr>(this)->getSpelling(); |
||
34066 | case attr::PragmaClangRelroSection: |
||
34067 | return cast<PragmaClangRelroSectionAttr>(this)->getSpelling(); |
||
34068 | case attr::PragmaClangRodataSection: |
||
34069 | return cast<PragmaClangRodataSectionAttr>(this)->getSpelling(); |
||
34070 | case attr::PragmaClangTextSection: |
||
34071 | return cast<PragmaClangTextSectionAttr>(this)->getSpelling(); |
||
34072 | case attr::PreferredName: |
||
34073 | return cast<PreferredNameAttr>(this)->getSpelling(); |
||
34074 | case attr::PreserveAll: |
||
34075 | return cast<PreserveAllAttr>(this)->getSpelling(); |
||
34076 | case attr::PreserveMost: |
||
34077 | return cast<PreserveMostAttr>(this)->getSpelling(); |
||
34078 | case attr::PtGuardedBy: |
||
34079 | return cast<PtGuardedByAttr>(this)->getSpelling(); |
||
34080 | case attr::PtGuardedVar: |
||
34081 | return cast<PtGuardedVarAttr>(this)->getSpelling(); |
||
34082 | case attr::Ptr32: |
||
34083 | return cast<Ptr32Attr>(this)->getSpelling(); |
||
34084 | case attr::Ptr64: |
||
34085 | return cast<Ptr64Attr>(this)->getSpelling(); |
||
34086 | case attr::Pure: |
||
34087 | return cast<PureAttr>(this)->getSpelling(); |
||
34088 | case attr::RISCVInterrupt: |
||
34089 | return cast<RISCVInterruptAttr>(this)->getSpelling(); |
||
34090 | case attr::RandomizeLayout: |
||
34091 | return cast<RandomizeLayoutAttr>(this)->getSpelling(); |
||
34092 | case attr::ReadOnlyPlacement: |
||
34093 | return cast<ReadOnlyPlacementAttr>(this)->getSpelling(); |
||
34094 | case attr::RegCall: |
||
34095 | return cast<RegCallAttr>(this)->getSpelling(); |
||
34096 | case attr::Reinitializes: |
||
34097 | return cast<ReinitializesAttr>(this)->getSpelling(); |
||
34098 | case attr::ReleaseCapability: |
||
34099 | return cast<ReleaseCapabilityAttr>(this)->getSpelling(); |
||
34100 | case attr::ReleaseHandle: |
||
34101 | return cast<ReleaseHandleAttr>(this)->getSpelling(); |
||
34102 | case attr::RenderScriptKernel: |
||
34103 | return cast<RenderScriptKernelAttr>(this)->getSpelling(); |
||
34104 | case attr::ReqdWorkGroupSize: |
||
34105 | return cast<ReqdWorkGroupSizeAttr>(this)->getSpelling(); |
||
34106 | case attr::RequiresCapability: |
||
34107 | return cast<RequiresCapabilityAttr>(this)->getSpelling(); |
||
34108 | case attr::Restrict: |
||
34109 | return cast<RestrictAttr>(this)->getSpelling(); |
||
34110 | case attr::Retain: |
||
34111 | return cast<RetainAttr>(this)->getSpelling(); |
||
34112 | case attr::ReturnTypestate: |
||
34113 | return cast<ReturnTypestateAttr>(this)->getSpelling(); |
||
34114 | case attr::ReturnsNonNull: |
||
34115 | return cast<ReturnsNonNullAttr>(this)->getSpelling(); |
||
34116 | case attr::ReturnsTwice: |
||
34117 | return cast<ReturnsTwiceAttr>(this)->getSpelling(); |
||
34118 | case attr::SPtr: |
||
34119 | return cast<SPtrAttr>(this)->getSpelling(); |
||
34120 | case attr::SYCLKernel: |
||
34121 | return cast<SYCLKernelAttr>(this)->getSpelling(); |
||
34122 | case attr::SYCLSpecialClass: |
||
34123 | return cast<SYCLSpecialClassAttr>(this)->getSpelling(); |
||
34124 | case attr::ScopedLockable: |
||
34125 | return cast<ScopedLockableAttr>(this)->getSpelling(); |
||
34126 | case attr::Section: |
||
34127 | return cast<SectionAttr>(this)->getSpelling(); |
||
34128 | case attr::SelectAny: |
||
34129 | return cast<SelectAnyAttr>(this)->getSpelling(); |
||
34130 | case attr::Sentinel: |
||
34131 | return cast<SentinelAttr>(this)->getSpelling(); |
||
34132 | case attr::SetTypestate: |
||
34133 | return cast<SetTypestateAttr>(this)->getSpelling(); |
||
34134 | case attr::SharedTrylockFunction: |
||
34135 | return cast<SharedTrylockFunctionAttr>(this)->getSpelling(); |
||
34136 | case attr::SpeculativeLoadHardening: |
||
34137 | return cast<SpeculativeLoadHardeningAttr>(this)->getSpelling(); |
||
34138 | case attr::StandaloneDebug: |
||
34139 | return cast<StandaloneDebugAttr>(this)->getSpelling(); |
||
34140 | case attr::StdCall: |
||
34141 | return cast<StdCallAttr>(this)->getSpelling(); |
||
34142 | case attr::StrictFP: |
||
34143 | return cast<StrictFPAttr>(this)->getSpelling(); |
||
34144 | case attr::StrictGuardStackCheck: |
||
34145 | return cast<StrictGuardStackCheckAttr>(this)->getSpelling(); |
||
34146 | case attr::Suppress: |
||
34147 | return cast<SuppressAttr>(this)->getSpelling(); |
||
34148 | case attr::SwiftAsync: |
||
34149 | return cast<SwiftAsyncAttr>(this)->getSpelling(); |
||
34150 | case attr::SwiftAsyncCall: |
||
34151 | return cast<SwiftAsyncCallAttr>(this)->getSpelling(); |
||
34152 | case attr::SwiftAsyncContext: |
||
34153 | return cast<SwiftAsyncContextAttr>(this)->getSpelling(); |
||
34154 | case attr::SwiftAsyncError: |
||
34155 | return cast<SwiftAsyncErrorAttr>(this)->getSpelling(); |
||
34156 | case attr::SwiftAsyncName: |
||
34157 | return cast<SwiftAsyncNameAttr>(this)->getSpelling(); |
||
34158 | case attr::SwiftAttr: |
||
34159 | return cast<SwiftAttrAttr>(this)->getSpelling(); |
||
34160 | case attr::SwiftBridge: |
||
34161 | return cast<SwiftBridgeAttr>(this)->getSpelling(); |
||
34162 | case attr::SwiftBridgedTypedef: |
||
34163 | return cast<SwiftBridgedTypedefAttr>(this)->getSpelling(); |
||
34164 | case attr::SwiftCall: |
||
34165 | return cast<SwiftCallAttr>(this)->getSpelling(); |
||
34166 | case attr::SwiftContext: |
||
34167 | return cast<SwiftContextAttr>(this)->getSpelling(); |
||
34168 | case attr::SwiftError: |
||
34169 | return cast<SwiftErrorAttr>(this)->getSpelling(); |
||
34170 | case attr::SwiftErrorResult: |
||
34171 | return cast<SwiftErrorResultAttr>(this)->getSpelling(); |
||
34172 | case attr::SwiftIndirectResult: |
||
34173 | return cast<SwiftIndirectResultAttr>(this)->getSpelling(); |
||
34174 | case attr::SwiftName: |
||
34175 | return cast<SwiftNameAttr>(this)->getSpelling(); |
||
34176 | case attr::SwiftNewType: |
||
34177 | return cast<SwiftNewTypeAttr>(this)->getSpelling(); |
||
34178 | case attr::SwiftObjCMembers: |
||
34179 | return cast<SwiftObjCMembersAttr>(this)->getSpelling(); |
||
34180 | case attr::SwiftPrivate: |
||
34181 | return cast<SwiftPrivateAttr>(this)->getSpelling(); |
||
34182 | case attr::SysVABI: |
||
34183 | return cast<SysVABIAttr>(this)->getSpelling(); |
||
34184 | case attr::TLSModel: |
||
34185 | return cast<TLSModelAttr>(this)->getSpelling(); |
||
34186 | case attr::Target: |
||
34187 | return cast<TargetAttr>(this)->getSpelling(); |
||
34188 | case attr::TargetClones: |
||
34189 | return cast<TargetClonesAttr>(this)->getSpelling(); |
||
34190 | case attr::TargetVersion: |
||
34191 | return cast<TargetVersionAttr>(this)->getSpelling(); |
||
34192 | case attr::TestTypestate: |
||
34193 | return cast<TestTypestateAttr>(this)->getSpelling(); |
||
34194 | case attr::ThisCall: |
||
34195 | return cast<ThisCallAttr>(this)->getSpelling(); |
||
34196 | case attr::Thread: |
||
34197 | return cast<ThreadAttr>(this)->getSpelling(); |
||
34198 | case attr::TransparentUnion: |
||
34199 | return cast<TransparentUnionAttr>(this)->getSpelling(); |
||
34200 | case attr::TrivialABI: |
||
34201 | return cast<TrivialABIAttr>(this)->getSpelling(); |
||
34202 | case attr::TryAcquireCapability: |
||
34203 | return cast<TryAcquireCapabilityAttr>(this)->getSpelling(); |
||
34204 | case attr::TypeNonNull: |
||
34205 | return cast<TypeNonNullAttr>(this)->getSpelling(); |
||
34206 | case attr::TypeNullUnspecified: |
||
34207 | return cast<TypeNullUnspecifiedAttr>(this)->getSpelling(); |
||
34208 | case attr::TypeNullable: |
||
34209 | return cast<TypeNullableAttr>(this)->getSpelling(); |
||
34210 | case attr::TypeNullableResult: |
||
34211 | return cast<TypeNullableResultAttr>(this)->getSpelling(); |
||
34212 | case attr::TypeTagForDatatype: |
||
34213 | return cast<TypeTagForDatatypeAttr>(this)->getSpelling(); |
||
34214 | case attr::TypeVisibility: |
||
34215 | return cast<TypeVisibilityAttr>(this)->getSpelling(); |
||
34216 | case attr::UPtr: |
||
34217 | return cast<UPtrAttr>(this)->getSpelling(); |
||
34218 | case attr::Unavailable: |
||
34219 | return cast<UnavailableAttr>(this)->getSpelling(); |
||
34220 | case attr::Uninitialized: |
||
34221 | return cast<UninitializedAttr>(this)->getSpelling(); |
||
34222 | case attr::Unlikely: |
||
34223 | return cast<UnlikelyAttr>(this)->getSpelling(); |
||
34224 | case attr::Unused: |
||
34225 | return cast<UnusedAttr>(this)->getSpelling(); |
||
34226 | case attr::UseHandle: |
||
34227 | return cast<UseHandleAttr>(this)->getSpelling(); |
||
34228 | case attr::Used: |
||
34229 | return cast<UsedAttr>(this)->getSpelling(); |
||
34230 | case attr::UsingIfExists: |
||
34231 | return cast<UsingIfExistsAttr>(this)->getSpelling(); |
||
34232 | case attr::Uuid: |
||
34233 | return cast<UuidAttr>(this)->getSpelling(); |
||
34234 | case attr::VecReturn: |
||
34235 | return cast<VecReturnAttr>(this)->getSpelling(); |
||
34236 | case attr::VecTypeHint: |
||
34237 | return cast<VecTypeHintAttr>(this)->getSpelling(); |
||
34238 | case attr::VectorCall: |
||
34239 | return cast<VectorCallAttr>(this)->getSpelling(); |
||
34240 | case attr::Visibility: |
||
34241 | return cast<VisibilityAttr>(this)->getSpelling(); |
||
34242 | case attr::WarnUnused: |
||
34243 | return cast<WarnUnusedAttr>(this)->getSpelling(); |
||
34244 | case attr::WarnUnusedResult: |
||
34245 | return cast<WarnUnusedResultAttr>(this)->getSpelling(); |
||
34246 | case attr::Weak: |
||
34247 | return cast<WeakAttr>(this)->getSpelling(); |
||
34248 | case attr::WeakImport: |
||
34249 | return cast<WeakImportAttr>(this)->getSpelling(); |
||
34250 | case attr::WeakRef: |
||
34251 | return cast<WeakRefAttr>(this)->getSpelling(); |
||
34252 | case attr::WebAssemblyExportName: |
||
34253 | return cast<WebAssemblyExportNameAttr>(this)->getSpelling(); |
||
34254 | case attr::WebAssemblyImportModule: |
||
34255 | return cast<WebAssemblyImportModuleAttr>(this)->getSpelling(); |
||
34256 | case attr::WebAssemblyImportName: |
||
34257 | return cast<WebAssemblyImportNameAttr>(this)->getSpelling(); |
||
34258 | case attr::WorkGroupSizeHint: |
||
34259 | return cast<WorkGroupSizeHintAttr>(this)->getSpelling(); |
||
34260 | case attr::X86ForceAlignArgPointer: |
||
34261 | return cast<X86ForceAlignArgPointerAttr>(this)->getSpelling(); |
||
34262 | case attr::XRayInstrument: |
||
34263 | return cast<XRayInstrumentAttr>(this)->getSpelling(); |
||
34264 | case attr::XRayLogArgs: |
||
34265 | return cast<XRayLogArgsAttr>(this)->getSpelling(); |
||
34266 | case attr::ZeroCallUsedRegs: |
||
34267 | return cast<ZeroCallUsedRegsAttr>(this)->getSpelling(); |
||
34268 | } |
||
34269 | llvm_unreachable("Unexpected attribute kind!"); |
||
34270 | } |
||
34271 | |||
34272 | Attr *Attr::clone(ASTContext &C) const { |
||
34273 | switch (getKind()) { |
||
34274 | case attr::AArch64SVEPcs: |
||
34275 | return cast<AArch64SVEPcsAttr>(this)->clone(C); |
||
34276 | case attr::AArch64VectorPcs: |
||
34277 | return cast<AArch64VectorPcsAttr>(this)->clone(C); |
||
34278 | case attr::AMDGPUFlatWorkGroupSize: |
||
34279 | return cast<AMDGPUFlatWorkGroupSizeAttr>(this)->clone(C); |
||
34280 | case attr::AMDGPUKernelCall: |
||
34281 | return cast<AMDGPUKernelCallAttr>(this)->clone(C); |
||
34282 | case attr::AMDGPUNumSGPR: |
||
34283 | return cast<AMDGPUNumSGPRAttr>(this)->clone(C); |
||
34284 | case attr::AMDGPUNumVGPR: |
||
34285 | return cast<AMDGPUNumVGPRAttr>(this)->clone(C); |
||
34286 | case attr::AMDGPUWavesPerEU: |
||
34287 | return cast<AMDGPUWavesPerEUAttr>(this)->clone(C); |
||
34288 | case attr::ARMInterrupt: |
||
34289 | return cast<ARMInterruptAttr>(this)->clone(C); |
||
34290 | case attr::AVRInterrupt: |
||
34291 | return cast<AVRInterruptAttr>(this)->clone(C); |
||
34292 | case attr::AVRSignal: |
||
34293 | return cast<AVRSignalAttr>(this)->clone(C); |
||
34294 | case attr::AbiTag: |
||
34295 | return cast<AbiTagAttr>(this)->clone(C); |
||
34296 | case attr::AcquireCapability: |
||
34297 | return cast<AcquireCapabilityAttr>(this)->clone(C); |
||
34298 | case attr::AcquireHandle: |
||
34299 | return cast<AcquireHandleAttr>(this)->clone(C); |
||
34300 | case attr::AcquiredAfter: |
||
34301 | return cast<AcquiredAfterAttr>(this)->clone(C); |
||
34302 | case attr::AcquiredBefore: |
||
34303 | return cast<AcquiredBeforeAttr>(this)->clone(C); |
||
34304 | case attr::AddressSpace: |
||
34305 | return cast<AddressSpaceAttr>(this)->clone(C); |
||
34306 | case attr::Alias: |
||
34307 | return cast<AliasAttr>(this)->clone(C); |
||
34308 | case attr::AlignMac68k: |
||
34309 | return cast<AlignMac68kAttr>(this)->clone(C); |
||
34310 | case attr::AlignNatural: |
||
34311 | return cast<AlignNaturalAttr>(this)->clone(C); |
||
34312 | case attr::AlignValue: |
||
34313 | return cast<AlignValueAttr>(this)->clone(C); |
||
34314 | case attr::Aligned: |
||
34315 | return cast<AlignedAttr>(this)->clone(C); |
||
34316 | case attr::AllocAlign: |
||
34317 | return cast<AllocAlignAttr>(this)->clone(C); |
||
34318 | case attr::AllocSize: |
||
34319 | return cast<AllocSizeAttr>(this)->clone(C); |
||
34320 | case attr::AlwaysDestroy: |
||
34321 | return cast<AlwaysDestroyAttr>(this)->clone(C); |
||
34322 | case attr::AlwaysInline: |
||
34323 | return cast<AlwaysInlineAttr>(this)->clone(C); |
||
34324 | case attr::AnalyzerNoReturn: |
||
34325 | return cast<AnalyzerNoReturnAttr>(this)->clone(C); |
||
34326 | case attr::Annotate: |
||
34327 | return cast<AnnotateAttr>(this)->clone(C); |
||
34328 | case attr::AnnotateType: |
||
34329 | return cast<AnnotateTypeAttr>(this)->clone(C); |
||
34330 | case attr::AnyX86Interrupt: |
||
34331 | return cast<AnyX86InterruptAttr>(this)->clone(C); |
||
34332 | case attr::AnyX86NoCallerSavedRegisters: |
||
34333 | return cast<AnyX86NoCallerSavedRegistersAttr>(this)->clone(C); |
||
34334 | case attr::AnyX86NoCfCheck: |
||
34335 | return cast<AnyX86NoCfCheckAttr>(this)->clone(C); |
||
34336 | case attr::ArcWeakrefUnavailable: |
||
34337 | return cast<ArcWeakrefUnavailableAttr>(this)->clone(C); |
||
34338 | case attr::ArgumentWithTypeTag: |
||
34339 | return cast<ArgumentWithTypeTagAttr>(this)->clone(C); |
||
34340 | case attr::ArmBuiltinAlias: |
||
34341 | return cast<ArmBuiltinAliasAttr>(this)->clone(C); |
||
34342 | case attr::ArmMveStrictPolymorphism: |
||
34343 | return cast<ArmMveStrictPolymorphismAttr>(this)->clone(C); |
||
34344 | case attr::Artificial: |
||
34345 | return cast<ArtificialAttr>(this)->clone(C); |
||
34346 | case attr::AsmLabel: |
||
34347 | return cast<AsmLabelAttr>(this)->clone(C); |
||
34348 | case attr::AssertCapability: |
||
34349 | return cast<AssertCapabilityAttr>(this)->clone(C); |
||
34350 | case attr::AssertExclusiveLock: |
||
34351 | return cast<AssertExclusiveLockAttr>(this)->clone(C); |
||
34352 | case attr::AssertSharedLock: |
||
34353 | return cast<AssertSharedLockAttr>(this)->clone(C); |
||
34354 | case attr::AssumeAligned: |
||
34355 | return cast<AssumeAlignedAttr>(this)->clone(C); |
||
34356 | case attr::Assumption: |
||
34357 | return cast<AssumptionAttr>(this)->clone(C); |
||
34358 | case attr::Availability: |
||
34359 | return cast<AvailabilityAttr>(this)->clone(C); |
||
34360 | case attr::BPFPreserveAccessIndex: |
||
34361 | return cast<BPFPreserveAccessIndexAttr>(this)->clone(C); |
||
34362 | case attr::BTFDeclTag: |
||
34363 | return cast<BTFDeclTagAttr>(this)->clone(C); |
||
34364 | case attr::BTFTypeTag: |
||
34365 | return cast<BTFTypeTagAttr>(this)->clone(C); |
||
34366 | case attr::Blocks: |
||
34367 | return cast<BlocksAttr>(this)->clone(C); |
||
34368 | case attr::Builtin: |
||
34369 | return cast<BuiltinAttr>(this)->clone(C); |
||
34370 | case attr::BuiltinAlias: |
||
34371 | return cast<BuiltinAliasAttr>(this)->clone(C); |
||
34372 | case attr::C11NoReturn: |
||
34373 | return cast<C11NoReturnAttr>(this)->clone(C); |
||
34374 | case attr::CDecl: |
||
34375 | return cast<CDeclAttr>(this)->clone(C); |
||
34376 | case attr::CFAuditedTransfer: |
||
34377 | return cast<CFAuditedTransferAttr>(this)->clone(C); |
||
34378 | case attr::CFConsumed: |
||
34379 | return cast<CFConsumedAttr>(this)->clone(C); |
||
34380 | case attr::CFGuard: |
||
34381 | return cast<CFGuardAttr>(this)->clone(C); |
||
34382 | case attr::CFICanonicalJumpTable: |
||
34383 | return cast<CFICanonicalJumpTableAttr>(this)->clone(C); |
||
34384 | case attr::CFReturnsNotRetained: |
||
34385 | return cast<CFReturnsNotRetainedAttr>(this)->clone(C); |
||
34386 | case attr::CFReturnsRetained: |
||
34387 | return cast<CFReturnsRetainedAttr>(this)->clone(C); |
||
34388 | case attr::CFUnknownTransfer: |
||
34389 | return cast<CFUnknownTransferAttr>(this)->clone(C); |
||
34390 | case attr::CPUDispatch: |
||
34391 | return cast<CPUDispatchAttr>(this)->clone(C); |
||
34392 | case attr::CPUSpecific: |
||
34393 | return cast<CPUSpecificAttr>(this)->clone(C); |
||
34394 | case attr::CUDAConstant: |
||
34395 | return cast<CUDAConstantAttr>(this)->clone(C); |
||
34396 | case attr::CUDADevice: |
||
34397 | return cast<CUDADeviceAttr>(this)->clone(C); |
||
34398 | case attr::CUDADeviceBuiltinSurfaceType: |
||
34399 | return cast<CUDADeviceBuiltinSurfaceTypeAttr>(this)->clone(C); |
||
34400 | case attr::CUDADeviceBuiltinTextureType: |
||
34401 | return cast<CUDADeviceBuiltinTextureTypeAttr>(this)->clone(C); |
||
34402 | case attr::CUDAGlobal: |
||
34403 | return cast<CUDAGlobalAttr>(this)->clone(C); |
||
34404 | case attr::CUDAHost: |
||
34405 | return cast<CUDAHostAttr>(this)->clone(C); |
||
34406 | case attr::CUDAInvalidTarget: |
||
34407 | return cast<CUDAInvalidTargetAttr>(this)->clone(C); |
||
34408 | case attr::CUDALaunchBounds: |
||
34409 | return cast<CUDALaunchBoundsAttr>(this)->clone(C); |
||
34410 | case attr::CUDAShared: |
||
34411 | return cast<CUDASharedAttr>(this)->clone(C); |
||
34412 | case attr::CXX11NoReturn: |
||
34413 | return cast<CXX11NoReturnAttr>(this)->clone(C); |
||
34414 | case attr::CallableWhen: |
||
34415 | return cast<CallableWhenAttr>(this)->clone(C); |
||
34416 | case attr::Callback: |
||
34417 | return cast<CallbackAttr>(this)->clone(C); |
||
34418 | case attr::CalledOnce: |
||
34419 | return cast<CalledOnceAttr>(this)->clone(C); |
||
34420 | case attr::Capability: |
||
34421 | return cast<CapabilityAttr>(this)->clone(C); |
||
34422 | case attr::CapturedRecord: |
||
34423 | return cast<CapturedRecordAttr>(this)->clone(C); |
||
34424 | case attr::CarriesDependency: |
||
34425 | return cast<CarriesDependencyAttr>(this)->clone(C); |
||
34426 | case attr::Cleanup: |
||
34427 | return cast<CleanupAttr>(this)->clone(C); |
||
34428 | case attr::CmseNSCall: |
||
34429 | return cast<CmseNSCallAttr>(this)->clone(C); |
||
34430 | case attr::CmseNSEntry: |
||
34431 | return cast<CmseNSEntryAttr>(this)->clone(C); |
||
34432 | case attr::CodeSeg: |
||
34433 | return cast<CodeSegAttr>(this)->clone(C); |
||
34434 | case attr::Cold: |
||
34435 | return cast<ColdAttr>(this)->clone(C); |
||
34436 | case attr::Common: |
||
34437 | return cast<CommonAttr>(this)->clone(C); |
||
34438 | case attr::Const: |
||
34439 | return cast<ConstAttr>(this)->clone(C); |
||
34440 | case attr::ConstInit: |
||
34441 | return cast<ConstInitAttr>(this)->clone(C); |
||
34442 | case attr::Constructor: |
||
34443 | return cast<ConstructorAttr>(this)->clone(C); |
||
34444 | case attr::Consumable: |
||
34445 | return cast<ConsumableAttr>(this)->clone(C); |
||
34446 | case attr::ConsumableAutoCast: |
||
34447 | return cast<ConsumableAutoCastAttr>(this)->clone(C); |
||
34448 | case attr::ConsumableSetOnRead: |
||
34449 | return cast<ConsumableSetOnReadAttr>(this)->clone(C); |
||
34450 | case attr::Convergent: |
||
34451 | return cast<ConvergentAttr>(this)->clone(C); |
||
34452 | case attr::DLLExport: |
||
34453 | return cast<DLLExportAttr>(this)->clone(C); |
||
34454 | case attr::DLLExportStaticLocal: |
||
34455 | return cast<DLLExportStaticLocalAttr>(this)->clone(C); |
||
34456 | case attr::DLLImport: |
||
34457 | return cast<DLLImportAttr>(this)->clone(C); |
||
34458 | case attr::DLLImportStaticLocal: |
||
34459 | return cast<DLLImportStaticLocalAttr>(this)->clone(C); |
||
34460 | case attr::Deprecated: |
||
34461 | return cast<DeprecatedAttr>(this)->clone(C); |
||
34462 | case attr::Destructor: |
||
34463 | return cast<DestructorAttr>(this)->clone(C); |
||
34464 | case attr::DiagnoseAsBuiltin: |
||
34465 | return cast<DiagnoseAsBuiltinAttr>(this)->clone(C); |
||
34466 | case attr::DiagnoseIf: |
||
34467 | return cast<DiagnoseIfAttr>(this)->clone(C); |
||
34468 | case attr::DisableSanitizerInstrumentation: |
||
34469 | return cast<DisableSanitizerInstrumentationAttr>(this)->clone(C); |
||
34470 | case attr::DisableTailCalls: |
||
34471 | return cast<DisableTailCallsAttr>(this)->clone(C); |
||
34472 | case attr::EmptyBases: |
||
34473 | return cast<EmptyBasesAttr>(this)->clone(C); |
||
34474 | case attr::EnableIf: |
||
34475 | return cast<EnableIfAttr>(this)->clone(C); |
||
34476 | case attr::EnforceTCB: |
||
34477 | return cast<EnforceTCBAttr>(this)->clone(C); |
||
34478 | case attr::EnforceTCBLeaf: |
||
34479 | return cast<EnforceTCBLeafAttr>(this)->clone(C); |
||
34480 | case attr::EnumExtensibility: |
||
34481 | return cast<EnumExtensibilityAttr>(this)->clone(C); |
||
34482 | case attr::Error: |
||
34483 | return cast<ErrorAttr>(this)->clone(C); |
||
34484 | case attr::ExcludeFromExplicitInstantiation: |
||
34485 | return cast<ExcludeFromExplicitInstantiationAttr>(this)->clone(C); |
||
34486 | case attr::ExclusiveTrylockFunction: |
||
34487 | return cast<ExclusiveTrylockFunctionAttr>(this)->clone(C); |
||
34488 | case attr::ExternalSourceSymbol: |
||
34489 | return cast<ExternalSourceSymbolAttr>(this)->clone(C); |
||
34490 | case attr::FallThrough: |
||
34491 | return cast<FallThroughAttr>(this)->clone(C); |
||
34492 | case attr::FastCall: |
||
34493 | return cast<FastCallAttr>(this)->clone(C); |
||
34494 | case attr::Final: |
||
34495 | return cast<FinalAttr>(this)->clone(C); |
||
34496 | case attr::FlagEnum: |
||
34497 | return cast<FlagEnumAttr>(this)->clone(C); |
||
34498 | case attr::Flatten: |
||
34499 | return cast<FlattenAttr>(this)->clone(C); |
||
34500 | case attr::Format: |
||
34501 | return cast<FormatAttr>(this)->clone(C); |
||
34502 | case attr::FormatArg: |
||
34503 | return cast<FormatArgAttr>(this)->clone(C); |
||
34504 | case attr::FunctionReturnThunks: |
||
34505 | return cast<FunctionReturnThunksAttr>(this)->clone(C); |
||
34506 | case attr::GNUInline: |
||
34507 | return cast<GNUInlineAttr>(this)->clone(C); |
||
34508 | case attr::GuardedBy: |
||
34509 | return cast<GuardedByAttr>(this)->clone(C); |
||
34510 | case attr::GuardedVar: |
||
34511 | return cast<GuardedVarAttr>(this)->clone(C); |
||
34512 | case attr::HIPManaged: |
||
34513 | return cast<HIPManagedAttr>(this)->clone(C); |
||
34514 | case attr::HLSLGroupSharedAddressSpace: |
||
34515 | return cast<HLSLGroupSharedAddressSpaceAttr>(this)->clone(C); |
||
34516 | case attr::HLSLNumThreads: |
||
34517 | return cast<HLSLNumThreadsAttr>(this)->clone(C); |
||
34518 | case attr::HLSLResource: |
||
34519 | return cast<HLSLResourceAttr>(this)->clone(C); |
||
34520 | case attr::HLSLResourceBinding: |
||
34521 | return cast<HLSLResourceBindingAttr>(this)->clone(C); |
||
34522 | case attr::HLSLSV_DispatchThreadID: |
||
34523 | return cast<HLSLSV_DispatchThreadIDAttr>(this)->clone(C); |
||
34524 | case attr::HLSLSV_GroupIndex: |
||
34525 | return cast<HLSLSV_GroupIndexAttr>(this)->clone(C); |
||
34526 | case attr::HLSLShader: |
||
34527 | return cast<HLSLShaderAttr>(this)->clone(C); |
||
34528 | case attr::Hot: |
||
34529 | return cast<HotAttr>(this)->clone(C); |
||
34530 | case attr::IBAction: |
||
34531 | return cast<IBActionAttr>(this)->clone(C); |
||
34532 | case attr::IBOutlet: |
||
34533 | return cast<IBOutletAttr>(this)->clone(C); |
||
34534 | case attr::IBOutletCollection: |
||
34535 | return cast<IBOutletCollectionAttr>(this)->clone(C); |
||
34536 | case attr::IFunc: |
||
34537 | return cast<IFuncAttr>(this)->clone(C); |
||
34538 | case attr::InitPriority: |
||
34539 | return cast<InitPriorityAttr>(this)->clone(C); |
||
34540 | case attr::InitSeg: |
||
34541 | return cast<InitSegAttr>(this)->clone(C); |
||
34542 | case attr::IntelOclBicc: |
||
34543 | return cast<IntelOclBiccAttr>(this)->clone(C); |
||
34544 | case attr::InternalLinkage: |
||
34545 | return cast<InternalLinkageAttr>(this)->clone(C); |
||
34546 | case attr::LTOVisibilityPublic: |
||
34547 | return cast<LTOVisibilityPublicAttr>(this)->clone(C); |
||
34548 | case attr::LayoutVersion: |
||
34549 | return cast<LayoutVersionAttr>(this)->clone(C); |
||
34550 | case attr::Leaf: |
||
34551 | return cast<LeafAttr>(this)->clone(C); |
||
34552 | case attr::LifetimeBound: |
||
34553 | return cast<LifetimeBoundAttr>(this)->clone(C); |
||
34554 | case attr::Likely: |
||
34555 | return cast<LikelyAttr>(this)->clone(C); |
||
34556 | case attr::LoaderUninitialized: |
||
34557 | return cast<LoaderUninitializedAttr>(this)->clone(C); |
||
34558 | case attr::LockReturned: |
||
34559 | return cast<LockReturnedAttr>(this)->clone(C); |
||
34560 | case attr::LocksExcluded: |
||
34561 | return cast<LocksExcludedAttr>(this)->clone(C); |
||
34562 | case attr::LoopHint: |
||
34563 | return cast<LoopHintAttr>(this)->clone(C); |
||
34564 | case attr::M68kInterrupt: |
||
34565 | return cast<M68kInterruptAttr>(this)->clone(C); |
||
34566 | case attr::MIGServerRoutine: |
||
34567 | return cast<MIGServerRoutineAttr>(this)->clone(C); |
||
34568 | case attr::MSABI: |
||
34569 | return cast<MSABIAttr>(this)->clone(C); |
||
34570 | case attr::MSAllocator: |
||
34571 | return cast<MSAllocatorAttr>(this)->clone(C); |
||
34572 | case attr::MSInheritance: |
||
34573 | return cast<MSInheritanceAttr>(this)->clone(C); |
||
34574 | case attr::MSNoVTable: |
||
34575 | return cast<MSNoVTableAttr>(this)->clone(C); |
||
34576 | case attr::MSP430Interrupt: |
||
34577 | return cast<MSP430InterruptAttr>(this)->clone(C); |
||
34578 | case attr::MSStruct: |
||
34579 | return cast<MSStructAttr>(this)->clone(C); |
||
34580 | case attr::MSVtorDisp: |
||
34581 | return cast<MSVtorDispAttr>(this)->clone(C); |
||
34582 | case attr::MaxFieldAlignment: |
||
34583 | return cast<MaxFieldAlignmentAttr>(this)->clone(C); |
||
34584 | case attr::MayAlias: |
||
34585 | return cast<MayAliasAttr>(this)->clone(C); |
||
34586 | case attr::MaybeUndef: |
||
34587 | return cast<MaybeUndefAttr>(this)->clone(C); |
||
34588 | case attr::MicroMips: |
||
34589 | return cast<MicroMipsAttr>(this)->clone(C); |
||
34590 | case attr::MinSize: |
||
34591 | return cast<MinSizeAttr>(this)->clone(C); |
||
34592 | case attr::MinVectorWidth: |
||
34593 | return cast<MinVectorWidthAttr>(this)->clone(C); |
||
34594 | case attr::Mips16: |
||
34595 | return cast<Mips16Attr>(this)->clone(C); |
||
34596 | case attr::MipsInterrupt: |
||
34597 | return cast<MipsInterruptAttr>(this)->clone(C); |
||
34598 | case attr::MipsLongCall: |
||
34599 | return cast<MipsLongCallAttr>(this)->clone(C); |
||
34600 | case attr::MipsShortCall: |
||
34601 | return cast<MipsShortCallAttr>(this)->clone(C); |
||
34602 | case attr::Mode: |
||
34603 | return cast<ModeAttr>(this)->clone(C); |
||
34604 | case attr::MustTail: |
||
34605 | return cast<MustTailAttr>(this)->clone(C); |
||
34606 | case attr::NSConsumed: |
||
34607 | return cast<NSConsumedAttr>(this)->clone(C); |
||
34608 | case attr::NSConsumesSelf: |
||
34609 | return cast<NSConsumesSelfAttr>(this)->clone(C); |
||
34610 | case attr::NSErrorDomain: |
||
34611 | return cast<NSErrorDomainAttr>(this)->clone(C); |
||
34612 | case attr::NSReturnsAutoreleased: |
||
34613 | return cast<NSReturnsAutoreleasedAttr>(this)->clone(C); |
||
34614 | case attr::NSReturnsNotRetained: |
||
34615 | return cast<NSReturnsNotRetainedAttr>(this)->clone(C); |
||
34616 | case attr::NSReturnsRetained: |
||
34617 | return cast<NSReturnsRetainedAttr>(this)->clone(C); |
||
34618 | case attr::Naked: |
||
34619 | return cast<NakedAttr>(this)->clone(C); |
||
34620 | case attr::NoAlias: |
||
34621 | return cast<NoAliasAttr>(this)->clone(C); |
||
34622 | case attr::NoBuiltin: |
||
34623 | return cast<NoBuiltinAttr>(this)->clone(C); |
||
34624 | case attr::NoCommon: |
||
34625 | return cast<NoCommonAttr>(this)->clone(C); |
||
34626 | case attr::NoDebug: |
||
34627 | return cast<NoDebugAttr>(this)->clone(C); |
||
34628 | case attr::NoDeref: |
||
34629 | return cast<NoDerefAttr>(this)->clone(C); |
||
34630 | case attr::NoDestroy: |
||
34631 | return cast<NoDestroyAttr>(this)->clone(C); |
||
34632 | case attr::NoDuplicate: |
||
34633 | return cast<NoDuplicateAttr>(this)->clone(C); |
||
34634 | case attr::NoEscape: |
||
34635 | return cast<NoEscapeAttr>(this)->clone(C); |
||
34636 | case attr::NoInline: |
||
34637 | return cast<NoInlineAttr>(this)->clone(C); |
||
34638 | case attr::NoInstrumentFunction: |
||
34639 | return cast<NoInstrumentFunctionAttr>(this)->clone(C); |
||
34640 | case attr::NoMerge: |
||
34641 | return cast<NoMergeAttr>(this)->clone(C); |
||
34642 | case attr::NoMicroMips: |
||
34643 | return cast<NoMicroMipsAttr>(this)->clone(C); |
||
34644 | case attr::NoMips16: |
||
34645 | return cast<NoMips16Attr>(this)->clone(C); |
||
34646 | case attr::NoProfileFunction: |
||
34647 | return cast<NoProfileFunctionAttr>(this)->clone(C); |
||
34648 | case attr::NoRandomizeLayout: |
||
34649 | return cast<NoRandomizeLayoutAttr>(this)->clone(C); |
||
34650 | case attr::NoReturn: |
||
34651 | return cast<NoReturnAttr>(this)->clone(C); |
||
34652 | case attr::NoSanitize: |
||
34653 | return cast<NoSanitizeAttr>(this)->clone(C); |
||
34654 | case attr::NoSpeculativeLoadHardening: |
||
34655 | return cast<NoSpeculativeLoadHardeningAttr>(this)->clone(C); |
||
34656 | case attr::NoSplitStack: |
||
34657 | return cast<NoSplitStackAttr>(this)->clone(C); |
||
34658 | case attr::NoStackProtector: |
||
34659 | return cast<NoStackProtectorAttr>(this)->clone(C); |
||
34660 | case attr::NoThreadSafetyAnalysis: |
||
34661 | return cast<NoThreadSafetyAnalysisAttr>(this)->clone(C); |
||
34662 | case attr::NoThrow: |
||
34663 | return cast<NoThrowAttr>(this)->clone(C); |
||
34664 | case attr::NoUniqueAddress: |
||
34665 | return cast<NoUniqueAddressAttr>(this)->clone(C); |
||
34666 | case attr::NoUwtable: |
||
34667 | return cast<NoUwtableAttr>(this)->clone(C); |
||
34668 | case attr::NonNull: |
||
34669 | return cast<NonNullAttr>(this)->clone(C); |
||
34670 | case attr::NotTailCalled: |
||
34671 | return cast<NotTailCalledAttr>(this)->clone(C); |
||
34672 | case attr::OMPAllocateDecl: |
||
34673 | return cast<OMPAllocateDeclAttr>(this)->clone(C); |
||
34674 | case attr::OMPCaptureKind: |
||
34675 | return cast<OMPCaptureKindAttr>(this)->clone(C); |
||
34676 | case attr::OMPCaptureNoInit: |
||
34677 | return cast<OMPCaptureNoInitAttr>(this)->clone(C); |
||
34678 | case attr::OMPDeclareSimdDecl: |
||
34679 | return cast<OMPDeclareSimdDeclAttr>(this)->clone(C); |
||
34680 | case attr::OMPDeclareTargetDecl: |
||
34681 | return cast<OMPDeclareTargetDeclAttr>(this)->clone(C); |
||
34682 | case attr::OMPDeclareVariant: |
||
34683 | return cast<OMPDeclareVariantAttr>(this)->clone(C); |
||
34684 | case attr::OMPReferencedVar: |
||
34685 | return cast<OMPReferencedVarAttr>(this)->clone(C); |
||
34686 | case attr::OMPThreadPrivateDecl: |
||
34687 | return cast<OMPThreadPrivateDeclAttr>(this)->clone(C); |
||
34688 | case attr::OSConsumed: |
||
34689 | return cast<OSConsumedAttr>(this)->clone(C); |
||
34690 | case attr::OSConsumesThis: |
||
34691 | return cast<OSConsumesThisAttr>(this)->clone(C); |
||
34692 | case attr::OSReturnsNotRetained: |
||
34693 | return cast<OSReturnsNotRetainedAttr>(this)->clone(C); |
||
34694 | case attr::OSReturnsRetained: |
||
34695 | return cast<OSReturnsRetainedAttr>(this)->clone(C); |
||
34696 | case attr::OSReturnsRetainedOnNonZero: |
||
34697 | return cast<OSReturnsRetainedOnNonZeroAttr>(this)->clone(C); |
||
34698 | case attr::OSReturnsRetainedOnZero: |
||
34699 | return cast<OSReturnsRetainedOnZeroAttr>(this)->clone(C); |
||
34700 | case attr::ObjCBoxable: |
||
34701 | return cast<ObjCBoxableAttr>(this)->clone(C); |
||
34702 | case attr::ObjCBridge: |
||
34703 | return cast<ObjCBridgeAttr>(this)->clone(C); |
||
34704 | case attr::ObjCBridgeMutable: |
||
34705 | return cast<ObjCBridgeMutableAttr>(this)->clone(C); |
||
34706 | case attr::ObjCBridgeRelated: |
||
34707 | return cast<ObjCBridgeRelatedAttr>(this)->clone(C); |
||
34708 | case attr::ObjCClassStub: |
||
34709 | return cast<ObjCClassStubAttr>(this)->clone(C); |
||
34710 | case attr::ObjCDesignatedInitializer: |
||
34711 | return cast<ObjCDesignatedInitializerAttr>(this)->clone(C); |
||
34712 | case attr::ObjCDirect: |
||
34713 | return cast<ObjCDirectAttr>(this)->clone(C); |
||
34714 | case attr::ObjCDirectMembers: |
||
34715 | return cast<ObjCDirectMembersAttr>(this)->clone(C); |
||
34716 | case attr::ObjCException: |
||
34717 | return cast<ObjCExceptionAttr>(this)->clone(C); |
||
34718 | case attr::ObjCExplicitProtocolImpl: |
||
34719 | return cast<ObjCExplicitProtocolImplAttr>(this)->clone(C); |
||
34720 | case attr::ObjCExternallyRetained: |
||
34721 | return cast<ObjCExternallyRetainedAttr>(this)->clone(C); |
||
34722 | case attr::ObjCGC: |
||
34723 | return cast<ObjCGCAttr>(this)->clone(C); |
||
34724 | case attr::ObjCIndependentClass: |
||
34725 | return cast<ObjCIndependentClassAttr>(this)->clone(C); |
||
34726 | case attr::ObjCInertUnsafeUnretained: |
||
34727 | return cast<ObjCInertUnsafeUnretainedAttr>(this)->clone(C); |
||
34728 | case attr::ObjCKindOf: |
||
34729 | return cast<ObjCKindOfAttr>(this)->clone(C); |
||
34730 | case attr::ObjCMethodFamily: |
||
34731 | return cast<ObjCMethodFamilyAttr>(this)->clone(C); |
||
34732 | case attr::ObjCNSObject: |
||
34733 | return cast<ObjCNSObjectAttr>(this)->clone(C); |
||
34734 | case attr::ObjCNonLazyClass: |
||
34735 | return cast<ObjCNonLazyClassAttr>(this)->clone(C); |
||
34736 | case attr::ObjCNonRuntimeProtocol: |
||
34737 | return cast<ObjCNonRuntimeProtocolAttr>(this)->clone(C); |
||
34738 | case attr::ObjCOwnership: |
||
34739 | return cast<ObjCOwnershipAttr>(this)->clone(C); |
||
34740 | case attr::ObjCPreciseLifetime: |
||
34741 | return cast<ObjCPreciseLifetimeAttr>(this)->clone(C); |
||
34742 | case attr::ObjCRequiresPropertyDefs: |
||
34743 | return cast<ObjCRequiresPropertyDefsAttr>(this)->clone(C); |
||
34744 | case attr::ObjCRequiresSuper: |
||
34745 | return cast<ObjCRequiresSuperAttr>(this)->clone(C); |
||
34746 | case attr::ObjCReturnsInnerPointer: |
||
34747 | return cast<ObjCReturnsInnerPointerAttr>(this)->clone(C); |
||
34748 | case attr::ObjCRootClass: |
||
34749 | return cast<ObjCRootClassAttr>(this)->clone(C); |
||
34750 | case attr::ObjCRuntimeName: |
||
34751 | return cast<ObjCRuntimeNameAttr>(this)->clone(C); |
||
34752 | case attr::ObjCRuntimeVisible: |
||
34753 | return cast<ObjCRuntimeVisibleAttr>(this)->clone(C); |
||
34754 | case attr::ObjCSubclassingRestricted: |
||
34755 | return cast<ObjCSubclassingRestrictedAttr>(this)->clone(C); |
||
34756 | case attr::OpenCLAccess: |
||
34757 | return cast<OpenCLAccessAttr>(this)->clone(C); |
||
34758 | case attr::OpenCLConstantAddressSpace: |
||
34759 | return cast<OpenCLConstantAddressSpaceAttr>(this)->clone(C); |
||
34760 | case attr::OpenCLGenericAddressSpace: |
||
34761 | return cast<OpenCLGenericAddressSpaceAttr>(this)->clone(C); |
||
34762 | case attr::OpenCLGlobalAddressSpace: |
||
34763 | return cast<OpenCLGlobalAddressSpaceAttr>(this)->clone(C); |
||
34764 | case attr::OpenCLGlobalDeviceAddressSpace: |
||
34765 | return cast<OpenCLGlobalDeviceAddressSpaceAttr>(this)->clone(C); |
||
34766 | case attr::OpenCLGlobalHostAddressSpace: |
||
34767 | return cast<OpenCLGlobalHostAddressSpaceAttr>(this)->clone(C); |
||
34768 | case attr::OpenCLIntelReqdSubGroupSize: |
||
34769 | return cast<OpenCLIntelReqdSubGroupSizeAttr>(this)->clone(C); |
||
34770 | case attr::OpenCLKernel: |
||
34771 | return cast<OpenCLKernelAttr>(this)->clone(C); |
||
34772 | case attr::OpenCLLocalAddressSpace: |
||
34773 | return cast<OpenCLLocalAddressSpaceAttr>(this)->clone(C); |
||
34774 | case attr::OpenCLPrivateAddressSpace: |
||
34775 | return cast<OpenCLPrivateAddressSpaceAttr>(this)->clone(C); |
||
34776 | case attr::OpenCLUnrollHint: |
||
34777 | return cast<OpenCLUnrollHintAttr>(this)->clone(C); |
||
34778 | case attr::OptimizeNone: |
||
34779 | return cast<OptimizeNoneAttr>(this)->clone(C); |
||
34780 | case attr::Overloadable: |
||
34781 | return cast<OverloadableAttr>(this)->clone(C); |
||
34782 | case attr::Override: |
||
34783 | return cast<OverrideAttr>(this)->clone(C); |
||
34784 | case attr::Owner: |
||
34785 | return cast<OwnerAttr>(this)->clone(C); |
||
34786 | case attr::Ownership: |
||
34787 | return cast<OwnershipAttr>(this)->clone(C); |
||
34788 | case attr::Packed: |
||
34789 | return cast<PackedAttr>(this)->clone(C); |
||
34790 | case attr::ParamTypestate: |
||
34791 | return cast<ParamTypestateAttr>(this)->clone(C); |
||
34792 | case attr::Pascal: |
||
34793 | return cast<PascalAttr>(this)->clone(C); |
||
34794 | case attr::PassObjectSize: |
||
34795 | return cast<PassObjectSizeAttr>(this)->clone(C); |
||
34796 | case attr::PatchableFunctionEntry: |
||
34797 | return cast<PatchableFunctionEntryAttr>(this)->clone(C); |
||
34798 | case attr::Pcs: |
||
34799 | return cast<PcsAttr>(this)->clone(C); |
||
34800 | case attr::Pointer: |
||
34801 | return cast<PointerAttr>(this)->clone(C); |
||
34802 | case attr::PragmaClangBSSSection: |
||
34803 | return cast<PragmaClangBSSSectionAttr>(this)->clone(C); |
||
34804 | case attr::PragmaClangDataSection: |
||
34805 | return cast<PragmaClangDataSectionAttr>(this)->clone(C); |
||
34806 | case attr::PragmaClangRelroSection: |
||
34807 | return cast<PragmaClangRelroSectionAttr>(this)->clone(C); |
||
34808 | case attr::PragmaClangRodataSection: |
||
34809 | return cast<PragmaClangRodataSectionAttr>(this)->clone(C); |
||
34810 | case attr::PragmaClangTextSection: |
||
34811 | return cast<PragmaClangTextSectionAttr>(this)->clone(C); |
||
34812 | case attr::PreferredName: |
||
34813 | return cast<PreferredNameAttr>(this)->clone(C); |
||
34814 | case attr::PreserveAll: |
||
34815 | return cast<PreserveAllAttr>(this)->clone(C); |
||
34816 | case attr::PreserveMost: |
||
34817 | return cast<PreserveMostAttr>(this)->clone(C); |
||
34818 | case attr::PtGuardedBy: |
||
34819 | return cast<PtGuardedByAttr>(this)->clone(C); |
||
34820 | case attr::PtGuardedVar: |
||
34821 | return cast<PtGuardedVarAttr>(this)->clone(C); |
||
34822 | case attr::Ptr32: |
||
34823 | return cast<Ptr32Attr>(this)->clone(C); |
||
34824 | case attr::Ptr64: |
||
34825 | return cast<Ptr64Attr>(this)->clone(C); |
||
34826 | case attr::Pure: |
||
34827 | return cast<PureAttr>(this)->clone(C); |
||
34828 | case attr::RISCVInterrupt: |
||
34829 | return cast<RISCVInterruptAttr>(this)->clone(C); |
||
34830 | case attr::RandomizeLayout: |
||
34831 | return cast<RandomizeLayoutAttr>(this)->clone(C); |
||
34832 | case attr::ReadOnlyPlacement: |
||
34833 | return cast<ReadOnlyPlacementAttr>(this)->clone(C); |
||
34834 | case attr::RegCall: |
||
34835 | return cast<RegCallAttr>(this)->clone(C); |
||
34836 | case attr::Reinitializes: |
||
34837 | return cast<ReinitializesAttr>(this)->clone(C); |
||
34838 | case attr::ReleaseCapability: |
||
34839 | return cast<ReleaseCapabilityAttr>(this)->clone(C); |
||
34840 | case attr::ReleaseHandle: |
||
34841 | return cast<ReleaseHandleAttr>(this)->clone(C); |
||
34842 | case attr::RenderScriptKernel: |
||
34843 | return cast<RenderScriptKernelAttr>(this)->clone(C); |
||
34844 | case attr::ReqdWorkGroupSize: |
||
34845 | return cast<ReqdWorkGroupSizeAttr>(this)->clone(C); |
||
34846 | case attr::RequiresCapability: |
||
34847 | return cast<RequiresCapabilityAttr>(this)->clone(C); |
||
34848 | case attr::Restrict: |
||
34849 | return cast<RestrictAttr>(this)->clone(C); |
||
34850 | case attr::Retain: |
||
34851 | return cast<RetainAttr>(this)->clone(C); |
||
34852 | case attr::ReturnTypestate: |
||
34853 | return cast<ReturnTypestateAttr>(this)->clone(C); |
||
34854 | case attr::ReturnsNonNull: |
||
34855 | return cast<ReturnsNonNullAttr>(this)->clone(C); |
||
34856 | case attr::ReturnsTwice: |
||
34857 | return cast<ReturnsTwiceAttr>(this)->clone(C); |
||
34858 | case attr::SPtr: |
||
34859 | return cast<SPtrAttr>(this)->clone(C); |
||
34860 | case attr::SYCLKernel: |
||
34861 | return cast<SYCLKernelAttr>(this)->clone(C); |
||
34862 | case attr::SYCLSpecialClass: |
||
34863 | return cast<SYCLSpecialClassAttr>(this)->clone(C); |
||
34864 | case attr::ScopedLockable: |
||
34865 | return cast<ScopedLockableAttr>(this)->clone(C); |
||
34866 | case attr::Section: |
||
34867 | return cast<SectionAttr>(this)->clone(C); |
||
34868 | case attr::SelectAny: |
||
34869 | return cast<SelectAnyAttr>(this)->clone(C); |
||
34870 | case attr::Sentinel: |
||
34871 | return cast<SentinelAttr>(this)->clone(C); |
||
34872 | case attr::SetTypestate: |
||
34873 | return cast<SetTypestateAttr>(this)->clone(C); |
||
34874 | case attr::SharedTrylockFunction: |
||
34875 | return cast<SharedTrylockFunctionAttr>(this)->clone(C); |
||
34876 | case attr::SpeculativeLoadHardening: |
||
34877 | return cast<SpeculativeLoadHardeningAttr>(this)->clone(C); |
||
34878 | case attr::StandaloneDebug: |
||
34879 | return cast<StandaloneDebugAttr>(this)->clone(C); |
||
34880 | case attr::StdCall: |
||
34881 | return cast<StdCallAttr>(this)->clone(C); |
||
34882 | case attr::StrictFP: |
||
34883 | return cast<StrictFPAttr>(this)->clone(C); |
||
34884 | case attr::StrictGuardStackCheck: |
||
34885 | return cast<StrictGuardStackCheckAttr>(this)->clone(C); |
||
34886 | case attr::Suppress: |
||
34887 | return cast<SuppressAttr>(this)->clone(C); |
||
34888 | case attr::SwiftAsync: |
||
34889 | return cast<SwiftAsyncAttr>(this)->clone(C); |
||
34890 | case attr::SwiftAsyncCall: |
||
34891 | return cast<SwiftAsyncCallAttr>(this)->clone(C); |
||
34892 | case attr::SwiftAsyncContext: |
||
34893 | return cast<SwiftAsyncContextAttr>(this)->clone(C); |
||
34894 | case attr::SwiftAsyncError: |
||
34895 | return cast<SwiftAsyncErrorAttr>(this)->clone(C); |
||
34896 | case attr::SwiftAsyncName: |
||
34897 | return cast<SwiftAsyncNameAttr>(this)->clone(C); |
||
34898 | case attr::SwiftAttr: |
||
34899 | return cast<SwiftAttrAttr>(this)->clone(C); |
||
34900 | case attr::SwiftBridge: |
||
34901 | return cast<SwiftBridgeAttr>(this)->clone(C); |
||
34902 | case attr::SwiftBridgedTypedef: |
||
34903 | return cast<SwiftBridgedTypedefAttr>(this)->clone(C); |
||
34904 | case attr::SwiftCall: |
||
34905 | return cast<SwiftCallAttr>(this)->clone(C); |
||
34906 | case attr::SwiftContext: |
||
34907 | return cast<SwiftContextAttr>(this)->clone(C); |
||
34908 | case attr::SwiftError: |
||
34909 | return cast<SwiftErrorAttr>(this)->clone(C); |
||
34910 | case attr::SwiftErrorResult: |
||
34911 | return cast<SwiftErrorResultAttr>(this)->clone(C); |
||
34912 | case attr::SwiftIndirectResult: |
||
34913 | return cast<SwiftIndirectResultAttr>(this)->clone(C); |
||
34914 | case attr::SwiftName: |
||
34915 | return cast<SwiftNameAttr>(this)->clone(C); |
||
34916 | case attr::SwiftNewType: |
||
34917 | return cast<SwiftNewTypeAttr>(this)->clone(C); |
||
34918 | case attr::SwiftObjCMembers: |
||
34919 | return cast<SwiftObjCMembersAttr>(this)->clone(C); |
||
34920 | case attr::SwiftPrivate: |
||
34921 | return cast<SwiftPrivateAttr>(this)->clone(C); |
||
34922 | case attr::SysVABI: |
||
34923 | return cast<SysVABIAttr>(this)->clone(C); |
||
34924 | case attr::TLSModel: |
||
34925 | return cast<TLSModelAttr>(this)->clone(C); |
||
34926 | case attr::Target: |
||
34927 | return cast<TargetAttr>(this)->clone(C); |
||
34928 | case attr::TargetClones: |
||
34929 | return cast<TargetClonesAttr>(this)->clone(C); |
||
34930 | case attr::TargetVersion: |
||
34931 | return cast<TargetVersionAttr>(this)->clone(C); |
||
34932 | case attr::TestTypestate: |
||
34933 | return cast<TestTypestateAttr>(this)->clone(C); |
||
34934 | case attr::ThisCall: |
||
34935 | return cast<ThisCallAttr>(this)->clone(C); |
||
34936 | case attr::Thread: |
||
34937 | return cast<ThreadAttr>(this)->clone(C); |
||
34938 | case attr::TransparentUnion: |
||
34939 | return cast<TransparentUnionAttr>(this)->clone(C); |
||
34940 | case attr::TrivialABI: |
||
34941 | return cast<TrivialABIAttr>(this)->clone(C); |
||
34942 | case attr::TryAcquireCapability: |
||
34943 | return cast<TryAcquireCapabilityAttr>(this)->clone(C); |
||
34944 | case attr::TypeNonNull: |
||
34945 | return cast<TypeNonNullAttr>(this)->clone(C); |
||
34946 | case attr::TypeNullUnspecified: |
||
34947 | return cast<TypeNullUnspecifiedAttr>(this)->clone(C); |
||
34948 | case attr::TypeNullable: |
||
34949 | return cast<TypeNullableAttr>(this)->clone(C); |
||
34950 | case attr::TypeNullableResult: |
||
34951 | return cast<TypeNullableResultAttr>(this)->clone(C); |
||
34952 | case attr::TypeTagForDatatype: |
||
34953 | return cast<TypeTagForDatatypeAttr>(this)->clone(C); |
||
34954 | case attr::TypeVisibility: |
||
34955 | return cast<TypeVisibilityAttr>(this)->clone(C); |
||
34956 | case attr::UPtr: |
||
34957 | return cast<UPtrAttr>(this)->clone(C); |
||
34958 | case attr::Unavailable: |
||
34959 | return cast<UnavailableAttr>(this)->clone(C); |
||
34960 | case attr::Uninitialized: |
||
34961 | return cast<UninitializedAttr>(this)->clone(C); |
||
34962 | case attr::Unlikely: |
||
34963 | return cast<UnlikelyAttr>(this)->clone(C); |
||
34964 | case attr::Unused: |
||
34965 | return cast<UnusedAttr>(this)->clone(C); |
||
34966 | case attr::UseHandle: |
||
34967 | return cast<UseHandleAttr>(this)->clone(C); |
||
34968 | case attr::Used: |
||
34969 | return cast<UsedAttr>(this)->clone(C); |
||
34970 | case attr::UsingIfExists: |
||
34971 | return cast<UsingIfExistsAttr>(this)->clone(C); |
||
34972 | case attr::Uuid: |
||
34973 | return cast<UuidAttr>(this)->clone(C); |
||
34974 | case attr::VecReturn: |
||
34975 | return cast<VecReturnAttr>(this)->clone(C); |
||
34976 | case attr::VecTypeHint: |
||
34977 | return cast<VecTypeHintAttr>(this)->clone(C); |
||
34978 | case attr::VectorCall: |
||
34979 | return cast<VectorCallAttr>(this)->clone(C); |
||
34980 | case attr::Visibility: |
||
34981 | return cast<VisibilityAttr>(this)->clone(C); |
||
34982 | case attr::WarnUnused: |
||
34983 | return cast<WarnUnusedAttr>(this)->clone(C); |
||
34984 | case attr::WarnUnusedResult: |
||
34985 | return cast<WarnUnusedResultAttr>(this)->clone(C); |
||
34986 | case attr::Weak: |
||
34987 | return cast<WeakAttr>(this)->clone(C); |
||
34988 | case attr::WeakImport: |
||
34989 | return cast<WeakImportAttr>(this)->clone(C); |
||
34990 | case attr::WeakRef: |
||
34991 | return cast<WeakRefAttr>(this)->clone(C); |
||
34992 | case attr::WebAssemblyExportName: |
||
34993 | return cast<WebAssemblyExportNameAttr>(this)->clone(C); |
||
34994 | case attr::WebAssemblyImportModule: |
||
34995 | return cast<WebAssemblyImportModuleAttr>(this)->clone(C); |
||
34996 | case attr::WebAssemblyImportName: |
||
34997 | return cast<WebAssemblyImportNameAttr>(this)->clone(C); |
||
34998 | case attr::WorkGroupSizeHint: |
||
34999 | return cast<WorkGroupSizeHintAttr>(this)->clone(C); |
||
35000 | case attr::X86ForceAlignArgPointer: |
||
35001 | return cast<X86ForceAlignArgPointerAttr>(this)->clone(C); |
||
35002 | case attr::XRayInstrument: |
||
35003 | return cast<XRayInstrumentAttr>(this)->clone(C); |
||
35004 | case attr::XRayLogArgs: |
||
35005 | return cast<XRayLogArgsAttr>(this)->clone(C); |
||
35006 | case attr::ZeroCallUsedRegs: |
||
35007 | return cast<ZeroCallUsedRegsAttr>(this)->clone(C); |
||
35008 | } |
||
35009 | llvm_unreachable("Unexpected attribute kind!"); |
||
35010 | } |
||
35011 | |||
35012 | void Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { |
||
35013 | switch (getKind()) { |
||
35014 | case attr::AArch64SVEPcs: |
||
35015 | return cast<AArch64SVEPcsAttr>(this)->printPretty(OS, Policy); |
||
35016 | case attr::AArch64VectorPcs: |
||
35017 | return cast<AArch64VectorPcsAttr>(this)->printPretty(OS, Policy); |
||
35018 | case attr::AMDGPUFlatWorkGroupSize: |
||
35019 | return cast<AMDGPUFlatWorkGroupSizeAttr>(this)->printPretty(OS, Policy); |
||
35020 | case attr::AMDGPUKernelCall: |
||
35021 | return cast<AMDGPUKernelCallAttr>(this)->printPretty(OS, Policy); |
||
35022 | case attr::AMDGPUNumSGPR: |
||
35023 | return cast<AMDGPUNumSGPRAttr>(this)->printPretty(OS, Policy); |
||
35024 | case attr::AMDGPUNumVGPR: |
||
35025 | return cast<AMDGPUNumVGPRAttr>(this)->printPretty(OS, Policy); |
||
35026 | case attr::AMDGPUWavesPerEU: |
||
35027 | return cast<AMDGPUWavesPerEUAttr>(this)->printPretty(OS, Policy); |
||
35028 | case attr::ARMInterrupt: |
||
35029 | return cast<ARMInterruptAttr>(this)->printPretty(OS, Policy); |
||
35030 | case attr::AVRInterrupt: |
||
35031 | return cast<AVRInterruptAttr>(this)->printPretty(OS, Policy); |
||
35032 | case attr::AVRSignal: |
||
35033 | return cast<AVRSignalAttr>(this)->printPretty(OS, Policy); |
||
35034 | case attr::AbiTag: |
||
35035 | return cast<AbiTagAttr>(this)->printPretty(OS, Policy); |
||
35036 | case attr::AcquireCapability: |
||
35037 | return cast<AcquireCapabilityAttr>(this)->printPretty(OS, Policy); |
||
35038 | case attr::AcquireHandle: |
||
35039 | return cast<AcquireHandleAttr>(this)->printPretty(OS, Policy); |
||
35040 | case attr::AcquiredAfter: |
||
35041 | return cast<AcquiredAfterAttr>(this)->printPretty(OS, Policy); |
||
35042 | case attr::AcquiredBefore: |
||
35043 | return cast<AcquiredBeforeAttr>(this)->printPretty(OS, Policy); |
||
35044 | case attr::AddressSpace: |
||
35045 | return cast<AddressSpaceAttr>(this)->printPretty(OS, Policy); |
||
35046 | case attr::Alias: |
||
35047 | return cast<AliasAttr>(this)->printPretty(OS, Policy); |
||
35048 | case attr::AlignMac68k: |
||
35049 | return cast<AlignMac68kAttr>(this)->printPretty(OS, Policy); |
||
35050 | case attr::AlignNatural: |
||
35051 | return cast<AlignNaturalAttr>(this)->printPretty(OS, Policy); |
||
35052 | case attr::AlignValue: |
||
35053 | return cast<AlignValueAttr>(this)->printPretty(OS, Policy); |
||
35054 | case attr::Aligned: |
||
35055 | return cast<AlignedAttr>(this)->printPretty(OS, Policy); |
||
35056 | case attr::AllocAlign: |
||
35057 | return cast<AllocAlignAttr>(this)->printPretty(OS, Policy); |
||
35058 | case attr::AllocSize: |
||
35059 | return cast<AllocSizeAttr>(this)->printPretty(OS, Policy); |
||
35060 | case attr::AlwaysDestroy: |
||
35061 | return cast<AlwaysDestroyAttr>(this)->printPretty(OS, Policy); |
||
35062 | case attr::AlwaysInline: |
||
35063 | return cast<AlwaysInlineAttr>(this)->printPretty(OS, Policy); |
||
35064 | case attr::AnalyzerNoReturn: |
||
35065 | return cast<AnalyzerNoReturnAttr>(this)->printPretty(OS, Policy); |
||
35066 | case attr::Annotate: |
||
35067 | return cast<AnnotateAttr>(this)->printPretty(OS, Policy); |
||
35068 | case attr::AnnotateType: |
||
35069 | return cast<AnnotateTypeAttr>(this)->printPretty(OS, Policy); |
||
35070 | case attr::AnyX86Interrupt: |
||
35071 | return cast<AnyX86InterruptAttr>(this)->printPretty(OS, Policy); |
||
35072 | case attr::AnyX86NoCallerSavedRegisters: |
||
35073 | return cast<AnyX86NoCallerSavedRegistersAttr>(this)->printPretty(OS, Policy); |
||
35074 | case attr::AnyX86NoCfCheck: |
||
35075 | return cast<AnyX86NoCfCheckAttr>(this)->printPretty(OS, Policy); |
||
35076 | case attr::ArcWeakrefUnavailable: |
||
35077 | return cast<ArcWeakrefUnavailableAttr>(this)->printPretty(OS, Policy); |
||
35078 | case attr::ArgumentWithTypeTag: |
||
35079 | return cast<ArgumentWithTypeTagAttr>(this)->printPretty(OS, Policy); |
||
35080 | case attr::ArmBuiltinAlias: |
||
35081 | return cast<ArmBuiltinAliasAttr>(this)->printPretty(OS, Policy); |
||
35082 | case attr::ArmMveStrictPolymorphism: |
||
35083 | return cast<ArmMveStrictPolymorphismAttr>(this)->printPretty(OS, Policy); |
||
35084 | case attr::Artificial: |
||
35085 | return cast<ArtificialAttr>(this)->printPretty(OS, Policy); |
||
35086 | case attr::AsmLabel: |
||
35087 | return cast<AsmLabelAttr>(this)->printPretty(OS, Policy); |
||
35088 | case attr::AssertCapability: |
||
35089 | return cast<AssertCapabilityAttr>(this)->printPretty(OS, Policy); |
||
35090 | case attr::AssertExclusiveLock: |
||
35091 | return cast<AssertExclusiveLockAttr>(this)->printPretty(OS, Policy); |
||
35092 | case attr::AssertSharedLock: |
||
35093 | return cast<AssertSharedLockAttr>(this)->printPretty(OS, Policy); |
||
35094 | case attr::AssumeAligned: |
||
35095 | return cast<AssumeAlignedAttr>(this)->printPretty(OS, Policy); |
||
35096 | case attr::Assumption: |
||
35097 | return cast<AssumptionAttr>(this)->printPretty(OS, Policy); |
||
35098 | case attr::Availability: |
||
35099 | return cast<AvailabilityAttr>(this)->printPretty(OS, Policy); |
||
35100 | case attr::BPFPreserveAccessIndex: |
||
35101 | return cast<BPFPreserveAccessIndexAttr>(this)->printPretty(OS, Policy); |
||
35102 | case attr::BTFDeclTag: |
||
35103 | return cast<BTFDeclTagAttr>(this)->printPretty(OS, Policy); |
||
35104 | case attr::BTFTypeTag: |
||
35105 | return cast<BTFTypeTagAttr>(this)->printPretty(OS, Policy); |
||
35106 | case attr::Blocks: |
||
35107 | return cast<BlocksAttr>(this)->printPretty(OS, Policy); |
||
35108 | case attr::Builtin: |
||
35109 | return cast<BuiltinAttr>(this)->printPretty(OS, Policy); |
||
35110 | case attr::BuiltinAlias: |
||
35111 | return cast<BuiltinAliasAttr>(this)->printPretty(OS, Policy); |
||
35112 | case attr::C11NoReturn: |
||
35113 | return cast<C11NoReturnAttr>(this)->printPretty(OS, Policy); |
||
35114 | case attr::CDecl: |
||
35115 | return cast<CDeclAttr>(this)->printPretty(OS, Policy); |
||
35116 | case attr::CFAuditedTransfer: |
||
35117 | return cast<CFAuditedTransferAttr>(this)->printPretty(OS, Policy); |
||
35118 | case attr::CFConsumed: |
||
35119 | return cast<CFConsumedAttr>(this)->printPretty(OS, Policy); |
||
35120 | case attr::CFGuard: |
||
35121 | return cast<CFGuardAttr>(this)->printPretty(OS, Policy); |
||
35122 | case attr::CFICanonicalJumpTable: |
||
35123 | return cast<CFICanonicalJumpTableAttr>(this)->printPretty(OS, Policy); |
||
35124 | case attr::CFReturnsNotRetained: |
||
35125 | return cast<CFReturnsNotRetainedAttr>(this)->printPretty(OS, Policy); |
||
35126 | case attr::CFReturnsRetained: |
||
35127 | return cast<CFReturnsRetainedAttr>(this)->printPretty(OS, Policy); |
||
35128 | case attr::CFUnknownTransfer: |
||
35129 | return cast<CFUnknownTransferAttr>(this)->printPretty(OS, Policy); |
||
35130 | case attr::CPUDispatch: |
||
35131 | return cast<CPUDispatchAttr>(this)->printPretty(OS, Policy); |
||
35132 | case attr::CPUSpecific: |
||
35133 | return cast<CPUSpecificAttr>(this)->printPretty(OS, Policy); |
||
35134 | case attr::CUDAConstant: |
||
35135 | return cast<CUDAConstantAttr>(this)->printPretty(OS, Policy); |
||
35136 | case attr::CUDADevice: |
||
35137 | return cast<CUDADeviceAttr>(this)->printPretty(OS, Policy); |
||
35138 | case attr::CUDADeviceBuiltinSurfaceType: |
||
35139 | return cast<CUDADeviceBuiltinSurfaceTypeAttr>(this)->printPretty(OS, Policy); |
||
35140 | case attr::CUDADeviceBuiltinTextureType: |
||
35141 | return cast<CUDADeviceBuiltinTextureTypeAttr>(this)->printPretty(OS, Policy); |
||
35142 | case attr::CUDAGlobal: |
||
35143 | return cast<CUDAGlobalAttr>(this)->printPretty(OS, Policy); |
||
35144 | case attr::CUDAHost: |
||
35145 | return cast<CUDAHostAttr>(this)->printPretty(OS, Policy); |
||
35146 | case attr::CUDAInvalidTarget: |
||
35147 | return cast<CUDAInvalidTargetAttr>(this)->printPretty(OS, Policy); |
||
35148 | case attr::CUDALaunchBounds: |
||
35149 | return cast<CUDALaunchBoundsAttr>(this)->printPretty(OS, Policy); |
||
35150 | case attr::CUDAShared: |
||
35151 | return cast<CUDASharedAttr>(this)->printPretty(OS, Policy); |
||
35152 | case attr::CXX11NoReturn: |
||
35153 | return cast<CXX11NoReturnAttr>(this)->printPretty(OS, Policy); |
||
35154 | case attr::CallableWhen: |
||
35155 | return cast<CallableWhenAttr>(this)->printPretty(OS, Policy); |
||
35156 | case attr::Callback: |
||
35157 | return cast<CallbackAttr>(this)->printPretty(OS, Policy); |
||
35158 | case attr::CalledOnce: |
||
35159 | return cast<CalledOnceAttr>(this)->printPretty(OS, Policy); |
||
35160 | case attr::Capability: |
||
35161 | return cast<CapabilityAttr>(this)->printPretty(OS, Policy); |
||
35162 | case attr::CapturedRecord: |
||
35163 | return cast<CapturedRecordAttr>(this)->printPretty(OS, Policy); |
||
35164 | case attr::CarriesDependency: |
||
35165 | return cast<CarriesDependencyAttr>(this)->printPretty(OS, Policy); |
||
35166 | case attr::Cleanup: |
||
35167 | return cast<CleanupAttr>(this)->printPretty(OS, Policy); |
||
35168 | case attr::CmseNSCall: |
||
35169 | return cast<CmseNSCallAttr>(this)->printPretty(OS, Policy); |
||
35170 | case attr::CmseNSEntry: |
||
35171 | return cast<CmseNSEntryAttr>(this)->printPretty(OS, Policy); |
||
35172 | case attr::CodeSeg: |
||
35173 | return cast<CodeSegAttr>(this)->printPretty(OS, Policy); |
||
35174 | case attr::Cold: |
||
35175 | return cast<ColdAttr>(this)->printPretty(OS, Policy); |
||
35176 | case attr::Common: |
||
35177 | return cast<CommonAttr>(this)->printPretty(OS, Policy); |
||
35178 | case attr::Const: |
||
35179 | return cast<ConstAttr>(this)->printPretty(OS, Policy); |
||
35180 | case attr::ConstInit: |
||
35181 | return cast<ConstInitAttr>(this)->printPretty(OS, Policy); |
||
35182 | case attr::Constructor: |
||
35183 | return cast<ConstructorAttr>(this)->printPretty(OS, Policy); |
||
35184 | case attr::Consumable: |
||
35185 | return cast<ConsumableAttr>(this)->printPretty(OS, Policy); |
||
35186 | case attr::ConsumableAutoCast: |
||
35187 | return cast<ConsumableAutoCastAttr>(this)->printPretty(OS, Policy); |
||
35188 | case attr::ConsumableSetOnRead: |
||
35189 | return cast<ConsumableSetOnReadAttr>(this)->printPretty(OS, Policy); |
||
35190 | case attr::Convergent: |
||
35191 | return cast<ConvergentAttr>(this)->printPretty(OS, Policy); |
||
35192 | case attr::DLLExport: |
||
35193 | return cast<DLLExportAttr>(this)->printPretty(OS, Policy); |
||
35194 | case attr::DLLExportStaticLocal: |
||
35195 | return cast<DLLExportStaticLocalAttr>(this)->printPretty(OS, Policy); |
||
35196 | case attr::DLLImport: |
||
35197 | return cast<DLLImportAttr>(this)->printPretty(OS, Policy); |
||
35198 | case attr::DLLImportStaticLocal: |
||
35199 | return cast<DLLImportStaticLocalAttr>(this)->printPretty(OS, Policy); |
||
35200 | case attr::Deprecated: |
||
35201 | return cast<DeprecatedAttr>(this)->printPretty(OS, Policy); |
||
35202 | case attr::Destructor: |
||
35203 | return cast<DestructorAttr>(this)->printPretty(OS, Policy); |
||
35204 | case attr::DiagnoseAsBuiltin: |
||
35205 | return cast<DiagnoseAsBuiltinAttr>(this)->printPretty(OS, Policy); |
||
35206 | case attr::DiagnoseIf: |
||
35207 | return cast<DiagnoseIfAttr>(this)->printPretty(OS, Policy); |
||
35208 | case attr::DisableSanitizerInstrumentation: |
||
35209 | return cast<DisableSanitizerInstrumentationAttr>(this)->printPretty(OS, Policy); |
||
35210 | case attr::DisableTailCalls: |
||
35211 | return cast<DisableTailCallsAttr>(this)->printPretty(OS, Policy); |
||
35212 | case attr::EmptyBases: |
||
35213 | return cast<EmptyBasesAttr>(this)->printPretty(OS, Policy); |
||
35214 | case attr::EnableIf: |
||
35215 | return cast<EnableIfAttr>(this)->printPretty(OS, Policy); |
||
35216 | case attr::EnforceTCB: |
||
35217 | return cast<EnforceTCBAttr>(this)->printPretty(OS, Policy); |
||
35218 | case attr::EnforceTCBLeaf: |
||
35219 | return cast<EnforceTCBLeafAttr>(this)->printPretty(OS, Policy); |
||
35220 | case attr::EnumExtensibility: |
||
35221 | return cast<EnumExtensibilityAttr>(this)->printPretty(OS, Policy); |
||
35222 | case attr::Error: |
||
35223 | return cast<ErrorAttr>(this)->printPretty(OS, Policy); |
||
35224 | case attr::ExcludeFromExplicitInstantiation: |
||
35225 | return cast<ExcludeFromExplicitInstantiationAttr>(this)->printPretty(OS, Policy); |
||
35226 | case attr::ExclusiveTrylockFunction: |
||
35227 | return cast<ExclusiveTrylockFunctionAttr>(this)->printPretty(OS, Policy); |
||
35228 | case attr::ExternalSourceSymbol: |
||
35229 | return cast<ExternalSourceSymbolAttr>(this)->printPretty(OS, Policy); |
||
35230 | case attr::FallThrough: |
||
35231 | return cast<FallThroughAttr>(this)->printPretty(OS, Policy); |
||
35232 | case attr::FastCall: |
||
35233 | return cast<FastCallAttr>(this)->printPretty(OS, Policy); |
||
35234 | case attr::Final: |
||
35235 | return cast<FinalAttr>(this)->printPretty(OS, Policy); |
||
35236 | case attr::FlagEnum: |
||
35237 | return cast<FlagEnumAttr>(this)->printPretty(OS, Policy); |
||
35238 | case attr::Flatten: |
||
35239 | return cast<FlattenAttr>(this)->printPretty(OS, Policy); |
||
35240 | case attr::Format: |
||
35241 | return cast<FormatAttr>(this)->printPretty(OS, Policy); |
||
35242 | case attr::FormatArg: |
||
35243 | return cast<FormatArgAttr>(this)->printPretty(OS, Policy); |
||
35244 | case attr::FunctionReturnThunks: |
||
35245 | return cast<FunctionReturnThunksAttr>(this)->printPretty(OS, Policy); |
||
35246 | case attr::GNUInline: |
||
35247 | return cast<GNUInlineAttr>(this)->printPretty(OS, Policy); |
||
35248 | case attr::GuardedBy: |
||
35249 | return cast<GuardedByAttr>(this)->printPretty(OS, Policy); |
||
35250 | case attr::GuardedVar: |
||
35251 | return cast<GuardedVarAttr>(this)->printPretty(OS, Policy); |
||
35252 | case attr::HIPManaged: |
||
35253 | return cast<HIPManagedAttr>(this)->printPretty(OS, Policy); |
||
35254 | case attr::HLSLGroupSharedAddressSpace: |
||
35255 | return cast<HLSLGroupSharedAddressSpaceAttr>(this)->printPretty(OS, Policy); |
||
35256 | case attr::HLSLNumThreads: |
||
35257 | return cast<HLSLNumThreadsAttr>(this)->printPretty(OS, Policy); |
||
35258 | case attr::HLSLResource: |
||
35259 | return cast<HLSLResourceAttr>(this)->printPretty(OS, Policy); |
||
35260 | case attr::HLSLResourceBinding: |
||
35261 | return cast<HLSLResourceBindingAttr>(this)->printPretty(OS, Policy); |
||
35262 | case attr::HLSLSV_DispatchThreadID: |
||
35263 | return cast<HLSLSV_DispatchThreadIDAttr>(this)->printPretty(OS, Policy); |
||
35264 | case attr::HLSLSV_GroupIndex: |
||
35265 | return cast<HLSLSV_GroupIndexAttr>(this)->printPretty(OS, Policy); |
||
35266 | case attr::HLSLShader: |
||
35267 | return cast<HLSLShaderAttr>(this)->printPretty(OS, Policy); |
||
35268 | case attr::Hot: |
||
35269 | return cast<HotAttr>(this)->printPretty(OS, Policy); |
||
35270 | case attr::IBAction: |
||
35271 | return cast<IBActionAttr>(this)->printPretty(OS, Policy); |
||
35272 | case attr::IBOutlet: |
||
35273 | return cast<IBOutletAttr>(this)->printPretty(OS, Policy); |
||
35274 | case attr::IBOutletCollection: |
||
35275 | return cast<IBOutletCollectionAttr>(this)->printPretty(OS, Policy); |
||
35276 | case attr::IFunc: |
||
35277 | return cast<IFuncAttr>(this)->printPretty(OS, Policy); |
||
35278 | case attr::InitPriority: |
||
35279 | return cast<InitPriorityAttr>(this)->printPretty(OS, Policy); |
||
35280 | case attr::InitSeg: |
||
35281 | return cast<InitSegAttr>(this)->printPretty(OS, Policy); |
||
35282 | case attr::IntelOclBicc: |
||
35283 | return cast<IntelOclBiccAttr>(this)->printPretty(OS, Policy); |
||
35284 | case attr::InternalLinkage: |
||
35285 | return cast<InternalLinkageAttr>(this)->printPretty(OS, Policy); |
||
35286 | case attr::LTOVisibilityPublic: |
||
35287 | return cast<LTOVisibilityPublicAttr>(this)->printPretty(OS, Policy); |
||
35288 | case attr::LayoutVersion: |
||
35289 | return cast<LayoutVersionAttr>(this)->printPretty(OS, Policy); |
||
35290 | case attr::Leaf: |
||
35291 | return cast<LeafAttr>(this)->printPretty(OS, Policy); |
||
35292 | case attr::LifetimeBound: |
||
35293 | return cast<LifetimeBoundAttr>(this)->printPretty(OS, Policy); |
||
35294 | case attr::Likely: |
||
35295 | return cast<LikelyAttr>(this)->printPretty(OS, Policy); |
||
35296 | case attr::LoaderUninitialized: |
||
35297 | return cast<LoaderUninitializedAttr>(this)->printPretty(OS, Policy); |
||
35298 | case attr::LockReturned: |
||
35299 | return cast<LockReturnedAttr>(this)->printPretty(OS, Policy); |
||
35300 | case attr::LocksExcluded: |
||
35301 | return cast<LocksExcludedAttr>(this)->printPretty(OS, Policy); |
||
35302 | case attr::LoopHint: |
||
35303 | return cast<LoopHintAttr>(this)->printPretty(OS, Policy); |
||
35304 | case attr::M68kInterrupt: |
||
35305 | return cast<M68kInterruptAttr>(this)->printPretty(OS, Policy); |
||
35306 | case attr::MIGServerRoutine: |
||
35307 | return cast<MIGServerRoutineAttr>(this)->printPretty(OS, Policy); |
||
35308 | case attr::MSABI: |
||
35309 | return cast<MSABIAttr>(this)->printPretty(OS, Policy); |
||
35310 | case attr::MSAllocator: |
||
35311 | return cast<MSAllocatorAttr>(this)->printPretty(OS, Policy); |
||
35312 | case attr::MSInheritance: |
||
35313 | return cast<MSInheritanceAttr>(this)->printPretty(OS, Policy); |
||
35314 | case attr::MSNoVTable: |
||
35315 | return cast<MSNoVTableAttr>(this)->printPretty(OS, Policy); |
||
35316 | case attr::MSP430Interrupt: |
||
35317 | return cast<MSP430InterruptAttr>(this)->printPretty(OS, Policy); |
||
35318 | case attr::MSStruct: |
||
35319 | return cast<MSStructAttr>(this)->printPretty(OS, Policy); |
||
35320 | case attr::MSVtorDisp: |
||
35321 | return cast<MSVtorDispAttr>(this)->printPretty(OS, Policy); |
||
35322 | case attr::MaxFieldAlignment: |
||
35323 | return cast<MaxFieldAlignmentAttr>(this)->printPretty(OS, Policy); |
||
35324 | case attr::MayAlias: |
||
35325 | return cast<MayAliasAttr>(this)->printPretty(OS, Policy); |
||
35326 | case attr::MaybeUndef: |
||
35327 | return cast<MaybeUndefAttr>(this)->printPretty(OS, Policy); |
||
35328 | case attr::MicroMips: |
||
35329 | return cast<MicroMipsAttr>(this)->printPretty(OS, Policy); |
||
35330 | case attr::MinSize: |
||
35331 | return cast<MinSizeAttr>(this)->printPretty(OS, Policy); |
||
35332 | case attr::MinVectorWidth: |
||
35333 | return cast<MinVectorWidthAttr>(this)->printPretty(OS, Policy); |
||
35334 | case attr::Mips16: |
||
35335 | return cast<Mips16Attr>(this)->printPretty(OS, Policy); |
||
35336 | case attr::MipsInterrupt: |
||
35337 | return cast<MipsInterruptAttr>(this)->printPretty(OS, Policy); |
||
35338 | case attr::MipsLongCall: |
||
35339 | return cast<MipsLongCallAttr>(this)->printPretty(OS, Policy); |
||
35340 | case attr::MipsShortCall: |
||
35341 | return cast<MipsShortCallAttr>(this)->printPretty(OS, Policy); |
||
35342 | case attr::Mode: |
||
35343 | return cast<ModeAttr>(this)->printPretty(OS, Policy); |
||
35344 | case attr::MustTail: |
||
35345 | return cast<MustTailAttr>(this)->printPretty(OS, Policy); |
||
35346 | case attr::NSConsumed: |
||
35347 | return cast<NSConsumedAttr>(this)->printPretty(OS, Policy); |
||
35348 | case attr::NSConsumesSelf: |
||
35349 | return cast<NSConsumesSelfAttr>(this)->printPretty(OS, Policy); |
||
35350 | case attr::NSErrorDomain: |
||
35351 | return cast<NSErrorDomainAttr>(this)->printPretty(OS, Policy); |
||
35352 | case attr::NSReturnsAutoreleased: |
||
35353 | return cast<NSReturnsAutoreleasedAttr>(this)->printPretty(OS, Policy); |
||
35354 | case attr::NSReturnsNotRetained: |
||
35355 | return cast<NSReturnsNotRetainedAttr>(this)->printPretty(OS, Policy); |
||
35356 | case attr::NSReturnsRetained: |
||
35357 | return cast<NSReturnsRetainedAttr>(this)->printPretty(OS, Policy); |
||
35358 | case attr::Naked: |
||
35359 | return cast<NakedAttr>(this)->printPretty(OS, Policy); |
||
35360 | case attr::NoAlias: |
||
35361 | return cast<NoAliasAttr>(this)->printPretty(OS, Policy); |
||
35362 | case attr::NoBuiltin: |
||
35363 | return cast<NoBuiltinAttr>(this)->printPretty(OS, Policy); |
||
35364 | case attr::NoCommon: |
||
35365 | return cast<NoCommonAttr>(this)->printPretty(OS, Policy); |
||
35366 | case attr::NoDebug: |
||
35367 | return cast<NoDebugAttr>(this)->printPretty(OS, Policy); |
||
35368 | case attr::NoDeref: |
||
35369 | return cast<NoDerefAttr>(this)->printPretty(OS, Policy); |
||
35370 | case attr::NoDestroy: |
||
35371 | return cast<NoDestroyAttr>(this)->printPretty(OS, Policy); |
||
35372 | case attr::NoDuplicate: |
||
35373 | return cast<NoDuplicateAttr>(this)->printPretty(OS, Policy); |
||
35374 | case attr::NoEscape: |
||
35375 | return cast<NoEscapeAttr>(this)->printPretty(OS, Policy); |
||
35376 | case attr::NoInline: |
||
35377 | return cast<NoInlineAttr>(this)->printPretty(OS, Policy); |
||
35378 | case attr::NoInstrumentFunction: |
||
35379 | return cast<NoInstrumentFunctionAttr>(this)->printPretty(OS, Policy); |
||
35380 | case attr::NoMerge: |
||
35381 | return cast<NoMergeAttr>(this)->printPretty(OS, Policy); |
||
35382 | case attr::NoMicroMips: |
||
35383 | return cast<NoMicroMipsAttr>(this)->printPretty(OS, Policy); |
||
35384 | case attr::NoMips16: |
||
35385 | return cast<NoMips16Attr>(this)->printPretty(OS, Policy); |
||
35386 | case attr::NoProfileFunction: |
||
35387 | return cast<NoProfileFunctionAttr>(this)->printPretty(OS, Policy); |
||
35388 | case attr::NoRandomizeLayout: |
||
35389 | return cast<NoRandomizeLayoutAttr>(this)->printPretty(OS, Policy); |
||
35390 | case attr::NoReturn: |
||
35391 | return cast<NoReturnAttr>(this)->printPretty(OS, Policy); |
||
35392 | case attr::NoSanitize: |
||
35393 | return cast<NoSanitizeAttr>(this)->printPretty(OS, Policy); |
||
35394 | case attr::NoSpeculativeLoadHardening: |
||
35395 | return cast<NoSpeculativeLoadHardeningAttr>(this)->printPretty(OS, Policy); |
||
35396 | case attr::NoSplitStack: |
||
35397 | return cast<NoSplitStackAttr>(this)->printPretty(OS, Policy); |
||
35398 | case attr::NoStackProtector: |
||
35399 | return cast<NoStackProtectorAttr>(this)->printPretty(OS, Policy); |
||
35400 | case attr::NoThreadSafetyAnalysis: |
||
35401 | return cast<NoThreadSafetyAnalysisAttr>(this)->printPretty(OS, Policy); |
||
35402 | case attr::NoThrow: |
||
35403 | return cast<NoThrowAttr>(this)->printPretty(OS, Policy); |
||
35404 | case attr::NoUniqueAddress: |
||
35405 | return cast<NoUniqueAddressAttr>(this)->printPretty(OS, Policy); |
||
35406 | case attr::NoUwtable: |
||
35407 | return cast<NoUwtableAttr>(this)->printPretty(OS, Policy); |
||
35408 | case attr::NonNull: |
||
35409 | return cast<NonNullAttr>(this)->printPretty(OS, Policy); |
||
35410 | case attr::NotTailCalled: |
||
35411 | return cast<NotTailCalledAttr>(this)->printPretty(OS, Policy); |
||
35412 | case attr::OMPAllocateDecl: |
||
35413 | return cast<OMPAllocateDeclAttr>(this)->printPretty(OS, Policy); |
||
35414 | case attr::OMPCaptureKind: |
||
35415 | return cast<OMPCaptureKindAttr>(this)->printPretty(OS, Policy); |
||
35416 | case attr::OMPCaptureNoInit: |
||
35417 | return cast<OMPCaptureNoInitAttr>(this)->printPretty(OS, Policy); |
||
35418 | case attr::OMPDeclareSimdDecl: |
||
35419 | return cast<OMPDeclareSimdDeclAttr>(this)->printPretty(OS, Policy); |
||
35420 | case attr::OMPDeclareTargetDecl: |
||
35421 | return cast<OMPDeclareTargetDeclAttr>(this)->printPretty(OS, Policy); |
||
35422 | case attr::OMPDeclareVariant: |
||
35423 | return cast<OMPDeclareVariantAttr>(this)->printPretty(OS, Policy); |
||
35424 | case attr::OMPReferencedVar: |
||
35425 | return cast<OMPReferencedVarAttr>(this)->printPretty(OS, Policy); |
||
35426 | case attr::OMPThreadPrivateDecl: |
||
35427 | return cast<OMPThreadPrivateDeclAttr>(this)->printPretty(OS, Policy); |
||
35428 | case attr::OSConsumed: |
||
35429 | return cast<OSConsumedAttr>(this)->printPretty(OS, Policy); |
||
35430 | case attr::OSConsumesThis: |
||
35431 | return cast<OSConsumesThisAttr>(this)->printPretty(OS, Policy); |
||
35432 | case attr::OSReturnsNotRetained: |
||
35433 | return cast<OSReturnsNotRetainedAttr>(this)->printPretty(OS, Policy); |
||
35434 | case attr::OSReturnsRetained: |
||
35435 | return cast<OSReturnsRetainedAttr>(this)->printPretty(OS, Policy); |
||
35436 | case attr::OSReturnsRetainedOnNonZero: |
||
35437 | return cast<OSReturnsRetainedOnNonZeroAttr>(this)->printPretty(OS, Policy); |
||
35438 | case attr::OSReturnsRetainedOnZero: |
||
35439 | return cast<OSReturnsRetainedOnZeroAttr>(this)->printPretty(OS, Policy); |
||
35440 | case attr::ObjCBoxable: |
||
35441 | return cast<ObjCBoxableAttr>(this)->printPretty(OS, Policy); |
||
35442 | case attr::ObjCBridge: |
||
35443 | return cast<ObjCBridgeAttr>(this)->printPretty(OS, Policy); |
||
35444 | case attr::ObjCBridgeMutable: |
||
35445 | return cast<ObjCBridgeMutableAttr>(this)->printPretty(OS, Policy); |
||
35446 | case attr::ObjCBridgeRelated: |
||
35447 | return cast<ObjCBridgeRelatedAttr>(this)->printPretty(OS, Policy); |
||
35448 | case attr::ObjCClassStub: |
||
35449 | return cast<ObjCClassStubAttr>(this)->printPretty(OS, Policy); |
||
35450 | case attr::ObjCDesignatedInitializer: |
||
35451 | return cast<ObjCDesignatedInitializerAttr>(this)->printPretty(OS, Policy); |
||
35452 | case attr::ObjCDirect: |
||
35453 | return cast<ObjCDirectAttr>(this)->printPretty(OS, Policy); |
||
35454 | case attr::ObjCDirectMembers: |
||
35455 | return cast<ObjCDirectMembersAttr>(this)->printPretty(OS, Policy); |
||
35456 | case attr::ObjCException: |
||
35457 | return cast<ObjCExceptionAttr>(this)->printPretty(OS, Policy); |
||
35458 | case attr::ObjCExplicitProtocolImpl: |
||
35459 | return cast<ObjCExplicitProtocolImplAttr>(this)->printPretty(OS, Policy); |
||
35460 | case attr::ObjCExternallyRetained: |
||
35461 | return cast<ObjCExternallyRetainedAttr>(this)->printPretty(OS, Policy); |
||
35462 | case attr::ObjCGC: |
||
35463 | return cast<ObjCGCAttr>(this)->printPretty(OS, Policy); |
||
35464 | case attr::ObjCIndependentClass: |
||
35465 | return cast<ObjCIndependentClassAttr>(this)->printPretty(OS, Policy); |
||
35466 | case attr::ObjCInertUnsafeUnretained: |
||
35467 | return cast<ObjCInertUnsafeUnretainedAttr>(this)->printPretty(OS, Policy); |
||
35468 | case attr::ObjCKindOf: |
||
35469 | return cast<ObjCKindOfAttr>(this)->printPretty(OS, Policy); |
||
35470 | case attr::ObjCMethodFamily: |
||
35471 | return cast<ObjCMethodFamilyAttr>(this)->printPretty(OS, Policy); |
||
35472 | case attr::ObjCNSObject: |
||
35473 | return cast<ObjCNSObjectAttr>(this)->printPretty(OS, Policy); |
||
35474 | case attr::ObjCNonLazyClass: |
||
35475 | return cast<ObjCNonLazyClassAttr>(this)->printPretty(OS, Policy); |
||
35476 | case attr::ObjCNonRuntimeProtocol: |
||
35477 | return cast<ObjCNonRuntimeProtocolAttr>(this)->printPretty(OS, Policy); |
||
35478 | case attr::ObjCOwnership: |
||
35479 | return cast<ObjCOwnershipAttr>(this)->printPretty(OS, Policy); |
||
35480 | case attr::ObjCPreciseLifetime: |
||
35481 | return cast<ObjCPreciseLifetimeAttr>(this)->printPretty(OS, Policy); |
||
35482 | case attr::ObjCRequiresPropertyDefs: |
||
35483 | return cast<ObjCRequiresPropertyDefsAttr>(this)->printPretty(OS, Policy); |
||
35484 | case attr::ObjCRequiresSuper: |
||
35485 | return cast<ObjCRequiresSuperAttr>(this)->printPretty(OS, Policy); |
||
35486 | case attr::ObjCReturnsInnerPointer: |
||
35487 | return cast<ObjCReturnsInnerPointerAttr>(this)->printPretty(OS, Policy); |
||
35488 | case attr::ObjCRootClass: |
||
35489 | return cast<ObjCRootClassAttr>(this)->printPretty(OS, Policy); |
||
35490 | case attr::ObjCRuntimeName: |
||
35491 | return cast<ObjCRuntimeNameAttr>(this)->printPretty(OS, Policy); |
||
35492 | case attr::ObjCRuntimeVisible: |
||
35493 | return cast<ObjCRuntimeVisibleAttr>(this)->printPretty(OS, Policy); |
||
35494 | case attr::ObjCSubclassingRestricted: |
||
35495 | return cast<ObjCSubclassingRestrictedAttr>(this)->printPretty(OS, Policy); |
||
35496 | case attr::OpenCLAccess: |
||
35497 | return cast<OpenCLAccessAttr>(this)->printPretty(OS, Policy); |
||
35498 | case attr::OpenCLConstantAddressSpace: |
||
35499 | return cast<OpenCLConstantAddressSpaceAttr>(this)->printPretty(OS, Policy); |
||
35500 | case attr::OpenCLGenericAddressSpace: |
||
35501 | return cast<OpenCLGenericAddressSpaceAttr>(this)->printPretty(OS, Policy); |
||
35502 | case attr::OpenCLGlobalAddressSpace: |
||
35503 | return cast<OpenCLGlobalAddressSpaceAttr>(this)->printPretty(OS, Policy); |
||
35504 | case attr::OpenCLGlobalDeviceAddressSpace: |
||
35505 | return cast<OpenCLGlobalDeviceAddressSpaceAttr>(this)->printPretty(OS, Policy); |
||
35506 | case attr::OpenCLGlobalHostAddressSpace: |
||
35507 | return cast<OpenCLGlobalHostAddressSpaceAttr>(this)->printPretty(OS, Policy); |
||
35508 | case attr::OpenCLIntelReqdSubGroupSize: |
||
35509 | return cast<OpenCLIntelReqdSubGroupSizeAttr>(this)->printPretty(OS, Policy); |
||
35510 | case attr::OpenCLKernel: |
||
35511 | return cast<OpenCLKernelAttr>(this)->printPretty(OS, Policy); |
||
35512 | case attr::OpenCLLocalAddressSpace: |
||
35513 | return cast<OpenCLLocalAddressSpaceAttr>(this)->printPretty(OS, Policy); |
||
35514 | case attr::OpenCLPrivateAddressSpace: |
||
35515 | return cast<OpenCLPrivateAddressSpaceAttr>(this)->printPretty(OS, Policy); |
||
35516 | case attr::OpenCLUnrollHint: |
||
35517 | return cast<OpenCLUnrollHintAttr>(this)->printPretty(OS, Policy); |
||
35518 | case attr::OptimizeNone: |
||
35519 | return cast<OptimizeNoneAttr>(this)->printPretty(OS, Policy); |
||
35520 | case attr::Overloadable: |
||
35521 | return cast<OverloadableAttr>(this)->printPretty(OS, Policy); |
||
35522 | case attr::Override: |
||
35523 | return cast<OverrideAttr>(this)->printPretty(OS, Policy); |
||
35524 | case attr::Owner: |
||
35525 | return cast<OwnerAttr>(this)->printPretty(OS, Policy); |
||
35526 | case attr::Ownership: |
||
35527 | return cast<OwnershipAttr>(this)->printPretty(OS, Policy); |
||
35528 | case attr::Packed: |
||
35529 | return cast<PackedAttr>(this)->printPretty(OS, Policy); |
||
35530 | case attr::ParamTypestate: |
||
35531 | return cast<ParamTypestateAttr>(this)->printPretty(OS, Policy); |
||
35532 | case attr::Pascal: |
||
35533 | return cast<PascalAttr>(this)->printPretty(OS, Policy); |
||
35534 | case attr::PassObjectSize: |
||
35535 | return cast<PassObjectSizeAttr>(this)->printPretty(OS, Policy); |
||
35536 | case attr::PatchableFunctionEntry: |
||
35537 | return cast<PatchableFunctionEntryAttr>(this)->printPretty(OS, Policy); |
||
35538 | case attr::Pcs: |
||
35539 | return cast<PcsAttr>(this)->printPretty(OS, Policy); |
||
35540 | case attr::Pointer: |
||
35541 | return cast<PointerAttr>(this)->printPretty(OS, Policy); |
||
35542 | case attr::PragmaClangBSSSection: |
||
35543 | return cast<PragmaClangBSSSectionAttr>(this)->printPretty(OS, Policy); |
||
35544 | case attr::PragmaClangDataSection: |
||
35545 | return cast<PragmaClangDataSectionAttr>(this)->printPretty(OS, Policy); |
||
35546 | case attr::PragmaClangRelroSection: |
||
35547 | return cast<PragmaClangRelroSectionAttr>(this)->printPretty(OS, Policy); |
||
35548 | case attr::PragmaClangRodataSection: |
||
35549 | return cast<PragmaClangRodataSectionAttr>(this)->printPretty(OS, Policy); |
||
35550 | case attr::PragmaClangTextSection: |
||
35551 | return cast<PragmaClangTextSectionAttr>(this)->printPretty(OS, Policy); |
||
35552 | case attr::PreferredName: |
||
35553 | return cast<PreferredNameAttr>(this)->printPretty(OS, Policy); |
||
35554 | case attr::PreserveAll: |
||
35555 | return cast<PreserveAllAttr>(this)->printPretty(OS, Policy); |
||
35556 | case attr::PreserveMost: |
||
35557 | return cast<PreserveMostAttr>(this)->printPretty(OS, Policy); |
||
35558 | case attr::PtGuardedBy: |
||
35559 | return cast<PtGuardedByAttr>(this)->printPretty(OS, Policy); |
||
35560 | case attr::PtGuardedVar: |
||
35561 | return cast<PtGuardedVarAttr>(this)->printPretty(OS, Policy); |
||
35562 | case attr::Ptr32: |
||
35563 | return cast<Ptr32Attr>(this)->printPretty(OS, Policy); |
||
35564 | case attr::Ptr64: |
||
35565 | return cast<Ptr64Attr>(this)->printPretty(OS, Policy); |
||
35566 | case attr::Pure: |
||
35567 | return cast<PureAttr>(this)->printPretty(OS, Policy); |
||
35568 | case attr::RISCVInterrupt: |
||
35569 | return cast<RISCVInterruptAttr>(this)->printPretty(OS, Policy); |
||
35570 | case attr::RandomizeLayout: |
||
35571 | return cast<RandomizeLayoutAttr>(this)->printPretty(OS, Policy); |
||
35572 | case attr::ReadOnlyPlacement: |
||
35573 | return cast<ReadOnlyPlacementAttr>(this)->printPretty(OS, Policy); |
||
35574 | case attr::RegCall: |
||
35575 | return cast<RegCallAttr>(this)->printPretty(OS, Policy); |
||
35576 | case attr::Reinitializes: |
||
35577 | return cast<ReinitializesAttr>(this)->printPretty(OS, Policy); |
||
35578 | case attr::ReleaseCapability: |
||
35579 | return cast<ReleaseCapabilityAttr>(this)->printPretty(OS, Policy); |
||
35580 | case attr::ReleaseHandle: |
||
35581 | return cast<ReleaseHandleAttr>(this)->printPretty(OS, Policy); |
||
35582 | case attr::RenderScriptKernel: |
||
35583 | return cast<RenderScriptKernelAttr>(this)->printPretty(OS, Policy); |
||
35584 | case attr::ReqdWorkGroupSize: |
||
35585 | return cast<ReqdWorkGroupSizeAttr>(this)->printPretty(OS, Policy); |
||
35586 | case attr::RequiresCapability: |
||
35587 | return cast<RequiresCapabilityAttr>(this)->printPretty(OS, Policy); |
||
35588 | case attr::Restrict: |
||
35589 | return cast<RestrictAttr>(this)->printPretty(OS, Policy); |
||
35590 | case attr::Retain: |
||
35591 | return cast<RetainAttr>(this)->printPretty(OS, Policy); |
||
35592 | case attr::ReturnTypestate: |
||
35593 | return cast<ReturnTypestateAttr>(this)->printPretty(OS, Policy); |
||
35594 | case attr::ReturnsNonNull: |
||
35595 | return cast<ReturnsNonNullAttr>(this)->printPretty(OS, Policy); |
||
35596 | case attr::ReturnsTwice: |
||
35597 | return cast<ReturnsTwiceAttr>(this)->printPretty(OS, Policy); |
||
35598 | case attr::SPtr: |
||
35599 | return cast<SPtrAttr>(this)->printPretty(OS, Policy); |
||
35600 | case attr::SYCLKernel: |
||
35601 | return cast<SYCLKernelAttr>(this)->printPretty(OS, Policy); |
||
35602 | case attr::SYCLSpecialClass: |
||
35603 | return cast<SYCLSpecialClassAttr>(this)->printPretty(OS, Policy); |
||
35604 | case attr::ScopedLockable: |
||
35605 | return cast<ScopedLockableAttr>(this)->printPretty(OS, Policy); |
||
35606 | case attr::Section: |
||
35607 | return cast<SectionAttr>(this)->printPretty(OS, Policy); |
||
35608 | case attr::SelectAny: |
||
35609 | return cast<SelectAnyAttr>(this)->printPretty(OS, Policy); |
||
35610 | case attr::Sentinel: |
||
35611 | return cast<SentinelAttr>(this)->printPretty(OS, Policy); |
||
35612 | case attr::SetTypestate: |
||
35613 | return cast<SetTypestateAttr>(this)->printPretty(OS, Policy); |
||
35614 | case attr::SharedTrylockFunction: |
||
35615 | return cast<SharedTrylockFunctionAttr>(this)->printPretty(OS, Policy); |
||
35616 | case attr::SpeculativeLoadHardening: |
||
35617 | return cast<SpeculativeLoadHardeningAttr>(this)->printPretty(OS, Policy); |
||
35618 | case attr::StandaloneDebug: |
||
35619 | return cast<StandaloneDebugAttr>(this)->printPretty(OS, Policy); |
||
35620 | case attr::StdCall: |
||
35621 | return cast<StdCallAttr>(this)->printPretty(OS, Policy); |
||
35622 | case attr::StrictFP: |
||
35623 | return cast<StrictFPAttr>(this)->printPretty(OS, Policy); |
||
35624 | case attr::StrictGuardStackCheck: |
||
35625 | return cast<StrictGuardStackCheckAttr>(this)->printPretty(OS, Policy); |
||
35626 | case attr::Suppress: |
||
35627 | return cast<SuppressAttr>(this)->printPretty(OS, Policy); |
||
35628 | case attr::SwiftAsync: |
||
35629 | return cast<SwiftAsyncAttr>(this)->printPretty(OS, Policy); |
||
35630 | case attr::SwiftAsyncCall: |
||
35631 | return cast<SwiftAsyncCallAttr>(this)->printPretty(OS, Policy); |
||
35632 | case attr::SwiftAsyncContext: |
||
35633 | return cast<SwiftAsyncContextAttr>(this)->printPretty(OS, Policy); |
||
35634 | case attr::SwiftAsyncError: |
||
35635 | return cast<SwiftAsyncErrorAttr>(this)->printPretty(OS, Policy); |
||
35636 | case attr::SwiftAsyncName: |
||
35637 | return cast<SwiftAsyncNameAttr>(this)->printPretty(OS, Policy); |
||
35638 | case attr::SwiftAttr: |
||
35639 | return cast<SwiftAttrAttr>(this)->printPretty(OS, Policy); |
||
35640 | case attr::SwiftBridge: |
||
35641 | return cast<SwiftBridgeAttr>(this)->printPretty(OS, Policy); |
||
35642 | case attr::SwiftBridgedTypedef: |
||
35643 | return cast<SwiftBridgedTypedefAttr>(this)->printPretty(OS, Policy); |
||
35644 | case attr::SwiftCall: |
||
35645 | return cast<SwiftCallAttr>(this)->printPretty(OS, Policy); |
||
35646 | case attr::SwiftContext: |
||
35647 | return cast<SwiftContextAttr>(this)->printPretty(OS, Policy); |
||
35648 | case attr::SwiftError: |
||
35649 | return cast<SwiftErrorAttr>(this)->printPretty(OS, Policy); |
||
35650 | case attr::SwiftErrorResult: |
||
35651 | return cast<SwiftErrorResultAttr>(this)->printPretty(OS, Policy); |
||
35652 | case attr::SwiftIndirectResult: |
||
35653 | return cast<SwiftIndirectResultAttr>(this)->printPretty(OS, Policy); |
||
35654 | case attr::SwiftName: |
||
35655 | return cast<SwiftNameAttr>(this)->printPretty(OS, Policy); |
||
35656 | case attr::SwiftNewType: |
||
35657 | return cast<SwiftNewTypeAttr>(this)->printPretty(OS, Policy); |
||
35658 | case attr::SwiftObjCMembers: |
||
35659 | return cast<SwiftObjCMembersAttr>(this)->printPretty(OS, Policy); |
||
35660 | case attr::SwiftPrivate: |
||
35661 | return cast<SwiftPrivateAttr>(this)->printPretty(OS, Policy); |
||
35662 | case attr::SysVABI: |
||
35663 | return cast<SysVABIAttr>(this)->printPretty(OS, Policy); |
||
35664 | case attr::TLSModel: |
||
35665 | return cast<TLSModelAttr>(this)->printPretty(OS, Policy); |
||
35666 | case attr::Target: |
||
35667 | return cast<TargetAttr>(this)->printPretty(OS, Policy); |
||
35668 | case attr::TargetClones: |
||
35669 | return cast<TargetClonesAttr>(this)->printPretty(OS, Policy); |
||
35670 | case attr::TargetVersion: |
||
35671 | return cast<TargetVersionAttr>(this)->printPretty(OS, Policy); |
||
35672 | case attr::TestTypestate: |
||
35673 | return cast<TestTypestateAttr>(this)->printPretty(OS, Policy); |
||
35674 | case attr::ThisCall: |
||
35675 | return cast<ThisCallAttr>(this)->printPretty(OS, Policy); |
||
35676 | case attr::Thread: |
||
35677 | return cast<ThreadAttr>(this)->printPretty(OS, Policy); |
||
35678 | case attr::TransparentUnion: |
||
35679 | return cast<TransparentUnionAttr>(this)->printPretty(OS, Policy); |
||
35680 | case attr::TrivialABI: |
||
35681 | return cast<TrivialABIAttr>(this)->printPretty(OS, Policy); |
||
35682 | case attr::TryAcquireCapability: |
||
35683 | return cast<TryAcquireCapabilityAttr>(this)->printPretty(OS, Policy); |
||
35684 | case attr::TypeNonNull: |
||
35685 | return cast<TypeNonNullAttr>(this)->printPretty(OS, Policy); |
||
35686 | case attr::TypeNullUnspecified: |
||
35687 | return cast<TypeNullUnspecifiedAttr>(this)->printPretty(OS, Policy); |
||
35688 | case attr::TypeNullable: |
||
35689 | return cast<TypeNullableAttr>(this)->printPretty(OS, Policy); |
||
35690 | case attr::TypeNullableResult: |
||
35691 | return cast<TypeNullableResultAttr>(this)->printPretty(OS, Policy); |
||
35692 | case attr::TypeTagForDatatype: |
||
35693 | return cast<TypeTagForDatatypeAttr>(this)->printPretty(OS, Policy); |
||
35694 | case attr::TypeVisibility: |
||
35695 | return cast<TypeVisibilityAttr>(this)->printPretty(OS, Policy); |
||
35696 | case attr::UPtr: |
||
35697 | return cast<UPtrAttr>(this)->printPretty(OS, Policy); |
||
35698 | case attr::Unavailable: |
||
35699 | return cast<UnavailableAttr>(this)->printPretty(OS, Policy); |
||
35700 | case attr::Uninitialized: |
||
35701 | return cast<UninitializedAttr>(this)->printPretty(OS, Policy); |
||
35702 | case attr::Unlikely: |
||
35703 | return cast<UnlikelyAttr>(this)->printPretty(OS, Policy); |
||
35704 | case attr::Unused: |
||
35705 | return cast<UnusedAttr>(this)->printPretty(OS, Policy); |
||
35706 | case attr::UseHandle: |
||
35707 | return cast<UseHandleAttr>(this)->printPretty(OS, Policy); |
||
35708 | case attr::Used: |
||
35709 | return cast<UsedAttr>(this)->printPretty(OS, Policy); |
||
35710 | case attr::UsingIfExists: |
||
35711 | return cast<UsingIfExistsAttr>(this)->printPretty(OS, Policy); |
||
35712 | case attr::Uuid: |
||
35713 | return cast<UuidAttr>(this)->printPretty(OS, Policy); |
||
35714 | case attr::VecReturn: |
||
35715 | return cast<VecReturnAttr>(this)->printPretty(OS, Policy); |
||
35716 | case attr::VecTypeHint: |
||
35717 | return cast<VecTypeHintAttr>(this)->printPretty(OS, Policy); |
||
35718 | case attr::VectorCall: |
||
35719 | return cast<VectorCallAttr>(this)->printPretty(OS, Policy); |
||
35720 | case attr::Visibility: |
||
35721 | return cast<VisibilityAttr>(this)->printPretty(OS, Policy); |
||
35722 | case attr::WarnUnused: |
||
35723 | return cast<WarnUnusedAttr>(this)->printPretty(OS, Policy); |
||
35724 | case attr::WarnUnusedResult: |
||
35725 | return cast<WarnUnusedResultAttr>(this)->printPretty(OS, Policy); |
||
35726 | case attr::Weak: |
||
35727 | return cast<WeakAttr>(this)->printPretty(OS, Policy); |
||
35728 | case attr::WeakImport: |
||
35729 | return cast<WeakImportAttr>(this)->printPretty(OS, Policy); |
||
35730 | case attr::WeakRef: |
||
35731 | return cast<WeakRefAttr>(this)->printPretty(OS, Policy); |
||
35732 | case attr::WebAssemblyExportName: |
||
35733 | return cast<WebAssemblyExportNameAttr>(this)->printPretty(OS, Policy); |
||
35734 | case attr::WebAssemblyImportModule: |
||
35735 | return cast<WebAssemblyImportModuleAttr>(this)->printPretty(OS, Policy); |
||
35736 | case attr::WebAssemblyImportName: |
||
35737 | return cast<WebAssemblyImportNameAttr>(this)->printPretty(OS, Policy); |
||
35738 | case attr::WorkGroupSizeHint: |
||
35739 | return cast<WorkGroupSizeHintAttr>(this)->printPretty(OS, Policy); |
||
35740 | case attr::X86ForceAlignArgPointer: |
||
35741 | return cast<X86ForceAlignArgPointerAttr>(this)->printPretty(OS, Policy); |
||
35742 | case attr::XRayInstrument: |
||
35743 | return cast<XRayInstrumentAttr>(this)->printPretty(OS, Policy); |
||
35744 | case attr::XRayLogArgs: |
||
35745 | return cast<XRayLogArgsAttr>(this)->printPretty(OS, Policy); |
||
35746 | case attr::ZeroCallUsedRegs: |
||
35747 | return cast<ZeroCallUsedRegsAttr>(this)->printPretty(OS, Policy); |
||
35748 | } |
||
35749 | llvm_unreachable("Unexpected attribute kind!"); |
||
35750 | } |
||
35751 |