Warning, /include/clang/AST/AttrImpl.inc is written in an unsupported language. File is not indexed.
0001 /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
0002 |* *|
0003 |* Attribute classes' member function definitions *|
0004 |* *|
0005 |* Automatically generated file, do not edit! *|
0006 |* From: Attr.td *|
0007 |* *|
0008 \*===----------------------------------------------------------------------===*/
0009
0010 static inline void DelimitAttributeArgument(raw_ostream& OS, bool& IsFirst) {
0011 if (IsFirst) {
0012 IsFirst = false;
0013 OS << "(";
0014 } else
0015 OS << ", ";
0016 }
0017
0018 // AArch64SVEPcsAttr implementation
0019
0020 AArch64SVEPcsAttr *AArch64SVEPcsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
0021 auto *A = new (Ctx) AArch64SVEPcsAttr(Ctx, CommonInfo);
0022 A->setImplicit(true);
0023 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0024 A->setAttributeSpellingListIndex(0);
0025 return A;
0026 }
0027
0028 AArch64SVEPcsAttr *AArch64SVEPcsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
0029 auto *A = new (Ctx) AArch64SVEPcsAttr(Ctx, CommonInfo);
0030 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0031 A->setAttributeSpellingListIndex(0);
0032 return A;
0033 }
0034
0035 AArch64SVEPcsAttr *AArch64SVEPcsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
0036 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0037 switch (S) {
0038 case GNU_aarch64_sve_pcs:
0039 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0040 case CXX11_clang_aarch64_sve_pcs:
0041 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0042 case C23_clang_aarch64_sve_pcs:
0043 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0044 default:
0045 llvm_unreachable("Unknown attribute spelling!");
0046 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0047 }
0048 }());
0049 return CreateImplicit(Ctx, I);
0050 }
0051
0052 AArch64SVEPcsAttr *AArch64SVEPcsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
0053 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0054 switch (S) {
0055 case GNU_aarch64_sve_pcs:
0056 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0057 case CXX11_clang_aarch64_sve_pcs:
0058 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0059 case C23_clang_aarch64_sve_pcs:
0060 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0061 default:
0062 llvm_unreachable("Unknown attribute spelling!");
0063 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0064 }
0065 }());
0066 return Create(Ctx, I);
0067 }
0068
0069 AArch64SVEPcsAttr::AArch64SVEPcsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0070 )
0071 : InheritableAttr(Ctx, CommonInfo, attr::AArch64SVEPcs, /*IsLateParsed=*/false, false)
0072 {
0073 }
0074
0075 AArch64SVEPcsAttr *AArch64SVEPcsAttr::clone(ASTContext &C) const {
0076 auto *A = new (C) AArch64SVEPcsAttr(C, *this);
0077 A->Inherited = Inherited;
0078 A->IsPackExpansion = IsPackExpansion;
0079 A->setImplicit(Implicit);
0080 return A;
0081 }
0082
0083 void AArch64SVEPcsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
0084 bool IsFirstArgument = true; (void)IsFirstArgument;
0085 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
0086 switch (getAttributeSpellingListIndex()) {
0087 default:
0088 llvm_unreachable("Unknown attribute spelling!");
0089 break;
0090 case 0 : {
0091 OS << "__attribute__((aarch64_sve_pcs";
0092 OS << "))";
0093 break;
0094 }
0095 case 1 : {
0096 OS << "[[clang::aarch64_sve_pcs";
0097 OS << "]]";
0098 break;
0099 }
0100 case 2 : {
0101 OS << "[[clang::aarch64_sve_pcs";
0102 OS << "]]";
0103 break;
0104 }
0105 }
0106 }
0107
0108 const char *AArch64SVEPcsAttr::getSpelling() const {
0109 switch (getAttributeSpellingListIndex()) {
0110 default:
0111 llvm_unreachable("Unknown attribute spelling!");
0112 return "(No spelling)";
0113 case 0:
0114 return "aarch64_sve_pcs";
0115 case 1:
0116 return "aarch64_sve_pcs";
0117 case 2:
0118 return "aarch64_sve_pcs";
0119 }
0120 }
0121
0122
0123 // AArch64VectorPcsAttr implementation
0124
0125 AArch64VectorPcsAttr *AArch64VectorPcsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
0126 auto *A = new (Ctx) AArch64VectorPcsAttr(Ctx, CommonInfo);
0127 A->setImplicit(true);
0128 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0129 A->setAttributeSpellingListIndex(0);
0130 return A;
0131 }
0132
0133 AArch64VectorPcsAttr *AArch64VectorPcsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
0134 auto *A = new (Ctx) AArch64VectorPcsAttr(Ctx, CommonInfo);
0135 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0136 A->setAttributeSpellingListIndex(0);
0137 return A;
0138 }
0139
0140 AArch64VectorPcsAttr *AArch64VectorPcsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
0141 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0142 switch (S) {
0143 case GNU_aarch64_vector_pcs:
0144 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0145 case CXX11_clang_aarch64_vector_pcs:
0146 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0147 case C23_clang_aarch64_vector_pcs:
0148 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0149 default:
0150 llvm_unreachable("Unknown attribute spelling!");
0151 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0152 }
0153 }());
0154 return CreateImplicit(Ctx, I);
0155 }
0156
0157 AArch64VectorPcsAttr *AArch64VectorPcsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
0158 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0159 switch (S) {
0160 case GNU_aarch64_vector_pcs:
0161 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0162 case CXX11_clang_aarch64_vector_pcs:
0163 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0164 case C23_clang_aarch64_vector_pcs:
0165 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0166 default:
0167 llvm_unreachable("Unknown attribute spelling!");
0168 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0169 }
0170 }());
0171 return Create(Ctx, I);
0172 }
0173
0174 AArch64VectorPcsAttr::AArch64VectorPcsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0175 )
0176 : InheritableAttr(Ctx, CommonInfo, attr::AArch64VectorPcs, /*IsLateParsed=*/false, false)
0177 {
0178 }
0179
0180 AArch64VectorPcsAttr *AArch64VectorPcsAttr::clone(ASTContext &C) const {
0181 auto *A = new (C) AArch64VectorPcsAttr(C, *this);
0182 A->Inherited = Inherited;
0183 A->IsPackExpansion = IsPackExpansion;
0184 A->setImplicit(Implicit);
0185 return A;
0186 }
0187
0188 void AArch64VectorPcsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
0189 bool IsFirstArgument = true; (void)IsFirstArgument;
0190 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
0191 switch (getAttributeSpellingListIndex()) {
0192 default:
0193 llvm_unreachable("Unknown attribute spelling!");
0194 break;
0195 case 0 : {
0196 OS << "__attribute__((aarch64_vector_pcs";
0197 OS << "))";
0198 break;
0199 }
0200 case 1 : {
0201 OS << "[[clang::aarch64_vector_pcs";
0202 OS << "]]";
0203 break;
0204 }
0205 case 2 : {
0206 OS << "[[clang::aarch64_vector_pcs";
0207 OS << "]]";
0208 break;
0209 }
0210 }
0211 }
0212
0213 const char *AArch64VectorPcsAttr::getSpelling() const {
0214 switch (getAttributeSpellingListIndex()) {
0215 default:
0216 llvm_unreachable("Unknown attribute spelling!");
0217 return "(No spelling)";
0218 case 0:
0219 return "aarch64_vector_pcs";
0220 case 1:
0221 return "aarch64_vector_pcs";
0222 case 2:
0223 return "aarch64_vector_pcs";
0224 }
0225 }
0226
0227
0228 // AMDGPUFlatWorkGroupSizeAttr implementation
0229
0230 AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) {
0231 auto *A = new (Ctx) AMDGPUFlatWorkGroupSizeAttr(Ctx, CommonInfo, Min, Max);
0232 A->setImplicit(true);
0233 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0234 A->setAttributeSpellingListIndex(0);
0235 return A;
0236 }
0237
0238 AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) {
0239 auto *A = new (Ctx) AMDGPUFlatWorkGroupSizeAttr(Ctx, CommonInfo, Min, Max);
0240 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0241 A->setAttributeSpellingListIndex(0);
0242 return A;
0243 }
0244
0245 AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, Spelling S) {
0246 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0247 switch (S) {
0248 case GNU_amdgpu_flat_work_group_size:
0249 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_flat_work_group_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0250 case CXX11_clang_amdgpu_flat_work_group_size:
0251 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_flat_work_group_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0252 default:
0253 llvm_unreachable("Unknown attribute spelling!");
0254 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0255 }
0256 }());
0257 return CreateImplicit(Ctx, Min, Max, I);
0258 }
0259
0260 AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, Spelling S) {
0261 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0262 switch (S) {
0263 case GNU_amdgpu_flat_work_group_size:
0264 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_flat_work_group_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0265 case CXX11_clang_amdgpu_flat_work_group_size:
0266 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_flat_work_group_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0267 default:
0268 llvm_unreachable("Unknown attribute spelling!");
0269 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0270 }
0271 }());
0272 return Create(Ctx, Min, Max, I);
0273 }
0274
0275 AMDGPUFlatWorkGroupSizeAttr::AMDGPUFlatWorkGroupSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0276 , Expr * Min
0277 , Expr * Max
0278 )
0279 : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUFlatWorkGroupSize, /*IsLateParsed=*/false, false)
0280 , min(Min)
0281 , max(Max)
0282 {
0283 }
0284
0285
0286
0287
0288
0289 AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::clone(ASTContext &C) const {
0290 auto *A = new (C) AMDGPUFlatWorkGroupSizeAttr(C, *this, min, max);
0291 A->Inherited = Inherited;
0292 A->IsPackExpansion = IsPackExpansion;
0293 A->setImplicit(Implicit);
0294 return A;
0295 }
0296
0297 void AMDGPUFlatWorkGroupSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
0298 bool IsFirstArgument = true; (void)IsFirstArgument;
0299 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
0300 switch (getAttributeSpellingListIndex()) {
0301 default:
0302 llvm_unreachable("Unknown attribute spelling!");
0303 break;
0304 case 0 : {
0305 OS << "__attribute__((amdgpu_flat_work_group_size";
0306 DelimitAttributeArgument(OS, IsFirstArgument);
0307 OS << "";
0308 getMin()->printPretty(OS, nullptr, Policy);
0309 OS << "";
0310 DelimitAttributeArgument(OS, IsFirstArgument);
0311 OS << "";
0312 getMax()->printPretty(OS, nullptr, Policy);
0313 OS << "";
0314 if (!IsFirstArgument)
0315 OS << ")";
0316 OS << "))";
0317 break;
0318 }
0319 case 1 : {
0320 OS << "[[clang::amdgpu_flat_work_group_size";
0321 DelimitAttributeArgument(OS, IsFirstArgument);
0322 OS << "";
0323 getMin()->printPretty(OS, nullptr, Policy);
0324 OS << "";
0325 DelimitAttributeArgument(OS, IsFirstArgument);
0326 OS << "";
0327 getMax()->printPretty(OS, nullptr, Policy);
0328 OS << "";
0329 if (!IsFirstArgument)
0330 OS << ")";
0331 OS << "]]";
0332 break;
0333 }
0334 }
0335 }
0336
0337 const char *AMDGPUFlatWorkGroupSizeAttr::getSpelling() const {
0338 switch (getAttributeSpellingListIndex()) {
0339 default:
0340 llvm_unreachable("Unknown attribute spelling!");
0341 return "(No spelling)";
0342 case 0:
0343 return "amdgpu_flat_work_group_size";
0344 case 1:
0345 return "amdgpu_flat_work_group_size";
0346 }
0347 }
0348
0349
0350 // AMDGPUKernelCallAttr implementation
0351
0352 AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
0353 auto *A = new (Ctx) AMDGPUKernelCallAttr(Ctx, CommonInfo);
0354 A->setImplicit(true);
0355 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0356 A->setAttributeSpellingListIndex(0);
0357 return A;
0358 }
0359
0360 AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
0361 auto *A = new (Ctx) AMDGPUKernelCallAttr(Ctx, CommonInfo);
0362 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0363 A->setAttributeSpellingListIndex(0);
0364 return A;
0365 }
0366
0367 AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
0368 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0369 switch (S) {
0370 case GNU_amdgpu_kernel:
0371 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0372 case CXX11_clang_amdgpu_kernel:
0373 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0374 case C23_clang_amdgpu_kernel:
0375 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0376 default:
0377 llvm_unreachable("Unknown attribute spelling!");
0378 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0379 }
0380 }());
0381 return CreateImplicit(Ctx, I);
0382 }
0383
0384 AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
0385 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0386 switch (S) {
0387 case GNU_amdgpu_kernel:
0388 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0389 case CXX11_clang_amdgpu_kernel:
0390 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0391 case C23_clang_amdgpu_kernel:
0392 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0393 default:
0394 llvm_unreachable("Unknown attribute spelling!");
0395 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0396 }
0397 }());
0398 return Create(Ctx, I);
0399 }
0400
0401 AMDGPUKernelCallAttr::AMDGPUKernelCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0402 )
0403 : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUKernelCall, /*IsLateParsed=*/false, false)
0404 {
0405 }
0406
0407 AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::clone(ASTContext &C) const {
0408 auto *A = new (C) AMDGPUKernelCallAttr(C, *this);
0409 A->Inherited = Inherited;
0410 A->IsPackExpansion = IsPackExpansion;
0411 A->setImplicit(Implicit);
0412 return A;
0413 }
0414
0415 void AMDGPUKernelCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
0416 bool IsFirstArgument = true; (void)IsFirstArgument;
0417 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
0418 switch (getAttributeSpellingListIndex()) {
0419 default:
0420 llvm_unreachable("Unknown attribute spelling!");
0421 break;
0422 case 0 : {
0423 OS << "__attribute__((amdgpu_kernel";
0424 OS << "))";
0425 break;
0426 }
0427 case 1 : {
0428 OS << "[[clang::amdgpu_kernel";
0429 OS << "]]";
0430 break;
0431 }
0432 case 2 : {
0433 OS << "[[clang::amdgpu_kernel";
0434 OS << "]]";
0435 break;
0436 }
0437 }
0438 }
0439
0440 const char *AMDGPUKernelCallAttr::getSpelling() const {
0441 switch (getAttributeSpellingListIndex()) {
0442 default:
0443 llvm_unreachable("Unknown attribute spelling!");
0444 return "(No spelling)";
0445 case 0:
0446 return "amdgpu_kernel";
0447 case 1:
0448 return "amdgpu_kernel";
0449 case 2:
0450 return "amdgpu_kernel";
0451 }
0452 }
0453
0454
0455 // AMDGPUMaxNumWorkGroupsAttr implementation
0456
0457 AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxNumWorkGroupsX, Expr * MaxNumWorkGroupsY, Expr * MaxNumWorkGroupsZ, const AttributeCommonInfo &CommonInfo) {
0458 auto *A = new (Ctx) AMDGPUMaxNumWorkGroupsAttr(Ctx, CommonInfo, MaxNumWorkGroupsX, MaxNumWorkGroupsY, MaxNumWorkGroupsZ);
0459 A->setImplicit(true);
0460 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0461 A->setAttributeSpellingListIndex(0);
0462 return A;
0463 }
0464
0465 AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::Create(ASTContext &Ctx, Expr * MaxNumWorkGroupsX, Expr * MaxNumWorkGroupsY, Expr * MaxNumWorkGroupsZ, const AttributeCommonInfo &CommonInfo) {
0466 auto *A = new (Ctx) AMDGPUMaxNumWorkGroupsAttr(Ctx, CommonInfo, MaxNumWorkGroupsX, MaxNumWorkGroupsY, MaxNumWorkGroupsZ);
0467 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0468 A->setAttributeSpellingListIndex(0);
0469 return A;
0470 }
0471
0472 AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxNumWorkGroupsX, Expr * MaxNumWorkGroupsY, Expr * MaxNumWorkGroupsZ, SourceRange Range, Spelling S) {
0473 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0474 switch (S) {
0475 case GNU_amdgpu_max_num_work_groups:
0476 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_max_num_work_groups, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0477 case CXX11_clang_amdgpu_max_num_work_groups:
0478 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_max_num_work_groups, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0479 default:
0480 llvm_unreachable("Unknown attribute spelling!");
0481 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0482 }
0483 }());
0484 return CreateImplicit(Ctx, MaxNumWorkGroupsX, MaxNumWorkGroupsY, MaxNumWorkGroupsZ, I);
0485 }
0486
0487 AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::Create(ASTContext &Ctx, Expr * MaxNumWorkGroupsX, Expr * MaxNumWorkGroupsY, Expr * MaxNumWorkGroupsZ, SourceRange Range, Spelling S) {
0488 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0489 switch (S) {
0490 case GNU_amdgpu_max_num_work_groups:
0491 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_max_num_work_groups, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0492 case CXX11_clang_amdgpu_max_num_work_groups:
0493 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_max_num_work_groups, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0494 default:
0495 llvm_unreachable("Unknown attribute spelling!");
0496 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0497 }
0498 }());
0499 return Create(Ctx, MaxNumWorkGroupsX, MaxNumWorkGroupsY, MaxNumWorkGroupsZ, I);
0500 }
0501
0502 AMDGPUMaxNumWorkGroupsAttr::AMDGPUMaxNumWorkGroupsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0503 , Expr * MaxNumWorkGroupsX
0504 , Expr * MaxNumWorkGroupsY
0505 , Expr * MaxNumWorkGroupsZ
0506 )
0507 : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUMaxNumWorkGroups, /*IsLateParsed=*/false, false)
0508 , maxNumWorkGroupsX(MaxNumWorkGroupsX)
0509 , maxNumWorkGroupsY(MaxNumWorkGroupsY)
0510 , maxNumWorkGroupsZ(MaxNumWorkGroupsZ)
0511 {
0512 }
0513
0514 AMDGPUMaxNumWorkGroupsAttr::AMDGPUMaxNumWorkGroupsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0515 , Expr * MaxNumWorkGroupsX
0516 )
0517 : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUMaxNumWorkGroups, /*IsLateParsed=*/false, false)
0518 , maxNumWorkGroupsX(MaxNumWorkGroupsX)
0519 , maxNumWorkGroupsY()
0520 , maxNumWorkGroupsZ()
0521 {
0522 }
0523
0524
0525
0526
0527
0528
0529
0530 AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::clone(ASTContext &C) const {
0531 auto *A = new (C) AMDGPUMaxNumWorkGroupsAttr(C, *this, maxNumWorkGroupsX, maxNumWorkGroupsY, maxNumWorkGroupsZ);
0532 A->Inherited = Inherited;
0533 A->IsPackExpansion = IsPackExpansion;
0534 A->setImplicit(Implicit);
0535 return A;
0536 }
0537
0538 void AMDGPUMaxNumWorkGroupsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
0539 bool IsFirstArgument = true; (void)IsFirstArgument;
0540 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
0541 switch (getAttributeSpellingListIndex()) {
0542 default:
0543 llvm_unreachable("Unknown attribute spelling!");
0544 break;
0545 case 0 : {
0546 OS << "__attribute__((amdgpu_max_num_work_groups";
0547 if (!getMaxNumWorkGroupsZ())
0548 ++TrailingOmittedArgs;
0549 if (!getMaxNumWorkGroupsY())
0550 ++TrailingOmittedArgs;
0551 DelimitAttributeArgument(OS, IsFirstArgument);
0552 OS << "";
0553 getMaxNumWorkGroupsX()->printPretty(OS, nullptr, Policy);
0554 OS << "";
0555 if (!(!getMaxNumWorkGroupsY())) {
0556 DelimitAttributeArgument(OS, IsFirstArgument);
0557 OS << "";
0558 getMaxNumWorkGroupsY()->printPretty(OS, nullptr, Policy);
0559 OS << "";
0560 }
0561 if (!(!getMaxNumWorkGroupsZ())) {
0562 DelimitAttributeArgument(OS, IsFirstArgument);
0563 OS << "";
0564 getMaxNumWorkGroupsZ()->printPretty(OS, nullptr, Policy);
0565 OS << "";
0566 }
0567 if (!IsFirstArgument)
0568 OS << ")";
0569 OS << "))";
0570 break;
0571 }
0572 case 1 : {
0573 OS << "[[clang::amdgpu_max_num_work_groups";
0574 if (!getMaxNumWorkGroupsZ())
0575 ++TrailingOmittedArgs;
0576 if (!getMaxNumWorkGroupsY())
0577 ++TrailingOmittedArgs;
0578 DelimitAttributeArgument(OS, IsFirstArgument);
0579 OS << "";
0580 getMaxNumWorkGroupsX()->printPretty(OS, nullptr, Policy);
0581 OS << "";
0582 if (!(!getMaxNumWorkGroupsY())) {
0583 DelimitAttributeArgument(OS, IsFirstArgument);
0584 OS << "";
0585 getMaxNumWorkGroupsY()->printPretty(OS, nullptr, Policy);
0586 OS << "";
0587 }
0588 if (!(!getMaxNumWorkGroupsZ())) {
0589 DelimitAttributeArgument(OS, IsFirstArgument);
0590 OS << "";
0591 getMaxNumWorkGroupsZ()->printPretty(OS, nullptr, Policy);
0592 OS << "";
0593 }
0594 if (!IsFirstArgument)
0595 OS << ")";
0596 OS << "]]";
0597 break;
0598 }
0599 }
0600 }
0601
0602 const char *AMDGPUMaxNumWorkGroupsAttr::getSpelling() const {
0603 switch (getAttributeSpellingListIndex()) {
0604 default:
0605 llvm_unreachable("Unknown attribute spelling!");
0606 return "(No spelling)";
0607 case 0:
0608 return "amdgpu_max_num_work_groups";
0609 case 1:
0610 return "amdgpu_max_num_work_groups";
0611 }
0612 }
0613
0614
0615 // AMDGPUNumSGPRAttr implementation
0616
0617 AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumSGPR, const AttributeCommonInfo &CommonInfo) {
0618 auto *A = new (Ctx) AMDGPUNumSGPRAttr(Ctx, CommonInfo, NumSGPR);
0619 A->setImplicit(true);
0620 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0621 A->setAttributeSpellingListIndex(0);
0622 return A;
0623 }
0624
0625 AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::Create(ASTContext &Ctx, unsigned NumSGPR, const AttributeCommonInfo &CommonInfo) {
0626 auto *A = new (Ctx) AMDGPUNumSGPRAttr(Ctx, CommonInfo, NumSGPR);
0627 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0628 A->setAttributeSpellingListIndex(0);
0629 return A;
0630 }
0631
0632 AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumSGPR, SourceRange Range, Spelling S) {
0633 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0634 switch (S) {
0635 case GNU_amdgpu_num_sgpr:
0636 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_num_sgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0637 case CXX11_clang_amdgpu_num_sgpr:
0638 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_num_sgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0639 default:
0640 llvm_unreachable("Unknown attribute spelling!");
0641 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0642 }
0643 }());
0644 return CreateImplicit(Ctx, NumSGPR, I);
0645 }
0646
0647 AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::Create(ASTContext &Ctx, unsigned NumSGPR, SourceRange Range, Spelling S) {
0648 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0649 switch (S) {
0650 case GNU_amdgpu_num_sgpr:
0651 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_num_sgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0652 case CXX11_clang_amdgpu_num_sgpr:
0653 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_num_sgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0654 default:
0655 llvm_unreachable("Unknown attribute spelling!");
0656 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0657 }
0658 }());
0659 return Create(Ctx, NumSGPR, I);
0660 }
0661
0662 AMDGPUNumSGPRAttr::AMDGPUNumSGPRAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0663 , unsigned NumSGPR
0664 )
0665 : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUNumSGPR, /*IsLateParsed=*/false, false)
0666 , numSGPR(NumSGPR)
0667 {
0668 }
0669
0670
0671
0672 AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::clone(ASTContext &C) const {
0673 auto *A = new (C) AMDGPUNumSGPRAttr(C, *this, numSGPR);
0674 A->Inherited = Inherited;
0675 A->IsPackExpansion = IsPackExpansion;
0676 A->setImplicit(Implicit);
0677 return A;
0678 }
0679
0680 void AMDGPUNumSGPRAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
0681 bool IsFirstArgument = true; (void)IsFirstArgument;
0682 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
0683 switch (getAttributeSpellingListIndex()) {
0684 default:
0685 llvm_unreachable("Unknown attribute spelling!");
0686 break;
0687 case 0 : {
0688 OS << "__attribute__((amdgpu_num_sgpr";
0689 DelimitAttributeArgument(OS, IsFirstArgument);
0690 OS << "" << getNumSGPR() << "";
0691 if (!IsFirstArgument)
0692 OS << ")";
0693 OS << "))";
0694 break;
0695 }
0696 case 1 : {
0697 OS << "[[clang::amdgpu_num_sgpr";
0698 DelimitAttributeArgument(OS, IsFirstArgument);
0699 OS << "" << getNumSGPR() << "";
0700 if (!IsFirstArgument)
0701 OS << ")";
0702 OS << "]]";
0703 break;
0704 }
0705 }
0706 }
0707
0708 const char *AMDGPUNumSGPRAttr::getSpelling() const {
0709 switch (getAttributeSpellingListIndex()) {
0710 default:
0711 llvm_unreachable("Unknown attribute spelling!");
0712 return "(No spelling)";
0713 case 0:
0714 return "amdgpu_num_sgpr";
0715 case 1:
0716 return "amdgpu_num_sgpr";
0717 }
0718 }
0719
0720
0721 // AMDGPUNumVGPRAttr implementation
0722
0723 AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumVGPR, const AttributeCommonInfo &CommonInfo) {
0724 auto *A = new (Ctx) AMDGPUNumVGPRAttr(Ctx, CommonInfo, NumVGPR);
0725 A->setImplicit(true);
0726 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0727 A->setAttributeSpellingListIndex(0);
0728 return A;
0729 }
0730
0731 AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::Create(ASTContext &Ctx, unsigned NumVGPR, const AttributeCommonInfo &CommonInfo) {
0732 auto *A = new (Ctx) AMDGPUNumVGPRAttr(Ctx, CommonInfo, NumVGPR);
0733 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0734 A->setAttributeSpellingListIndex(0);
0735 return A;
0736 }
0737
0738 AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumVGPR, SourceRange Range, Spelling S) {
0739 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0740 switch (S) {
0741 case GNU_amdgpu_num_vgpr:
0742 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_num_vgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0743 case CXX11_clang_amdgpu_num_vgpr:
0744 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_num_vgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0745 default:
0746 llvm_unreachable("Unknown attribute spelling!");
0747 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0748 }
0749 }());
0750 return CreateImplicit(Ctx, NumVGPR, I);
0751 }
0752
0753 AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::Create(ASTContext &Ctx, unsigned NumVGPR, SourceRange Range, Spelling S) {
0754 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0755 switch (S) {
0756 case GNU_amdgpu_num_vgpr:
0757 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_num_vgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0758 case CXX11_clang_amdgpu_num_vgpr:
0759 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_num_vgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0760 default:
0761 llvm_unreachable("Unknown attribute spelling!");
0762 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0763 }
0764 }());
0765 return Create(Ctx, NumVGPR, I);
0766 }
0767
0768 AMDGPUNumVGPRAttr::AMDGPUNumVGPRAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0769 , unsigned NumVGPR
0770 )
0771 : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUNumVGPR, /*IsLateParsed=*/false, false)
0772 , numVGPR(NumVGPR)
0773 {
0774 }
0775
0776
0777
0778 AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::clone(ASTContext &C) const {
0779 auto *A = new (C) AMDGPUNumVGPRAttr(C, *this, numVGPR);
0780 A->Inherited = Inherited;
0781 A->IsPackExpansion = IsPackExpansion;
0782 A->setImplicit(Implicit);
0783 return A;
0784 }
0785
0786 void AMDGPUNumVGPRAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
0787 bool IsFirstArgument = true; (void)IsFirstArgument;
0788 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
0789 switch (getAttributeSpellingListIndex()) {
0790 default:
0791 llvm_unreachable("Unknown attribute spelling!");
0792 break;
0793 case 0 : {
0794 OS << "__attribute__((amdgpu_num_vgpr";
0795 DelimitAttributeArgument(OS, IsFirstArgument);
0796 OS << "" << getNumVGPR() << "";
0797 if (!IsFirstArgument)
0798 OS << ")";
0799 OS << "))";
0800 break;
0801 }
0802 case 1 : {
0803 OS << "[[clang::amdgpu_num_vgpr";
0804 DelimitAttributeArgument(OS, IsFirstArgument);
0805 OS << "" << getNumVGPR() << "";
0806 if (!IsFirstArgument)
0807 OS << ")";
0808 OS << "]]";
0809 break;
0810 }
0811 }
0812 }
0813
0814 const char *AMDGPUNumVGPRAttr::getSpelling() const {
0815 switch (getAttributeSpellingListIndex()) {
0816 default:
0817 llvm_unreachable("Unknown attribute spelling!");
0818 return "(No spelling)";
0819 case 0:
0820 return "amdgpu_num_vgpr";
0821 case 1:
0822 return "amdgpu_num_vgpr";
0823 }
0824 }
0825
0826
0827 // AMDGPUWavesPerEUAttr implementation
0828
0829 AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) {
0830 auto *A = new (Ctx) AMDGPUWavesPerEUAttr(Ctx, CommonInfo, Min, Max);
0831 A->setImplicit(true);
0832 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0833 A->setAttributeSpellingListIndex(0);
0834 return A;
0835 }
0836
0837 AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) {
0838 auto *A = new (Ctx) AMDGPUWavesPerEUAttr(Ctx, CommonInfo, Min, Max);
0839 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0840 A->setAttributeSpellingListIndex(0);
0841 return A;
0842 }
0843
0844 AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, Spelling S) {
0845 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0846 switch (S) {
0847 case GNU_amdgpu_waves_per_eu:
0848 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_waves_per_eu, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0849 case CXX11_clang_amdgpu_waves_per_eu:
0850 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_waves_per_eu, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0851 default:
0852 llvm_unreachable("Unknown attribute spelling!");
0853 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0854 }
0855 }());
0856 return CreateImplicit(Ctx, Min, Max, I);
0857 }
0858
0859 AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, Spelling S) {
0860 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0861 switch (S) {
0862 case GNU_amdgpu_waves_per_eu:
0863 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_waves_per_eu, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0864 case CXX11_clang_amdgpu_waves_per_eu:
0865 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_waves_per_eu, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0866 default:
0867 llvm_unreachable("Unknown attribute spelling!");
0868 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0869 }
0870 }());
0871 return Create(Ctx, Min, Max, I);
0872 }
0873
0874 AMDGPUWavesPerEUAttr::AMDGPUWavesPerEUAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0875 , Expr * Min
0876 , Expr * Max
0877 )
0878 : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUWavesPerEU, /*IsLateParsed=*/false, false)
0879 , min(Min)
0880 , max(Max)
0881 {
0882 }
0883
0884 AMDGPUWavesPerEUAttr::AMDGPUWavesPerEUAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
0885 , Expr * Min
0886 )
0887 : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUWavesPerEU, /*IsLateParsed=*/false, false)
0888 , min(Min)
0889 , max()
0890 {
0891 }
0892
0893
0894
0895
0896
0897 AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::clone(ASTContext &C) const {
0898 auto *A = new (C) AMDGPUWavesPerEUAttr(C, *this, min, max);
0899 A->Inherited = Inherited;
0900 A->IsPackExpansion = IsPackExpansion;
0901 A->setImplicit(Implicit);
0902 return A;
0903 }
0904
0905 void AMDGPUWavesPerEUAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
0906 bool IsFirstArgument = true; (void)IsFirstArgument;
0907 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
0908 switch (getAttributeSpellingListIndex()) {
0909 default:
0910 llvm_unreachable("Unknown attribute spelling!");
0911 break;
0912 case 0 : {
0913 OS << "__attribute__((amdgpu_waves_per_eu";
0914 if (!getMax())
0915 ++TrailingOmittedArgs;
0916 DelimitAttributeArgument(OS, IsFirstArgument);
0917 OS << "";
0918 getMin()->printPretty(OS, nullptr, Policy);
0919 OS << "";
0920 if (!(!getMax())) {
0921 DelimitAttributeArgument(OS, IsFirstArgument);
0922 OS << "";
0923 getMax()->printPretty(OS, nullptr, Policy);
0924 OS << "";
0925 }
0926 if (!IsFirstArgument)
0927 OS << ")";
0928 OS << "))";
0929 break;
0930 }
0931 case 1 : {
0932 OS << "[[clang::amdgpu_waves_per_eu";
0933 if (!getMax())
0934 ++TrailingOmittedArgs;
0935 DelimitAttributeArgument(OS, IsFirstArgument);
0936 OS << "";
0937 getMin()->printPretty(OS, nullptr, Policy);
0938 OS << "";
0939 if (!(!getMax())) {
0940 DelimitAttributeArgument(OS, IsFirstArgument);
0941 OS << "";
0942 getMax()->printPretty(OS, nullptr, Policy);
0943 OS << "";
0944 }
0945 if (!IsFirstArgument)
0946 OS << ")";
0947 OS << "]]";
0948 break;
0949 }
0950 }
0951 }
0952
0953 const char *AMDGPUWavesPerEUAttr::getSpelling() const {
0954 switch (getAttributeSpellingListIndex()) {
0955 default:
0956 llvm_unreachable("Unknown attribute spelling!");
0957 return "(No spelling)";
0958 case 0:
0959 return "amdgpu_waves_per_eu";
0960 case 1:
0961 return "amdgpu_waves_per_eu";
0962 }
0963 }
0964
0965
0966 // ARMInterruptAttr implementation
0967
0968 ARMInterruptAttr *ARMInterruptAttr::CreateImplicit(ASTContext &Ctx, ARMInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) {
0969 auto *A = new (Ctx) ARMInterruptAttr(Ctx, CommonInfo, Interrupt);
0970 A->setImplicit(true);
0971 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0972 A->setAttributeSpellingListIndex(0);
0973 return A;
0974 }
0975
0976 ARMInterruptAttr *ARMInterruptAttr::Create(ASTContext &Ctx, ARMInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) {
0977 auto *A = new (Ctx) ARMInterruptAttr(Ctx, CommonInfo, Interrupt);
0978 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
0979 A->setAttributeSpellingListIndex(0);
0980 return A;
0981 }
0982
0983 ARMInterruptAttr *ARMInterruptAttr::CreateImplicit(ASTContext &Ctx, ARMInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) {
0984 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
0985 switch (S) {
0986 case GNU_interrupt:
0987 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0988 case CXX11_gnu_interrupt:
0989 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0990 case C23_gnu_interrupt:
0991 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0992 default:
0993 llvm_unreachable("Unknown attribute spelling!");
0994 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
0995 }
0996 }());
0997 return CreateImplicit(Ctx, Interrupt, I);
0998 }
0999
1000 ARMInterruptAttr *ARMInterruptAttr::Create(ASTContext &Ctx, ARMInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) {
1001 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1002 switch (S) {
1003 case GNU_interrupt:
1004 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1005 case CXX11_gnu_interrupt:
1006 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1007 case C23_gnu_interrupt:
1008 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1009 default:
1010 llvm_unreachable("Unknown attribute spelling!");
1011 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1012 }
1013 }());
1014 return Create(Ctx, Interrupt, I);
1015 }
1016
1017 ARMInterruptAttr::ARMInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1018 , ARMInterruptAttr::InterruptType Interrupt
1019 )
1020 : InheritableAttr(Ctx, CommonInfo, attr::ARMInterrupt, /*IsLateParsed=*/false, false)
1021 , interrupt(Interrupt)
1022 {
1023 }
1024
1025 ARMInterruptAttr::ARMInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1026 )
1027 : InheritableAttr(Ctx, CommonInfo, attr::ARMInterrupt, /*IsLateParsed=*/false, false)
1028 , interrupt(ARMInterruptAttr::InterruptType(0))
1029 {
1030 }
1031
1032
1033
1034 bool ARMInterruptAttr::ConvertStrToInterruptType(StringRef Val, ARMInterruptAttr::InterruptType &Out) {
1035 std::optional<ARMInterruptAttr::InterruptType> R = llvm::StringSwitch<std::optional<ARMInterruptAttr::InterruptType>>(Val)
1036 .Case("IRQ", ARMInterruptAttr::InterruptType::IRQ)
1037 .Case("FIQ", ARMInterruptAttr::InterruptType::FIQ)
1038 .Case("SWI", ARMInterruptAttr::InterruptType::SWI)
1039 .Case("ABORT", ARMInterruptAttr::InterruptType::ABORT)
1040 .Case("UNDEF", ARMInterruptAttr::InterruptType::UNDEF)
1041 .Case("", ARMInterruptAttr::InterruptType::Generic)
1042 .Default(std::optional<ARMInterruptAttr::InterruptType>());
1043 if (R) {
1044 Out = *R;
1045 return true;
1046 }
1047 return false;
1048 }
1049
1050 const char *ARMInterruptAttr::ConvertInterruptTypeToStr(ARMInterruptAttr::InterruptType Val) {
1051 switch(Val) {
1052 case ARMInterruptAttr::InterruptType::IRQ: return "IRQ";
1053 case ARMInterruptAttr::InterruptType::FIQ: return "FIQ";
1054 case ARMInterruptAttr::InterruptType::SWI: return "SWI";
1055 case ARMInterruptAttr::InterruptType::ABORT: return "ABORT";
1056 case ARMInterruptAttr::InterruptType::UNDEF: return "UNDEF";
1057 case ARMInterruptAttr::InterruptType::Generic: return "";
1058 }
1059 llvm_unreachable("No enumerator with that value");
1060 }
1061 ARMInterruptAttr *ARMInterruptAttr::clone(ASTContext &C) const {
1062 auto *A = new (C) ARMInterruptAttr(C, *this, interrupt);
1063 A->Inherited = Inherited;
1064 A->IsPackExpansion = IsPackExpansion;
1065 A->setImplicit(Implicit);
1066 return A;
1067 }
1068
1069 void ARMInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
1070 bool IsFirstArgument = true; (void)IsFirstArgument;
1071 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
1072 switch (getAttributeSpellingListIndex()) {
1073 default:
1074 llvm_unreachable("Unknown attribute spelling!");
1075 break;
1076 case 0 : {
1077 OS << "__attribute__((interrupt";
1078 DelimitAttributeArgument(OS, IsFirstArgument);
1079 OS << "\"" << ARMInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\"";
1080 if (!IsFirstArgument)
1081 OS << ")";
1082 OS << "))";
1083 break;
1084 }
1085 case 1 : {
1086 OS << "[[gnu::interrupt";
1087 DelimitAttributeArgument(OS, IsFirstArgument);
1088 OS << "\"" << ARMInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\"";
1089 if (!IsFirstArgument)
1090 OS << ")";
1091 OS << "]]";
1092 break;
1093 }
1094 case 2 : {
1095 OS << "[[gnu::interrupt";
1096 DelimitAttributeArgument(OS, IsFirstArgument);
1097 OS << "\"" << ARMInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\"";
1098 if (!IsFirstArgument)
1099 OS << ")";
1100 OS << "]]";
1101 break;
1102 }
1103 }
1104 }
1105
1106 const char *ARMInterruptAttr::getSpelling() const {
1107 switch (getAttributeSpellingListIndex()) {
1108 default:
1109 llvm_unreachable("Unknown attribute spelling!");
1110 return "(No spelling)";
1111 case 0:
1112 return "interrupt";
1113 case 1:
1114 return "interrupt";
1115 case 2:
1116 return "interrupt";
1117 }
1118 }
1119
1120
1121 // AVRInterruptAttr implementation
1122
1123 AVRInterruptAttr *AVRInterruptAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
1124 auto *A = new (Ctx) AVRInterruptAttr(Ctx, CommonInfo);
1125 A->setImplicit(true);
1126 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1127 A->setAttributeSpellingListIndex(0);
1128 return A;
1129 }
1130
1131 AVRInterruptAttr *AVRInterruptAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
1132 auto *A = new (Ctx) AVRInterruptAttr(Ctx, CommonInfo);
1133 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1134 A->setAttributeSpellingListIndex(0);
1135 return A;
1136 }
1137
1138 AVRInterruptAttr *AVRInterruptAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
1139 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1140 switch (S) {
1141 case GNU_interrupt:
1142 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1143 case CXX11_gnu_interrupt:
1144 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1145 case C23_gnu_interrupt:
1146 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1147 default:
1148 llvm_unreachable("Unknown attribute spelling!");
1149 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1150 }
1151 }());
1152 return CreateImplicit(Ctx, I);
1153 }
1154
1155 AVRInterruptAttr *AVRInterruptAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
1156 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1157 switch (S) {
1158 case GNU_interrupt:
1159 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1160 case CXX11_gnu_interrupt:
1161 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1162 case C23_gnu_interrupt:
1163 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1164 default:
1165 llvm_unreachable("Unknown attribute spelling!");
1166 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1167 }
1168 }());
1169 return Create(Ctx, I);
1170 }
1171
1172 AVRInterruptAttr::AVRInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1173 )
1174 : InheritableAttr(Ctx, CommonInfo, attr::AVRInterrupt, /*IsLateParsed=*/false, false)
1175 {
1176 }
1177
1178 AVRInterruptAttr *AVRInterruptAttr::clone(ASTContext &C) const {
1179 auto *A = new (C) AVRInterruptAttr(C, *this);
1180 A->Inherited = Inherited;
1181 A->IsPackExpansion = IsPackExpansion;
1182 A->setImplicit(Implicit);
1183 return A;
1184 }
1185
1186 void AVRInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
1187 bool IsFirstArgument = true; (void)IsFirstArgument;
1188 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
1189 switch (getAttributeSpellingListIndex()) {
1190 default:
1191 llvm_unreachable("Unknown attribute spelling!");
1192 break;
1193 case 0 : {
1194 OS << "__attribute__((interrupt";
1195 OS << "))";
1196 break;
1197 }
1198 case 1 : {
1199 OS << "[[gnu::interrupt";
1200 OS << "]]";
1201 break;
1202 }
1203 case 2 : {
1204 OS << "[[gnu::interrupt";
1205 OS << "]]";
1206 break;
1207 }
1208 }
1209 }
1210
1211 const char *AVRInterruptAttr::getSpelling() const {
1212 switch (getAttributeSpellingListIndex()) {
1213 default:
1214 llvm_unreachable("Unknown attribute spelling!");
1215 return "(No spelling)";
1216 case 0:
1217 return "interrupt";
1218 case 1:
1219 return "interrupt";
1220 case 2:
1221 return "interrupt";
1222 }
1223 }
1224
1225
1226 // AVRSignalAttr implementation
1227
1228 AVRSignalAttr *AVRSignalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
1229 auto *A = new (Ctx) AVRSignalAttr(Ctx, CommonInfo);
1230 A->setImplicit(true);
1231 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1232 A->setAttributeSpellingListIndex(0);
1233 return A;
1234 }
1235
1236 AVRSignalAttr *AVRSignalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
1237 auto *A = new (Ctx) AVRSignalAttr(Ctx, CommonInfo);
1238 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1239 A->setAttributeSpellingListIndex(0);
1240 return A;
1241 }
1242
1243 AVRSignalAttr *AVRSignalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
1244 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1245 switch (S) {
1246 case GNU_signal:
1247 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1248 case CXX11_gnu_signal:
1249 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1250 case C23_gnu_signal:
1251 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1252 default:
1253 llvm_unreachable("Unknown attribute spelling!");
1254 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1255 }
1256 }());
1257 return CreateImplicit(Ctx, I);
1258 }
1259
1260 AVRSignalAttr *AVRSignalAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
1261 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1262 switch (S) {
1263 case GNU_signal:
1264 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1265 case CXX11_gnu_signal:
1266 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1267 case C23_gnu_signal:
1268 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1269 default:
1270 llvm_unreachable("Unknown attribute spelling!");
1271 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1272 }
1273 }());
1274 return Create(Ctx, I);
1275 }
1276
1277 AVRSignalAttr::AVRSignalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1278 )
1279 : InheritableAttr(Ctx, CommonInfo, attr::AVRSignal, /*IsLateParsed=*/false, false)
1280 {
1281 }
1282
1283 AVRSignalAttr *AVRSignalAttr::clone(ASTContext &C) const {
1284 auto *A = new (C) AVRSignalAttr(C, *this);
1285 A->Inherited = Inherited;
1286 A->IsPackExpansion = IsPackExpansion;
1287 A->setImplicit(Implicit);
1288 return A;
1289 }
1290
1291 void AVRSignalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
1292 bool IsFirstArgument = true; (void)IsFirstArgument;
1293 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
1294 switch (getAttributeSpellingListIndex()) {
1295 default:
1296 llvm_unreachable("Unknown attribute spelling!");
1297 break;
1298 case 0 : {
1299 OS << "__attribute__((signal";
1300 OS << "))";
1301 break;
1302 }
1303 case 1 : {
1304 OS << "[[gnu::signal";
1305 OS << "]]";
1306 break;
1307 }
1308 case 2 : {
1309 OS << "[[gnu::signal";
1310 OS << "]]";
1311 break;
1312 }
1313 }
1314 }
1315
1316 const char *AVRSignalAttr::getSpelling() const {
1317 switch (getAttributeSpellingListIndex()) {
1318 default:
1319 llvm_unreachable("Unknown attribute spelling!");
1320 return "(No spelling)";
1321 case 0:
1322 return "signal";
1323 case 1:
1324 return "signal";
1325 case 2:
1326 return "signal";
1327 }
1328 }
1329
1330
1331 // AbiTagAttr implementation
1332
1333 AbiTagAttr *AbiTagAttr::CreateImplicit(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, const AttributeCommonInfo &CommonInfo) {
1334 auto *A = new (Ctx) AbiTagAttr(Ctx, CommonInfo, Tags, TagsSize);
1335 A->setImplicit(true);
1336 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1337 A->setAttributeSpellingListIndex(0);
1338 return A;
1339 }
1340
1341 AbiTagAttr *AbiTagAttr::Create(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, const AttributeCommonInfo &CommonInfo) {
1342 auto *A = new (Ctx) AbiTagAttr(Ctx, CommonInfo, Tags, TagsSize);
1343 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1344 A->setAttributeSpellingListIndex(0);
1345 return A;
1346 }
1347
1348 AbiTagAttr *AbiTagAttr::CreateImplicit(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, SourceRange Range, Spelling S) {
1349 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1350 switch (S) {
1351 case GNU_abi_tag:
1352 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_abi_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1353 case CXX11_gnu_abi_tag:
1354 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_abi_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1355 default:
1356 llvm_unreachable("Unknown attribute spelling!");
1357 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1358 }
1359 }());
1360 return CreateImplicit(Ctx, Tags, TagsSize, I);
1361 }
1362
1363 AbiTagAttr *AbiTagAttr::Create(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, SourceRange Range, Spelling S) {
1364 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1365 switch (S) {
1366 case GNU_abi_tag:
1367 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_abi_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1368 case CXX11_gnu_abi_tag:
1369 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_abi_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1370 default:
1371 llvm_unreachable("Unknown attribute spelling!");
1372 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1373 }
1374 }());
1375 return Create(Ctx, Tags, TagsSize, I);
1376 }
1377
1378 AbiTagAttr::AbiTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1379 , StringRef *Tags, unsigned TagsSize
1380 )
1381 : Attr(Ctx, CommonInfo, attr::AbiTag, /*IsLateParsed=*/false)
1382 , tags_Size(TagsSize), tags_(new (Ctx, 16) StringRef[tags_Size])
1383 {
1384 for (size_t I = 0, E = tags_Size; I != E;
1385 ++I) {
1386 StringRef Ref = Tags[I];
1387 if (!Ref.empty()) {
1388 char *Mem = new (Ctx, 1) char[Ref.size()];
1389 std::memcpy(Mem, Ref.data(), Ref.size());
1390 tags_[I] = StringRef(Mem, Ref.size());
1391 }
1392 }
1393 }
1394
1395 AbiTagAttr::AbiTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1396 )
1397 : Attr(Ctx, CommonInfo, attr::AbiTag, /*IsLateParsed=*/false)
1398 , tags_Size(0), tags_(nullptr)
1399 {
1400 }
1401
1402
1403
1404 AbiTagAttr *AbiTagAttr::clone(ASTContext &C) const {
1405 auto *A = new (C) AbiTagAttr(C, *this, tags_, tags_Size);
1406 A->Inherited = Inherited;
1407 A->IsPackExpansion = IsPackExpansion;
1408 A->setImplicit(Implicit);
1409 return A;
1410 }
1411
1412 void AbiTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
1413 bool IsFirstArgument = true; (void)IsFirstArgument;
1414 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
1415 switch (getAttributeSpellingListIndex()) {
1416 default:
1417 llvm_unreachable("Unknown attribute spelling!");
1418 break;
1419 case 0 : {
1420 OS << "__attribute__((abi_tag";
1421 OS << "";
1422 for (const auto &Val : tags()) {
1423 DelimitAttributeArgument(OS, IsFirstArgument);
1424 OS << "\"" << Val << "\"";
1425 }
1426 OS << "";
1427 if (!IsFirstArgument)
1428 OS << ")";
1429 OS << "))";
1430 break;
1431 }
1432 case 1 : {
1433 OS << "[[gnu::abi_tag";
1434 OS << "";
1435 for (const auto &Val : tags()) {
1436 DelimitAttributeArgument(OS, IsFirstArgument);
1437 OS << "\"" << Val << "\"";
1438 }
1439 OS << "";
1440 if (!IsFirstArgument)
1441 OS << ")";
1442 OS << "]]";
1443 break;
1444 }
1445 }
1446 }
1447
1448 const char *AbiTagAttr::getSpelling() const {
1449 switch (getAttributeSpellingListIndex()) {
1450 default:
1451 llvm_unreachable("Unknown attribute spelling!");
1452 return "(No spelling)";
1453 case 0:
1454 return "abi_tag";
1455 case 1:
1456 return "abi_tag";
1457 }
1458 }
1459
1460
1461 // AcquireCapabilityAttr implementation
1462
1463 AcquireCapabilityAttr *AcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
1464 auto *A = new (Ctx) AcquireCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize);
1465 A->setImplicit(true);
1466 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1467 A->setAttributeSpellingListIndex(0);
1468 return A;
1469 }
1470
1471 AcquireCapabilityAttr *AcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
1472 auto *A = new (Ctx) AcquireCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize);
1473 return A;
1474 }
1475
1476 AcquireCapabilityAttr *AcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
1477 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1478 switch (S) {
1479 case GNU_acquire_capability:
1480 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1481 case CXX11_clang_acquire_capability:
1482 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1483 case GNU_acquire_shared_capability:
1484 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1485 case CXX11_clang_acquire_shared_capability:
1486 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1487 case GNU_exclusive_lock_function:
1488 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclusive_lock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1489 case GNU_shared_lock_function:
1490 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_lock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1491 default:
1492 llvm_unreachable("Unknown attribute spelling!");
1493 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1494 }
1495 }());
1496 return CreateImplicit(Ctx, Args, ArgsSize, I);
1497 }
1498
1499 AcquireCapabilityAttr *AcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
1500 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1501 switch (S) {
1502 case GNU_acquire_capability:
1503 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1504 case CXX11_clang_acquire_capability:
1505 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1506 case GNU_acquire_shared_capability:
1507 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1508 case CXX11_clang_acquire_shared_capability:
1509 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1510 case GNU_exclusive_lock_function:
1511 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclusive_lock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1512 case GNU_shared_lock_function:
1513 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_lock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1514 default:
1515 llvm_unreachable("Unknown attribute spelling!");
1516 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1517 }
1518 }());
1519 return Create(Ctx, Args, ArgsSize, I);
1520 }
1521
1522 AcquireCapabilityAttr::AcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1523 , Expr * *Args, unsigned ArgsSize
1524 )
1525 : InheritableAttr(Ctx, CommonInfo, attr::AcquireCapability, /*IsLateParsed=*/true, true)
1526 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
1527 {
1528 std::copy(Args, Args + args_Size, args_);
1529 }
1530
1531 AcquireCapabilityAttr::AcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1532 )
1533 : InheritableAttr(Ctx, CommonInfo, attr::AcquireCapability, /*IsLateParsed=*/true, true)
1534 , args_Size(0), args_(nullptr)
1535 {
1536 }
1537
1538 AcquireCapabilityAttr::Spelling AcquireCapabilityAttr::getSemanticSpelling() const {
1539 switch (getAttributeSpellingListIndex()) {
1540 default: llvm_unreachable("Unknown spelling list index");
1541 case 0: return GNU_acquire_capability;
1542 case 1: return CXX11_clang_acquire_capability;
1543 case 2: return GNU_acquire_shared_capability;
1544 case 3: return CXX11_clang_acquire_shared_capability;
1545 case 4: return GNU_exclusive_lock_function;
1546 case 5: return GNU_shared_lock_function;
1547 }
1548 }
1549
1550
1551 AcquireCapabilityAttr *AcquireCapabilityAttr::clone(ASTContext &C) const {
1552 auto *A = new (C) AcquireCapabilityAttr(C, *this, args_, args_Size);
1553 A->Inherited = Inherited;
1554 A->IsPackExpansion = IsPackExpansion;
1555 A->setImplicit(Implicit);
1556 return A;
1557 }
1558
1559 void AcquireCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
1560 bool IsFirstArgument = true; (void)IsFirstArgument;
1561 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
1562 switch (getAttributeSpellingListIndex()) {
1563 default:
1564 llvm_unreachable("Unknown attribute spelling!");
1565 break;
1566 case 0 : {
1567 OS << "__attribute__((acquire_capability";
1568 OS << "";
1569 for (const auto &Val : args()) {
1570 DelimitAttributeArgument(OS, IsFirstArgument);
1571 OS << Val;
1572 }
1573 OS << "";
1574 if (!IsFirstArgument)
1575 OS << ")";
1576 OS << "))";
1577 break;
1578 }
1579 case 1 : {
1580 OS << "[[clang::acquire_capability";
1581 OS << "";
1582 for (const auto &Val : args()) {
1583 DelimitAttributeArgument(OS, IsFirstArgument);
1584 OS << Val;
1585 }
1586 OS << "";
1587 if (!IsFirstArgument)
1588 OS << ")";
1589 OS << "]]";
1590 break;
1591 }
1592 case 2 : {
1593 OS << "__attribute__((acquire_shared_capability";
1594 OS << "";
1595 for (const auto &Val : args()) {
1596 DelimitAttributeArgument(OS, IsFirstArgument);
1597 OS << Val;
1598 }
1599 OS << "";
1600 if (!IsFirstArgument)
1601 OS << ")";
1602 OS << "))";
1603 break;
1604 }
1605 case 3 : {
1606 OS << "[[clang::acquire_shared_capability";
1607 OS << "";
1608 for (const auto &Val : args()) {
1609 DelimitAttributeArgument(OS, IsFirstArgument);
1610 OS << Val;
1611 }
1612 OS << "";
1613 if (!IsFirstArgument)
1614 OS << ")";
1615 OS << "]]";
1616 break;
1617 }
1618 case 4 : {
1619 OS << "__attribute__((exclusive_lock_function";
1620 OS << "";
1621 for (const auto &Val : args()) {
1622 DelimitAttributeArgument(OS, IsFirstArgument);
1623 OS << Val;
1624 }
1625 OS << "";
1626 if (!IsFirstArgument)
1627 OS << ")";
1628 OS << "))";
1629 break;
1630 }
1631 case 5 : {
1632 OS << "__attribute__((shared_lock_function";
1633 OS << "";
1634 for (const auto &Val : args()) {
1635 DelimitAttributeArgument(OS, IsFirstArgument);
1636 OS << Val;
1637 }
1638 OS << "";
1639 if (!IsFirstArgument)
1640 OS << ")";
1641 OS << "))";
1642 break;
1643 }
1644 }
1645 }
1646
1647 const char *AcquireCapabilityAttr::getSpelling() const {
1648 switch (getAttributeSpellingListIndex()) {
1649 default:
1650 llvm_unreachable("Unknown attribute spelling!");
1651 return "(No spelling)";
1652 case 0:
1653 return "acquire_capability";
1654 case 1:
1655 return "acquire_capability";
1656 case 2:
1657 return "acquire_shared_capability";
1658 case 3:
1659 return "acquire_shared_capability";
1660 case 4:
1661 return "exclusive_lock_function";
1662 case 5:
1663 return "shared_lock_function";
1664 }
1665 }
1666
1667
1668 // AcquireHandleAttr implementation
1669
1670 AcquireHandleAttr *AcquireHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) {
1671 auto *A = new (Ctx) AcquireHandleAttr(Ctx, CommonInfo, HandleType);
1672 A->setImplicit(true);
1673 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1674 A->setAttributeSpellingListIndex(0);
1675 return A;
1676 }
1677
1678 AcquireHandleAttr *AcquireHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) {
1679 auto *A = new (Ctx) AcquireHandleAttr(Ctx, CommonInfo, HandleType);
1680 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1681 A->setAttributeSpellingListIndex(0);
1682 return A;
1683 }
1684
1685 AcquireHandleAttr *AcquireHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) {
1686 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1687 switch (S) {
1688 case GNU_acquire_handle:
1689 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1690 case CXX11_clang_acquire_handle:
1691 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1692 case C23_clang_acquire_handle:
1693 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1694 default:
1695 llvm_unreachable("Unknown attribute spelling!");
1696 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1697 }
1698 }());
1699 return CreateImplicit(Ctx, HandleType, I);
1700 }
1701
1702 AcquireHandleAttr *AcquireHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) {
1703 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1704 switch (S) {
1705 case GNU_acquire_handle:
1706 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1707 case CXX11_clang_acquire_handle:
1708 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1709 case C23_clang_acquire_handle:
1710 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1711 default:
1712 llvm_unreachable("Unknown attribute spelling!");
1713 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1714 }
1715 }());
1716 return Create(Ctx, HandleType, I);
1717 }
1718
1719 AcquireHandleAttr::AcquireHandleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1720 , llvm::StringRef HandleType
1721 )
1722 : InheritableAttr(Ctx, CommonInfo, attr::AcquireHandle, /*IsLateParsed=*/false, false)
1723 , handleTypeLength(HandleType.size()),handleType(new (Ctx, 1) char[handleTypeLength])
1724 {
1725 if (!HandleType.empty())
1726 std::memcpy(handleType, HandleType.data(), handleTypeLength);
1727 }
1728
1729
1730
1731 AcquireHandleAttr *AcquireHandleAttr::clone(ASTContext &C) const {
1732 auto *A = new (C) AcquireHandleAttr(C, *this, getHandleType());
1733 A->Inherited = Inherited;
1734 A->IsPackExpansion = IsPackExpansion;
1735 A->setImplicit(Implicit);
1736 return A;
1737 }
1738
1739 void AcquireHandleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
1740 bool IsFirstArgument = true; (void)IsFirstArgument;
1741 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
1742 switch (getAttributeSpellingListIndex()) {
1743 default:
1744 llvm_unreachable("Unknown attribute spelling!");
1745 break;
1746 case 0 : {
1747 OS << "__attribute__((acquire_handle";
1748 DelimitAttributeArgument(OS, IsFirstArgument);
1749 OS << "\"" << getHandleType() << "\"";
1750 if (!IsFirstArgument)
1751 OS << ")";
1752 OS << "))";
1753 break;
1754 }
1755 case 1 : {
1756 OS << "[[clang::acquire_handle";
1757 DelimitAttributeArgument(OS, IsFirstArgument);
1758 OS << "\"" << getHandleType() << "\"";
1759 if (!IsFirstArgument)
1760 OS << ")";
1761 OS << "]]";
1762 break;
1763 }
1764 case 2 : {
1765 OS << "[[clang::acquire_handle";
1766 DelimitAttributeArgument(OS, IsFirstArgument);
1767 OS << "\"" << getHandleType() << "\"";
1768 if (!IsFirstArgument)
1769 OS << ")";
1770 OS << "]]";
1771 break;
1772 }
1773 }
1774 }
1775
1776 const char *AcquireHandleAttr::getSpelling() const {
1777 switch (getAttributeSpellingListIndex()) {
1778 default:
1779 llvm_unreachable("Unknown attribute spelling!");
1780 return "(No spelling)";
1781 case 0:
1782 return "acquire_handle";
1783 case 1:
1784 return "acquire_handle";
1785 case 2:
1786 return "acquire_handle";
1787 }
1788 }
1789
1790
1791 // AcquiredAfterAttr implementation
1792
1793 AcquiredAfterAttr *AcquiredAfterAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
1794 auto *A = new (Ctx) AcquiredAfterAttr(Ctx, CommonInfo, Args, ArgsSize);
1795 A->setImplicit(true);
1796 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1797 A->setAttributeSpellingListIndex(0);
1798 return A;
1799 }
1800
1801 AcquiredAfterAttr *AcquiredAfterAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
1802 auto *A = new (Ctx) AcquiredAfterAttr(Ctx, CommonInfo, Args, ArgsSize);
1803 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1804 A->setAttributeSpellingListIndex(0);
1805 return A;
1806 }
1807
1808 AcquiredAfterAttr *AcquiredAfterAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
1809 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
1810 return CreateImplicit(Ctx, Args, ArgsSize, I);
1811 }
1812
1813 AcquiredAfterAttr *AcquiredAfterAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
1814 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
1815 return Create(Ctx, Args, ArgsSize, I);
1816 }
1817
1818 AcquiredAfterAttr::AcquiredAfterAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1819 , Expr * *Args, unsigned ArgsSize
1820 )
1821 : InheritableAttr(Ctx, CommonInfo, attr::AcquiredAfter, /*IsLateParsed=*/true, true)
1822 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
1823 {
1824 std::copy(Args, Args + args_Size, args_);
1825 }
1826
1827 AcquiredAfterAttr::AcquiredAfterAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1828 )
1829 : InheritableAttr(Ctx, CommonInfo, attr::AcquiredAfter, /*IsLateParsed=*/true, true)
1830 , args_Size(0), args_(nullptr)
1831 {
1832 }
1833
1834
1835
1836 AcquiredAfterAttr *AcquiredAfterAttr::clone(ASTContext &C) const {
1837 auto *A = new (C) AcquiredAfterAttr(C, *this, args_, args_Size);
1838 A->Inherited = Inherited;
1839 A->IsPackExpansion = IsPackExpansion;
1840 A->setImplicit(Implicit);
1841 return A;
1842 }
1843
1844 void AcquiredAfterAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
1845 bool IsFirstArgument = true; (void)IsFirstArgument;
1846 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
1847 switch (getAttributeSpellingListIndex()) {
1848 default:
1849 llvm_unreachable("Unknown attribute spelling!");
1850 break;
1851 case 0 : {
1852 OS << "__attribute__((acquired_after";
1853 OS << "";
1854 for (const auto &Val : args()) {
1855 DelimitAttributeArgument(OS, IsFirstArgument);
1856 OS << Val;
1857 }
1858 OS << "";
1859 if (!IsFirstArgument)
1860 OS << ")";
1861 OS << "))";
1862 break;
1863 }
1864 }
1865 }
1866
1867 const char *AcquiredAfterAttr::getSpelling() const {
1868 switch (getAttributeSpellingListIndex()) {
1869 default:
1870 llvm_unreachable("Unknown attribute spelling!");
1871 return "(No spelling)";
1872 case 0:
1873 return "acquired_after";
1874 }
1875 }
1876
1877
1878 // AcquiredBeforeAttr implementation
1879
1880 AcquiredBeforeAttr *AcquiredBeforeAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
1881 auto *A = new (Ctx) AcquiredBeforeAttr(Ctx, CommonInfo, Args, ArgsSize);
1882 A->setImplicit(true);
1883 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1884 A->setAttributeSpellingListIndex(0);
1885 return A;
1886 }
1887
1888 AcquiredBeforeAttr *AcquiredBeforeAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
1889 auto *A = new (Ctx) AcquiredBeforeAttr(Ctx, CommonInfo, Args, ArgsSize);
1890 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1891 A->setAttributeSpellingListIndex(0);
1892 return A;
1893 }
1894
1895 AcquiredBeforeAttr *AcquiredBeforeAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
1896 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
1897 return CreateImplicit(Ctx, Args, ArgsSize, I);
1898 }
1899
1900 AcquiredBeforeAttr *AcquiredBeforeAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
1901 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
1902 return Create(Ctx, Args, ArgsSize, I);
1903 }
1904
1905 AcquiredBeforeAttr::AcquiredBeforeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1906 , Expr * *Args, unsigned ArgsSize
1907 )
1908 : InheritableAttr(Ctx, CommonInfo, attr::AcquiredBefore, /*IsLateParsed=*/true, true)
1909 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
1910 {
1911 std::copy(Args, Args + args_Size, args_);
1912 }
1913
1914 AcquiredBeforeAttr::AcquiredBeforeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
1915 )
1916 : InheritableAttr(Ctx, CommonInfo, attr::AcquiredBefore, /*IsLateParsed=*/true, true)
1917 , args_Size(0), args_(nullptr)
1918 {
1919 }
1920
1921
1922
1923 AcquiredBeforeAttr *AcquiredBeforeAttr::clone(ASTContext &C) const {
1924 auto *A = new (C) AcquiredBeforeAttr(C, *this, args_, args_Size);
1925 A->Inherited = Inherited;
1926 A->IsPackExpansion = IsPackExpansion;
1927 A->setImplicit(Implicit);
1928 return A;
1929 }
1930
1931 void AcquiredBeforeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
1932 bool IsFirstArgument = true; (void)IsFirstArgument;
1933 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
1934 switch (getAttributeSpellingListIndex()) {
1935 default:
1936 llvm_unreachable("Unknown attribute spelling!");
1937 break;
1938 case 0 : {
1939 OS << "__attribute__((acquired_before";
1940 OS << "";
1941 for (const auto &Val : args()) {
1942 DelimitAttributeArgument(OS, IsFirstArgument);
1943 OS << Val;
1944 }
1945 OS << "";
1946 if (!IsFirstArgument)
1947 OS << ")";
1948 OS << "))";
1949 break;
1950 }
1951 }
1952 }
1953
1954 const char *AcquiredBeforeAttr::getSpelling() const {
1955 switch (getAttributeSpellingListIndex()) {
1956 default:
1957 llvm_unreachable("Unknown attribute spelling!");
1958 return "(No spelling)";
1959 case 0:
1960 return "acquired_before";
1961 }
1962 }
1963
1964
1965 // AddressSpaceAttr implementation
1966
1967 AddressSpaceAttr *AddressSpaceAttr::CreateImplicit(ASTContext &Ctx, int AddressSpace, const AttributeCommonInfo &CommonInfo) {
1968 auto *A = new (Ctx) AddressSpaceAttr(Ctx, CommonInfo, AddressSpace);
1969 A->setImplicit(true);
1970 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1971 A->setAttributeSpellingListIndex(0);
1972 return A;
1973 }
1974
1975 AddressSpaceAttr *AddressSpaceAttr::Create(ASTContext &Ctx, int AddressSpace, const AttributeCommonInfo &CommonInfo) {
1976 auto *A = new (Ctx) AddressSpaceAttr(Ctx, CommonInfo, AddressSpace);
1977 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
1978 A->setAttributeSpellingListIndex(0);
1979 return A;
1980 }
1981
1982 AddressSpaceAttr *AddressSpaceAttr::CreateImplicit(ASTContext &Ctx, int AddressSpace, SourceRange Range, Spelling S) {
1983 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
1984 switch (S) {
1985 case GNU_address_space:
1986 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1987 case CXX11_clang_address_space:
1988 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1989 case C23_clang_address_space:
1990 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1991 default:
1992 llvm_unreachable("Unknown attribute spelling!");
1993 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
1994 }
1995 }());
1996 return CreateImplicit(Ctx, AddressSpace, I);
1997 }
1998
1999 AddressSpaceAttr *AddressSpaceAttr::Create(ASTContext &Ctx, int AddressSpace, SourceRange Range, Spelling S) {
2000 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2001 switch (S) {
2002 case GNU_address_space:
2003 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2004 case CXX11_clang_address_space:
2005 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2006 case C23_clang_address_space:
2007 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2008 default:
2009 llvm_unreachable("Unknown attribute spelling!");
2010 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2011 }
2012 }());
2013 return Create(Ctx, AddressSpace, I);
2014 }
2015
2016 AddressSpaceAttr::AddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2017 , int AddressSpace
2018 )
2019 : TypeAttr(Ctx, CommonInfo, attr::AddressSpace, /*IsLateParsed=*/false)
2020 , addressSpace(AddressSpace)
2021 {
2022 }
2023
2024
2025
2026 AddressSpaceAttr *AddressSpaceAttr::clone(ASTContext &C) const {
2027 auto *A = new (C) AddressSpaceAttr(C, *this, addressSpace);
2028 A->Inherited = Inherited;
2029 A->IsPackExpansion = IsPackExpansion;
2030 A->setImplicit(Implicit);
2031 return A;
2032 }
2033
2034 void AddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
2035 bool IsFirstArgument = true; (void)IsFirstArgument;
2036 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
2037 switch (getAttributeSpellingListIndex()) {
2038 default:
2039 llvm_unreachable("Unknown attribute spelling!");
2040 break;
2041 case 0 : {
2042 OS << "__attribute__((address_space";
2043 DelimitAttributeArgument(OS, IsFirstArgument);
2044 OS << "" << getAddressSpace() << "";
2045 if (!IsFirstArgument)
2046 OS << ")";
2047 OS << "))";
2048 break;
2049 }
2050 case 1 : {
2051 OS << "[[clang::address_space";
2052 DelimitAttributeArgument(OS, IsFirstArgument);
2053 OS << "" << getAddressSpace() << "";
2054 if (!IsFirstArgument)
2055 OS << ")";
2056 OS << "]]";
2057 break;
2058 }
2059 case 2 : {
2060 OS << "[[clang::address_space";
2061 DelimitAttributeArgument(OS, IsFirstArgument);
2062 OS << "" << getAddressSpace() << "";
2063 if (!IsFirstArgument)
2064 OS << ")";
2065 OS << "]]";
2066 break;
2067 }
2068 }
2069 }
2070
2071 const char *AddressSpaceAttr::getSpelling() const {
2072 switch (getAttributeSpellingListIndex()) {
2073 default:
2074 llvm_unreachable("Unknown attribute spelling!");
2075 return "(No spelling)";
2076 case 0:
2077 return "address_space";
2078 case 1:
2079 return "address_space";
2080 case 2:
2081 return "address_space";
2082 }
2083 }
2084
2085
2086 // AliasAttr implementation
2087
2088 AliasAttr *AliasAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) {
2089 auto *A = new (Ctx) AliasAttr(Ctx, CommonInfo, Aliasee);
2090 A->setImplicit(true);
2091 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2092 A->setAttributeSpellingListIndex(0);
2093 return A;
2094 }
2095
2096 AliasAttr *AliasAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) {
2097 auto *A = new (Ctx) AliasAttr(Ctx, CommonInfo, Aliasee);
2098 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2099 A->setAttributeSpellingListIndex(0);
2100 return A;
2101 }
2102
2103 AliasAttr *AliasAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, Spelling S) {
2104 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2105 switch (S) {
2106 case GNU_alias:
2107 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2108 case CXX11_gnu_alias:
2109 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2110 case C23_gnu_alias:
2111 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2112 default:
2113 llvm_unreachable("Unknown attribute spelling!");
2114 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2115 }
2116 }());
2117 return CreateImplicit(Ctx, Aliasee, I);
2118 }
2119
2120 AliasAttr *AliasAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, Spelling S) {
2121 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2122 switch (S) {
2123 case GNU_alias:
2124 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2125 case CXX11_gnu_alias:
2126 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2127 case C23_gnu_alias:
2128 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2129 default:
2130 llvm_unreachable("Unknown attribute spelling!");
2131 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2132 }
2133 }());
2134 return Create(Ctx, Aliasee, I);
2135 }
2136
2137 AliasAttr::AliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2138 , llvm::StringRef Aliasee
2139 )
2140 : Attr(Ctx, CommonInfo, attr::Alias, /*IsLateParsed=*/false)
2141 , aliaseeLength(Aliasee.size()),aliasee(new (Ctx, 1) char[aliaseeLength])
2142 {
2143 if (!Aliasee.empty())
2144 std::memcpy(aliasee, Aliasee.data(), aliaseeLength);
2145 }
2146
2147
2148
2149 AliasAttr *AliasAttr::clone(ASTContext &C) const {
2150 auto *A = new (C) AliasAttr(C, *this, getAliasee());
2151 A->Inherited = Inherited;
2152 A->IsPackExpansion = IsPackExpansion;
2153 A->setImplicit(Implicit);
2154 return A;
2155 }
2156
2157 void AliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
2158 bool IsFirstArgument = true; (void)IsFirstArgument;
2159 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
2160 switch (getAttributeSpellingListIndex()) {
2161 default:
2162 llvm_unreachable("Unknown attribute spelling!");
2163 break;
2164 case 0 : {
2165 OS << "__attribute__((alias";
2166 DelimitAttributeArgument(OS, IsFirstArgument);
2167 OS << "\"" << getAliasee() << "\"";
2168 if (!IsFirstArgument)
2169 OS << ")";
2170 OS << "))";
2171 break;
2172 }
2173 case 1 : {
2174 OS << "[[gnu::alias";
2175 DelimitAttributeArgument(OS, IsFirstArgument);
2176 OS << "\"" << getAliasee() << "\"";
2177 if (!IsFirstArgument)
2178 OS << ")";
2179 OS << "]]";
2180 break;
2181 }
2182 case 2 : {
2183 OS << "[[gnu::alias";
2184 DelimitAttributeArgument(OS, IsFirstArgument);
2185 OS << "\"" << getAliasee() << "\"";
2186 if (!IsFirstArgument)
2187 OS << ")";
2188 OS << "]]";
2189 break;
2190 }
2191 }
2192 }
2193
2194 const char *AliasAttr::getSpelling() const {
2195 switch (getAttributeSpellingListIndex()) {
2196 default:
2197 llvm_unreachable("Unknown attribute spelling!");
2198 return "(No spelling)";
2199 case 0:
2200 return "alias";
2201 case 1:
2202 return "alias";
2203 case 2:
2204 return "alias";
2205 }
2206 }
2207
2208
2209 // AlignMac68kAttr implementation
2210
2211 AlignMac68kAttr *AlignMac68kAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
2212 auto *A = new (Ctx) AlignMac68kAttr(Ctx, CommonInfo);
2213 A->setImplicit(true);
2214 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2215 A->setAttributeSpellingListIndex(0);
2216 return A;
2217 }
2218
2219 AlignMac68kAttr *AlignMac68kAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
2220 auto *A = new (Ctx) AlignMac68kAttr(Ctx, CommonInfo);
2221 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2222 A->setAttributeSpellingListIndex(0);
2223 return A;
2224 }
2225
2226 AlignMac68kAttr *AlignMac68kAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
2227 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
2228 return CreateImplicit(Ctx, I);
2229 }
2230
2231 AlignMac68kAttr *AlignMac68kAttr::Create(ASTContext &Ctx, SourceRange Range) {
2232 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
2233 return Create(Ctx, I);
2234 }
2235
2236 AlignMac68kAttr::AlignMac68kAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2237 )
2238 : InheritableAttr(Ctx, CommonInfo, attr::AlignMac68k, /*IsLateParsed=*/false, false)
2239 {
2240 }
2241
2242 AlignMac68kAttr *AlignMac68kAttr::clone(ASTContext &C) const {
2243 auto *A = new (C) AlignMac68kAttr(C, *this);
2244 A->Inherited = Inherited;
2245 A->IsPackExpansion = IsPackExpansion;
2246 A->setImplicit(Implicit);
2247 return A;
2248 }
2249
2250 void AlignMac68kAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
2251 }
2252
2253 const char *AlignMac68kAttr::getSpelling() const {
2254 return "(No spelling)";
2255 }
2256
2257
2258 // AlignNaturalAttr implementation
2259
2260 AlignNaturalAttr *AlignNaturalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
2261 auto *A = new (Ctx) AlignNaturalAttr(Ctx, CommonInfo);
2262 A->setImplicit(true);
2263 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2264 A->setAttributeSpellingListIndex(0);
2265 return A;
2266 }
2267
2268 AlignNaturalAttr *AlignNaturalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
2269 auto *A = new (Ctx) AlignNaturalAttr(Ctx, CommonInfo);
2270 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2271 A->setAttributeSpellingListIndex(0);
2272 return A;
2273 }
2274
2275 AlignNaturalAttr *AlignNaturalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
2276 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
2277 return CreateImplicit(Ctx, I);
2278 }
2279
2280 AlignNaturalAttr *AlignNaturalAttr::Create(ASTContext &Ctx, SourceRange Range) {
2281 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
2282 return Create(Ctx, I);
2283 }
2284
2285 AlignNaturalAttr::AlignNaturalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2286 )
2287 : InheritableAttr(Ctx, CommonInfo, attr::AlignNatural, /*IsLateParsed=*/false, false)
2288 {
2289 }
2290
2291 AlignNaturalAttr *AlignNaturalAttr::clone(ASTContext &C) const {
2292 auto *A = new (C) AlignNaturalAttr(C, *this);
2293 A->Inherited = Inherited;
2294 A->IsPackExpansion = IsPackExpansion;
2295 A->setImplicit(Implicit);
2296 return A;
2297 }
2298
2299 void AlignNaturalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
2300 }
2301
2302 const char *AlignNaturalAttr::getSpelling() const {
2303 return "(No spelling)";
2304 }
2305
2306
2307 // AlignValueAttr implementation
2308
2309 AlignValueAttr *AlignValueAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) {
2310 auto *A = new (Ctx) AlignValueAttr(Ctx, CommonInfo, Alignment);
2311 A->setImplicit(true);
2312 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2313 A->setAttributeSpellingListIndex(0);
2314 return A;
2315 }
2316
2317 AlignValueAttr *AlignValueAttr::Create(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) {
2318 auto *A = new (Ctx) AlignValueAttr(Ctx, CommonInfo, Alignment);
2319 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2320 A->setAttributeSpellingListIndex(0);
2321 return A;
2322 }
2323
2324 AlignValueAttr *AlignValueAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, SourceRange Range) {
2325 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
2326 return CreateImplicit(Ctx, Alignment, I);
2327 }
2328
2329 AlignValueAttr *AlignValueAttr::Create(ASTContext &Ctx, Expr * Alignment, SourceRange Range) {
2330 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
2331 return Create(Ctx, Alignment, I);
2332 }
2333
2334 AlignValueAttr::AlignValueAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2335 , Expr * Alignment
2336 )
2337 : Attr(Ctx, CommonInfo, attr::AlignValue, /*IsLateParsed=*/false)
2338 , alignment(Alignment)
2339 {
2340 }
2341
2342
2343
2344 AlignValueAttr *AlignValueAttr::clone(ASTContext &C) const {
2345 auto *A = new (C) AlignValueAttr(C, *this, alignment);
2346 A->Inherited = Inherited;
2347 A->IsPackExpansion = IsPackExpansion;
2348 A->setImplicit(Implicit);
2349 return A;
2350 }
2351
2352 void AlignValueAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
2353 bool IsFirstArgument = true; (void)IsFirstArgument;
2354 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
2355 switch (getAttributeSpellingListIndex()) {
2356 default:
2357 llvm_unreachable("Unknown attribute spelling!");
2358 break;
2359 case 0 : {
2360 OS << "__attribute__((align_value";
2361 DelimitAttributeArgument(OS, IsFirstArgument);
2362 OS << "";
2363 getAlignment()->printPretty(OS, nullptr, Policy);
2364 OS << "";
2365 if (!IsFirstArgument)
2366 OS << ")";
2367 OS << "))";
2368 break;
2369 }
2370 }
2371 }
2372
2373 const char *AlignValueAttr::getSpelling() const {
2374 switch (getAttributeSpellingListIndex()) {
2375 default:
2376 llvm_unreachable("Unknown attribute spelling!");
2377 return "(No spelling)";
2378 case 0:
2379 return "align_value";
2380 }
2381 }
2382
2383
2384 // AlignedAttr implementation
2385
2386 AlignedAttr *AlignedAttr::CreateImplicit(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, const AttributeCommonInfo &CommonInfo) {
2387 auto *A = new (Ctx) AlignedAttr(Ctx, CommonInfo, IsAlignmentExpr, Alignment);
2388 A->setImplicit(true);
2389 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2390 A->setAttributeSpellingListIndex(0);
2391 return A;
2392 }
2393
2394 AlignedAttr *AlignedAttr::Create(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, const AttributeCommonInfo &CommonInfo) {
2395 auto *A = new (Ctx) AlignedAttr(Ctx, CommonInfo, IsAlignmentExpr, Alignment);
2396 return A;
2397 }
2398
2399 AlignedAttr *AlignedAttr::CreateImplicit(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, SourceRange Range, Spelling S) {
2400 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2401 switch (S) {
2402 case GNU_aligned:
2403 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2404 case CXX11_gnu_aligned:
2405 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2406 case C23_gnu_aligned:
2407 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2408 case Declspec_align:
2409 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2410 case Keyword_alignas:
2411 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_alignas, true /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2412 case Keyword_Alignas:
2413 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_Alignas, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2414 default:
2415 llvm_unreachable("Unknown attribute spelling!");
2416 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2417 }
2418 }());
2419 return CreateImplicit(Ctx, IsAlignmentExpr, Alignment, I);
2420 }
2421
2422 AlignedAttr *AlignedAttr::Create(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, SourceRange Range, Spelling S) {
2423 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2424 switch (S) {
2425 case GNU_aligned:
2426 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2427 case CXX11_gnu_aligned:
2428 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2429 case C23_gnu_aligned:
2430 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2431 case Declspec_align:
2432 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2433 case Keyword_alignas:
2434 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_alignas, true /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2435 case Keyword_Alignas:
2436 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_Alignas, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2437 default:
2438 llvm_unreachable("Unknown attribute spelling!");
2439 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2440 }
2441 }());
2442 return Create(Ctx, IsAlignmentExpr, Alignment, I);
2443 }
2444
2445 AlignedAttr::AlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2446 , bool IsAlignmentExpr, void *Alignment
2447 )
2448 : InheritableAttr(Ctx, CommonInfo, attr::Aligned, /*IsLateParsed=*/false, false)
2449 , isalignmentExpr(IsAlignmentExpr)
2450 {
2451 if (isalignmentExpr)
2452 alignmentExpr = reinterpret_cast<Expr *>(Alignment);
2453 else
2454 alignmentType = reinterpret_cast<TypeSourceInfo *>(Alignment);
2455 }
2456
2457 AlignedAttr::AlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2458 )
2459 : InheritableAttr(Ctx, CommonInfo, attr::Aligned, /*IsLateParsed=*/false, false)
2460 , isalignmentExpr(false)
2461 {
2462 }
2463
2464 AlignedAttr::Spelling AlignedAttr::getSemanticSpelling() const {
2465 switch (getAttributeSpellingListIndex()) {
2466 default: llvm_unreachable("Unknown spelling list index");
2467 case 0: return GNU_aligned;
2468 case 1: return CXX11_gnu_aligned;
2469 case 2: return C23_gnu_aligned;
2470 case 3: return Declspec_align;
2471 case 4: return Keyword_alignas;
2472 case 5: return Keyword_Alignas;
2473 }
2474 }
2475 bool AlignedAttr::isAlignmentDependent() const {
2476 if (isalignmentExpr)
2477 return alignmentExpr && (alignmentExpr->isValueDependent() || alignmentExpr->isTypeDependent());
2478 else
2479 return alignmentType->getType()->isDependentType();
2480 }
2481 bool AlignedAttr::isAlignmentErrorDependent() const {
2482 if (isalignmentExpr)
2483 return alignmentExpr && alignmentExpr->containsErrors();
2484 return alignmentType->getType()->containsErrors();
2485 }
2486
2487
2488 AlignedAttr *AlignedAttr::clone(ASTContext &C) const {
2489 auto *A = new (C) AlignedAttr(C, *this, isalignmentExpr, isalignmentExpr ? static_cast<void*>(alignmentExpr) : alignmentType);
2490 A->Inherited = Inherited;
2491 A->IsPackExpansion = IsPackExpansion;
2492 A->setImplicit(Implicit);
2493 return A;
2494 }
2495
2496 void AlignedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
2497 bool IsFirstArgument = true; (void)IsFirstArgument;
2498 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
2499 switch (getAttributeSpellingListIndex()) {
2500 default:
2501 llvm_unreachable("Unknown attribute spelling!");
2502 break;
2503 case 0 : {
2504 OS << "__attribute__((aligned";
2505 if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))
2506 ++TrailingOmittedArgs;
2507 if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) {
2508 DelimitAttributeArgument(OS, IsFirstArgument);
2509 OS << "";
2510 if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy);
2511 if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy);
2512 OS << "";
2513 }
2514 if (!IsFirstArgument)
2515 OS << ")";
2516 OS << "))";
2517 break;
2518 }
2519 case 1 : {
2520 OS << "[[gnu::aligned";
2521 if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))
2522 ++TrailingOmittedArgs;
2523 if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) {
2524 DelimitAttributeArgument(OS, IsFirstArgument);
2525 OS << "";
2526 if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy);
2527 if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy);
2528 OS << "";
2529 }
2530 if (!IsFirstArgument)
2531 OS << ")";
2532 OS << "]]";
2533 break;
2534 }
2535 case 2 : {
2536 OS << "[[gnu::aligned";
2537 if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))
2538 ++TrailingOmittedArgs;
2539 if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) {
2540 DelimitAttributeArgument(OS, IsFirstArgument);
2541 OS << "";
2542 if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy);
2543 if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy);
2544 OS << "";
2545 }
2546 if (!IsFirstArgument)
2547 OS << ")";
2548 OS << "]]";
2549 break;
2550 }
2551 case 3 : {
2552 OS << "__declspec(align";
2553 if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))
2554 ++TrailingOmittedArgs;
2555 if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) {
2556 DelimitAttributeArgument(OS, IsFirstArgument);
2557 OS << "";
2558 if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy);
2559 if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy);
2560 OS << "";
2561 }
2562 if (!IsFirstArgument)
2563 OS << ")";
2564 OS << ")";
2565 break;
2566 }
2567 case 4 : {
2568 OS << "alignas";
2569 if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))
2570 ++TrailingOmittedArgs;
2571 if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) {
2572 DelimitAttributeArgument(OS, IsFirstArgument);
2573 OS << "";
2574 if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy);
2575 if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy);
2576 OS << "";
2577 }
2578 if (!IsFirstArgument)
2579 OS << ")";
2580 OS << "";
2581 break;
2582 }
2583 case 5 : {
2584 OS << "_Alignas";
2585 if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))
2586 ++TrailingOmittedArgs;
2587 if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) {
2588 DelimitAttributeArgument(OS, IsFirstArgument);
2589 OS << "";
2590 if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy);
2591 if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy);
2592 OS << "";
2593 }
2594 if (!IsFirstArgument)
2595 OS << ")";
2596 OS << "";
2597 break;
2598 }
2599 }
2600 }
2601
2602 const char *AlignedAttr::getSpelling() const {
2603 switch (getAttributeSpellingListIndex()) {
2604 default:
2605 llvm_unreachable("Unknown attribute spelling!");
2606 return "(No spelling)";
2607 case 0:
2608 return "aligned";
2609 case 1:
2610 return "aligned";
2611 case 2:
2612 return "aligned";
2613 case 3:
2614 return "align";
2615 case 4:
2616 return "alignas";
2617 case 5:
2618 return "_Alignas";
2619 }
2620 }
2621
2622
2623 // AllocAlignAttr implementation
2624
2625 AllocAlignAttr *AllocAlignAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ParamIndex, const AttributeCommonInfo &CommonInfo) {
2626 auto *A = new (Ctx) AllocAlignAttr(Ctx, CommonInfo, ParamIndex);
2627 A->setImplicit(true);
2628 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2629 A->setAttributeSpellingListIndex(0);
2630 return A;
2631 }
2632
2633 AllocAlignAttr *AllocAlignAttr::Create(ASTContext &Ctx, ParamIdx ParamIndex, const AttributeCommonInfo &CommonInfo) {
2634 auto *A = new (Ctx) AllocAlignAttr(Ctx, CommonInfo, ParamIndex);
2635 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2636 A->setAttributeSpellingListIndex(0);
2637 return A;
2638 }
2639
2640 AllocAlignAttr *AllocAlignAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ParamIndex, SourceRange Range, Spelling S) {
2641 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2642 switch (S) {
2643 case GNU_alloc_align:
2644 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2645 case CXX11_gnu_alloc_align:
2646 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2647 case C23_gnu_alloc_align:
2648 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2649 default:
2650 llvm_unreachable("Unknown attribute spelling!");
2651 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2652 }
2653 }());
2654 return CreateImplicit(Ctx, ParamIndex, I);
2655 }
2656
2657 AllocAlignAttr *AllocAlignAttr::Create(ASTContext &Ctx, ParamIdx ParamIndex, SourceRange Range, Spelling S) {
2658 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2659 switch (S) {
2660 case GNU_alloc_align:
2661 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2662 case CXX11_gnu_alloc_align:
2663 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2664 case C23_gnu_alloc_align:
2665 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2666 default:
2667 llvm_unreachable("Unknown attribute spelling!");
2668 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2669 }
2670 }());
2671 return Create(Ctx, ParamIndex, I);
2672 }
2673
2674 AllocAlignAttr::AllocAlignAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2675 , ParamIdx ParamIndex
2676 )
2677 : InheritableAttr(Ctx, CommonInfo, attr::AllocAlign, /*IsLateParsed=*/false, false)
2678 , paramIndex(ParamIndex)
2679 {
2680 }
2681
2682
2683
2684 AllocAlignAttr *AllocAlignAttr::clone(ASTContext &C) const {
2685 auto *A = new (C) AllocAlignAttr(C, *this, paramIndex);
2686 A->Inherited = Inherited;
2687 A->IsPackExpansion = IsPackExpansion;
2688 A->setImplicit(Implicit);
2689 return A;
2690 }
2691
2692 void AllocAlignAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
2693 bool IsFirstArgument = true; (void)IsFirstArgument;
2694 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
2695 switch (getAttributeSpellingListIndex()) {
2696 default:
2697 llvm_unreachable("Unknown attribute spelling!");
2698 break;
2699 case 0 : {
2700 OS << "__attribute__((alloc_align";
2701 DelimitAttributeArgument(OS, IsFirstArgument);
2702 OS << "" << getParamIndex().getSourceIndex() << "";
2703 if (!IsFirstArgument)
2704 OS << ")";
2705 OS << "))";
2706 break;
2707 }
2708 case 1 : {
2709 OS << "[[gnu::alloc_align";
2710 DelimitAttributeArgument(OS, IsFirstArgument);
2711 OS << "" << getParamIndex().getSourceIndex() << "";
2712 if (!IsFirstArgument)
2713 OS << ")";
2714 OS << "]]";
2715 break;
2716 }
2717 case 2 : {
2718 OS << "[[gnu::alloc_align";
2719 DelimitAttributeArgument(OS, IsFirstArgument);
2720 OS << "" << getParamIndex().getSourceIndex() << "";
2721 if (!IsFirstArgument)
2722 OS << ")";
2723 OS << "]]";
2724 break;
2725 }
2726 }
2727 }
2728
2729 const char *AllocAlignAttr::getSpelling() const {
2730 switch (getAttributeSpellingListIndex()) {
2731 default:
2732 llvm_unreachable("Unknown attribute spelling!");
2733 return "(No spelling)";
2734 case 0:
2735 return "alloc_align";
2736 case 1:
2737 return "alloc_align";
2738 case 2:
2739 return "alloc_align";
2740 }
2741 }
2742
2743
2744 // AllocSizeAttr implementation
2745
2746 AllocSizeAttr *AllocSizeAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, const AttributeCommonInfo &CommonInfo) {
2747 auto *A = new (Ctx) AllocSizeAttr(Ctx, CommonInfo, ElemSizeParam, NumElemsParam);
2748 A->setImplicit(true);
2749 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2750 A->setAttributeSpellingListIndex(0);
2751 return A;
2752 }
2753
2754 AllocSizeAttr *AllocSizeAttr::Create(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, const AttributeCommonInfo &CommonInfo) {
2755 auto *A = new (Ctx) AllocSizeAttr(Ctx, CommonInfo, ElemSizeParam, NumElemsParam);
2756 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2757 A->setAttributeSpellingListIndex(0);
2758 return A;
2759 }
2760
2761 AllocSizeAttr *AllocSizeAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, SourceRange Range, Spelling S) {
2762 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2763 switch (S) {
2764 case GNU_alloc_size:
2765 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2766 case CXX11_gnu_alloc_size:
2767 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2768 case C23_gnu_alloc_size:
2769 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2770 default:
2771 llvm_unreachable("Unknown attribute spelling!");
2772 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2773 }
2774 }());
2775 return CreateImplicit(Ctx, ElemSizeParam, NumElemsParam, I);
2776 }
2777
2778 AllocSizeAttr *AllocSizeAttr::Create(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, SourceRange Range, Spelling S) {
2779 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2780 switch (S) {
2781 case GNU_alloc_size:
2782 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2783 case CXX11_gnu_alloc_size:
2784 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2785 case C23_gnu_alloc_size:
2786 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2787 default:
2788 llvm_unreachable("Unknown attribute spelling!");
2789 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2790 }
2791 }());
2792 return Create(Ctx, ElemSizeParam, NumElemsParam, I);
2793 }
2794
2795 AllocSizeAttr::AllocSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2796 , ParamIdx ElemSizeParam
2797 , ParamIdx NumElemsParam
2798 )
2799 : InheritableAttr(Ctx, CommonInfo, attr::AllocSize, /*IsLateParsed=*/false, false)
2800 , elemSizeParam(ElemSizeParam)
2801 , numElemsParam(NumElemsParam)
2802 {
2803 }
2804
2805 AllocSizeAttr::AllocSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2806 , ParamIdx ElemSizeParam
2807 )
2808 : InheritableAttr(Ctx, CommonInfo, attr::AllocSize, /*IsLateParsed=*/false, false)
2809 , elemSizeParam(ElemSizeParam)
2810 , numElemsParam()
2811 {
2812 }
2813
2814
2815
2816
2817
2818 AllocSizeAttr *AllocSizeAttr::clone(ASTContext &C) const {
2819 auto *A = new (C) AllocSizeAttr(C, *this, elemSizeParam, numElemsParam);
2820 A->Inherited = Inherited;
2821 A->IsPackExpansion = IsPackExpansion;
2822 A->setImplicit(Implicit);
2823 return A;
2824 }
2825
2826 void AllocSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
2827 bool IsFirstArgument = true; (void)IsFirstArgument;
2828 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
2829 switch (getAttributeSpellingListIndex()) {
2830 default:
2831 llvm_unreachable("Unknown attribute spelling!");
2832 break;
2833 case 0 : {
2834 OS << "__attribute__((alloc_size";
2835 if (!getNumElemsParam().isValid())
2836 ++TrailingOmittedArgs;
2837 DelimitAttributeArgument(OS, IsFirstArgument);
2838 OS << "" << getElemSizeParam().getSourceIndex() << "";
2839 if (!(!getNumElemsParam().isValid())) {
2840 DelimitAttributeArgument(OS, IsFirstArgument);
2841 OS << "" << getNumElemsParam().getSourceIndex() << "";
2842 }
2843 if (!IsFirstArgument)
2844 OS << ")";
2845 OS << "))";
2846 break;
2847 }
2848 case 1 : {
2849 OS << "[[gnu::alloc_size";
2850 if (!getNumElemsParam().isValid())
2851 ++TrailingOmittedArgs;
2852 DelimitAttributeArgument(OS, IsFirstArgument);
2853 OS << "" << getElemSizeParam().getSourceIndex() << "";
2854 if (!(!getNumElemsParam().isValid())) {
2855 DelimitAttributeArgument(OS, IsFirstArgument);
2856 OS << "" << getNumElemsParam().getSourceIndex() << "";
2857 }
2858 if (!IsFirstArgument)
2859 OS << ")";
2860 OS << "]]";
2861 break;
2862 }
2863 case 2 : {
2864 OS << "[[gnu::alloc_size";
2865 if (!getNumElemsParam().isValid())
2866 ++TrailingOmittedArgs;
2867 DelimitAttributeArgument(OS, IsFirstArgument);
2868 OS << "" << getElemSizeParam().getSourceIndex() << "";
2869 if (!(!getNumElemsParam().isValid())) {
2870 DelimitAttributeArgument(OS, IsFirstArgument);
2871 OS << "" << getNumElemsParam().getSourceIndex() << "";
2872 }
2873 if (!IsFirstArgument)
2874 OS << ")";
2875 OS << "]]";
2876 break;
2877 }
2878 }
2879 }
2880
2881 const char *AllocSizeAttr::getSpelling() const {
2882 switch (getAttributeSpellingListIndex()) {
2883 default:
2884 llvm_unreachable("Unknown attribute spelling!");
2885 return "(No spelling)";
2886 case 0:
2887 return "alloc_size";
2888 case 1:
2889 return "alloc_size";
2890 case 2:
2891 return "alloc_size";
2892 }
2893 }
2894
2895
2896 // AllocatingAttr implementation
2897
2898 AllocatingAttr *AllocatingAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
2899 auto *A = new (Ctx) AllocatingAttr(Ctx, CommonInfo);
2900 A->setImplicit(true);
2901 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2902 A->setAttributeSpellingListIndex(0);
2903 return A;
2904 }
2905
2906 AllocatingAttr *AllocatingAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
2907 auto *A = new (Ctx) AllocatingAttr(Ctx, CommonInfo);
2908 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
2909 A->setAttributeSpellingListIndex(0);
2910 return A;
2911 }
2912
2913 AllocatingAttr *AllocatingAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
2914 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2915 switch (S) {
2916 case GNU_allocating:
2917 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2918 case CXX11_clang_allocating:
2919 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2920 case C23_clang_allocating:
2921 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2922 default:
2923 llvm_unreachable("Unknown attribute spelling!");
2924 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2925 }
2926 }());
2927 return CreateImplicit(Ctx, I);
2928 }
2929
2930 AllocatingAttr *AllocatingAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
2931 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
2932 switch (S) {
2933 case GNU_allocating:
2934 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2935 case CXX11_clang_allocating:
2936 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2937 case C23_clang_allocating:
2938 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2939 default:
2940 llvm_unreachable("Unknown attribute spelling!");
2941 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
2942 }
2943 }());
2944 return Create(Ctx, I);
2945 }
2946
2947 AllocatingAttr::AllocatingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
2948 )
2949 : TypeAttr(Ctx, CommonInfo, attr::Allocating, /*IsLateParsed=*/false)
2950 {
2951 }
2952
2953 AllocatingAttr *AllocatingAttr::clone(ASTContext &C) const {
2954 auto *A = new (C) AllocatingAttr(C, *this);
2955 A->Inherited = Inherited;
2956 A->IsPackExpansion = IsPackExpansion;
2957 A->setImplicit(Implicit);
2958 return A;
2959 }
2960
2961 void AllocatingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
2962 bool IsFirstArgument = true; (void)IsFirstArgument;
2963 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
2964 switch (getAttributeSpellingListIndex()) {
2965 default:
2966 llvm_unreachable("Unknown attribute spelling!");
2967 break;
2968 case 0 : {
2969 OS << "__attribute__((allocating";
2970 OS << "))";
2971 break;
2972 }
2973 case 1 : {
2974 OS << "[[clang::allocating";
2975 OS << "]]";
2976 break;
2977 }
2978 case 2 : {
2979 OS << "[[clang::allocating";
2980 OS << "]]";
2981 break;
2982 }
2983 }
2984 }
2985
2986 const char *AllocatingAttr::getSpelling() const {
2987 switch (getAttributeSpellingListIndex()) {
2988 default:
2989 llvm_unreachable("Unknown attribute spelling!");
2990 return "(No spelling)";
2991 case 0:
2992 return "allocating";
2993 case 1:
2994 return "allocating";
2995 case 2:
2996 return "allocating";
2997 }
2998 }
2999
3000
3001 // AlwaysDestroyAttr implementation
3002
3003 AlwaysDestroyAttr *AlwaysDestroyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3004 auto *A = new (Ctx) AlwaysDestroyAttr(Ctx, CommonInfo);
3005 A->setImplicit(true);
3006 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3007 A->setAttributeSpellingListIndex(0);
3008 return A;
3009 }
3010
3011 AlwaysDestroyAttr *AlwaysDestroyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3012 auto *A = new (Ctx) AlwaysDestroyAttr(Ctx, CommonInfo);
3013 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3014 A->setAttributeSpellingListIndex(0);
3015 return A;
3016 }
3017
3018 AlwaysDestroyAttr *AlwaysDestroyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
3019 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3020 switch (S) {
3021 case GNU_always_destroy:
3022 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_always_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3023 case CXX11_clang_always_destroy:
3024 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_always_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3025 default:
3026 llvm_unreachable("Unknown attribute spelling!");
3027 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3028 }
3029 }());
3030 return CreateImplicit(Ctx, I);
3031 }
3032
3033 AlwaysDestroyAttr *AlwaysDestroyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
3034 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3035 switch (S) {
3036 case GNU_always_destroy:
3037 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_always_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3038 case CXX11_clang_always_destroy:
3039 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_always_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3040 default:
3041 llvm_unreachable("Unknown attribute spelling!");
3042 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3043 }
3044 }());
3045 return Create(Ctx, I);
3046 }
3047
3048 AlwaysDestroyAttr::AlwaysDestroyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3049 )
3050 : InheritableAttr(Ctx, CommonInfo, attr::AlwaysDestroy, /*IsLateParsed=*/false, false)
3051 {
3052 }
3053
3054 AlwaysDestroyAttr *AlwaysDestroyAttr::clone(ASTContext &C) const {
3055 auto *A = new (C) AlwaysDestroyAttr(C, *this);
3056 A->Inherited = Inherited;
3057 A->IsPackExpansion = IsPackExpansion;
3058 A->setImplicit(Implicit);
3059 return A;
3060 }
3061
3062 void AlwaysDestroyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
3063 bool IsFirstArgument = true; (void)IsFirstArgument;
3064 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
3065 switch (getAttributeSpellingListIndex()) {
3066 default:
3067 llvm_unreachable("Unknown attribute spelling!");
3068 break;
3069 case 0 : {
3070 OS << "__attribute__((always_destroy";
3071 OS << "))";
3072 break;
3073 }
3074 case 1 : {
3075 OS << "[[clang::always_destroy";
3076 OS << "]]";
3077 break;
3078 }
3079 }
3080 }
3081
3082 const char *AlwaysDestroyAttr::getSpelling() const {
3083 switch (getAttributeSpellingListIndex()) {
3084 default:
3085 llvm_unreachable("Unknown attribute spelling!");
3086 return "(No spelling)";
3087 case 0:
3088 return "always_destroy";
3089 case 1:
3090 return "always_destroy";
3091 }
3092 }
3093
3094
3095 // AlwaysInlineAttr implementation
3096
3097 AlwaysInlineAttr *AlwaysInlineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3098 auto *A = new (Ctx) AlwaysInlineAttr(Ctx, CommonInfo);
3099 A->setImplicit(true);
3100 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3101 A->setAttributeSpellingListIndex(0);
3102 return A;
3103 }
3104
3105 AlwaysInlineAttr *AlwaysInlineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3106 auto *A = new (Ctx) AlwaysInlineAttr(Ctx, CommonInfo);
3107 return A;
3108 }
3109
3110 AlwaysInlineAttr *AlwaysInlineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
3111 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3112 switch (S) {
3113 case GNU_always_inline:
3114 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3115 case CXX11_gnu_always_inline:
3116 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3117 case C23_gnu_always_inline:
3118 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3119 case CXX11_clang_always_inline:
3120 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3121 case C23_clang_always_inline:
3122 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3123 case Keyword_forceinline:
3124 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_forceinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3125 default:
3126 llvm_unreachable("Unknown attribute spelling!");
3127 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3128 }
3129 }());
3130 return CreateImplicit(Ctx, I);
3131 }
3132
3133 AlwaysInlineAttr *AlwaysInlineAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
3134 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3135 switch (S) {
3136 case GNU_always_inline:
3137 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3138 case CXX11_gnu_always_inline:
3139 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3140 case C23_gnu_always_inline:
3141 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3142 case CXX11_clang_always_inline:
3143 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3144 case C23_clang_always_inline:
3145 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3146 case Keyword_forceinline:
3147 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_forceinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3148 default:
3149 llvm_unreachable("Unknown attribute spelling!");
3150 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3151 }
3152 }());
3153 return Create(Ctx, I);
3154 }
3155
3156 AlwaysInlineAttr::AlwaysInlineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3157 )
3158 : DeclOrStmtAttr(Ctx, CommonInfo, attr::AlwaysInline, /*IsLateParsed=*/false, false)
3159 {
3160 }
3161
3162 AlwaysInlineAttr::Spelling AlwaysInlineAttr::getSemanticSpelling() const {
3163 switch (getAttributeSpellingListIndex()) {
3164 default: llvm_unreachable("Unknown spelling list index");
3165 case 0: return GNU_always_inline;
3166 case 1: return CXX11_gnu_always_inline;
3167 case 2: return C23_gnu_always_inline;
3168 case 3: return CXX11_clang_always_inline;
3169 case 4: return C23_clang_always_inline;
3170 case 5: return Keyword_forceinline;
3171 }
3172 }
3173 AlwaysInlineAttr *AlwaysInlineAttr::clone(ASTContext &C) const {
3174 auto *A = new (C) AlwaysInlineAttr(C, *this);
3175 A->Inherited = Inherited;
3176 A->IsPackExpansion = IsPackExpansion;
3177 A->setImplicit(Implicit);
3178 return A;
3179 }
3180
3181 void AlwaysInlineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
3182 bool IsFirstArgument = true; (void)IsFirstArgument;
3183 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
3184 switch (getAttributeSpellingListIndex()) {
3185 default:
3186 llvm_unreachable("Unknown attribute spelling!");
3187 break;
3188 case 0 : {
3189 OS << "__attribute__((always_inline";
3190 OS << "))";
3191 break;
3192 }
3193 case 1 : {
3194 OS << "[[gnu::always_inline";
3195 OS << "]]";
3196 break;
3197 }
3198 case 2 : {
3199 OS << "[[gnu::always_inline";
3200 OS << "]]";
3201 break;
3202 }
3203 case 3 : {
3204 OS << "[[clang::always_inline";
3205 OS << "]]";
3206 break;
3207 }
3208 case 4 : {
3209 OS << "[[clang::always_inline";
3210 OS << "]]";
3211 break;
3212 }
3213 case 5 : {
3214 OS << "__forceinline";
3215 OS << "";
3216 break;
3217 }
3218 }
3219 }
3220
3221 const char *AlwaysInlineAttr::getSpelling() const {
3222 switch (getAttributeSpellingListIndex()) {
3223 default:
3224 llvm_unreachable("Unknown attribute spelling!");
3225 return "(No spelling)";
3226 case 0:
3227 return "always_inline";
3228 case 1:
3229 return "always_inline";
3230 case 2:
3231 return "always_inline";
3232 case 3:
3233 return "always_inline";
3234 case 4:
3235 return "always_inline";
3236 case 5:
3237 return "__forceinline";
3238 }
3239 }
3240
3241
3242 // AnalyzerNoReturnAttr implementation
3243
3244 AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3245 auto *A = new (Ctx) AnalyzerNoReturnAttr(Ctx, CommonInfo);
3246 A->setImplicit(true);
3247 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3248 A->setAttributeSpellingListIndex(0);
3249 return A;
3250 }
3251
3252 AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3253 auto *A = new (Ctx) AnalyzerNoReturnAttr(Ctx, CommonInfo);
3254 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3255 A->setAttributeSpellingListIndex(0);
3256 return A;
3257 }
3258
3259 AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
3260 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
3261 return CreateImplicit(Ctx, I);
3262 }
3263
3264 AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::Create(ASTContext &Ctx, SourceRange Range) {
3265 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
3266 return Create(Ctx, I);
3267 }
3268
3269 AnalyzerNoReturnAttr::AnalyzerNoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3270 )
3271 : InheritableAttr(Ctx, CommonInfo, attr::AnalyzerNoReturn, /*IsLateParsed=*/false, false)
3272 {
3273 }
3274
3275 AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::clone(ASTContext &C) const {
3276 auto *A = new (C) AnalyzerNoReturnAttr(C, *this);
3277 A->Inherited = Inherited;
3278 A->IsPackExpansion = IsPackExpansion;
3279 A->setImplicit(Implicit);
3280 return A;
3281 }
3282
3283 void AnalyzerNoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
3284 bool IsFirstArgument = true; (void)IsFirstArgument;
3285 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
3286 switch (getAttributeSpellingListIndex()) {
3287 default:
3288 llvm_unreachable("Unknown attribute spelling!");
3289 break;
3290 case 0 : {
3291 OS << "__attribute__((analyzer_noreturn";
3292 OS << "))";
3293 break;
3294 }
3295 }
3296 }
3297
3298 const char *AnalyzerNoReturnAttr::getSpelling() const {
3299 switch (getAttributeSpellingListIndex()) {
3300 default:
3301 llvm_unreachable("Unknown attribute spelling!");
3302 return "(No spelling)";
3303 case 0:
3304 return "analyzer_noreturn";
3305 }
3306 }
3307
3308
3309 // AnnotateAttr implementation
3310
3311 AnnotateAttr *AnnotateAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
3312 auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize);
3313 A->setImplicit(true);
3314 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3315 A->setAttributeSpellingListIndex(0);
3316 return A;
3317 }
3318
3319 AnnotateAttr *AnnotateAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
3320 auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize);
3321 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3322 A->setAttributeSpellingListIndex(0);
3323 return A;
3324 }
3325
3326 AnnotateAttr *AnnotateAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
3327 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3328 switch (S) {
3329 case GNU_annotate:
3330 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3331 case CXX11_clang_annotate:
3332 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3333 case C23_clang_annotate:
3334 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3335 default:
3336 llvm_unreachable("Unknown attribute spelling!");
3337 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3338 }
3339 }());
3340 return CreateImplicit(Ctx, Annotation, Args, ArgsSize, I);
3341 }
3342
3343 AnnotateAttr *AnnotateAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
3344 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3345 switch (S) {
3346 case GNU_annotate:
3347 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3348 case CXX11_clang_annotate:
3349 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3350 case C23_clang_annotate:
3351 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3352 default:
3353 llvm_unreachable("Unknown attribute spelling!");
3354 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3355 }
3356 }());
3357 return Create(Ctx, Annotation, Args, ArgsSize, I);
3358 }
3359
3360 AnnotateAttr *AnnotateAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) {
3361 auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo);
3362 A->setImplicit(true);
3363 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3364 A->setAttributeSpellingListIndex(0);
3365 A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize);
3366 return A;
3367 }
3368
3369 AnnotateAttr *AnnotateAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) {
3370 auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo);
3371 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3372 A->setAttributeSpellingListIndex(0);
3373 A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize);
3374 return A;
3375 }
3376
3377 AnnotateAttr *AnnotateAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, Spelling S) {
3378 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3379 switch (S) {
3380 case GNU_annotate:
3381 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3382 case CXX11_clang_annotate:
3383 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3384 case C23_clang_annotate:
3385 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3386 default:
3387 llvm_unreachable("Unknown attribute spelling!");
3388 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3389 }
3390 }());
3391 return CreateImplicitWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I);
3392 }
3393
3394 AnnotateAttr *AnnotateAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, Spelling S) {
3395 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3396 switch (S) {
3397 case GNU_annotate:
3398 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3399 case CXX11_clang_annotate:
3400 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3401 case C23_clang_annotate:
3402 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3403 default:
3404 llvm_unreachable("Unknown attribute spelling!");
3405 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3406 }
3407 }());
3408 return CreateWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I);
3409 }
3410
3411 AnnotateAttr::AnnotateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3412 , llvm::StringRef Annotation
3413 , Expr * *Args, unsigned ArgsSize
3414 )
3415 : InheritableParamOrStmtAttr(Ctx, CommonInfo, attr::Annotate, /*IsLateParsed=*/false, false)
3416 , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength])
3417 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
3418 , delayedArgs_Size(0), delayedArgs_(nullptr)
3419 {
3420 if (!Annotation.empty())
3421 std::memcpy(annotation, Annotation.data(), annotationLength);
3422 std::copy(Args, Args + args_Size, args_);
3423 }
3424
3425 AnnotateAttr::AnnotateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3426 , llvm::StringRef Annotation
3427 )
3428 : InheritableParamOrStmtAttr(Ctx, CommonInfo, attr::Annotate, /*IsLateParsed=*/false, false)
3429 , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength])
3430 , args_Size(0), args_(nullptr)
3431 , delayedArgs_Size(0), delayedArgs_(nullptr)
3432 {
3433 if (!Annotation.empty())
3434 std::memcpy(annotation, Annotation.data(), annotationLength);
3435 }
3436
3437 AnnotateAttr::AnnotateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3438 )
3439 : InheritableParamOrStmtAttr(Ctx, CommonInfo, attr::Annotate, /*IsLateParsed=*/false, false)
3440 , annotationLength(0),annotation(nullptr)
3441 , args_Size(0), args_(nullptr)
3442 , delayedArgs_Size(0), delayedArgs_(nullptr)
3443 {
3444 }
3445
3446
3447
3448
3449
3450 AnnotateAttr *AnnotateAttr::clone(ASTContext &C) const {
3451 auto *A = new (C) AnnotateAttr(C, *this, getAnnotation(), args_, args_Size);
3452 A->Inherited = Inherited;
3453 A->IsPackExpansion = IsPackExpansion;
3454 A->setImplicit(Implicit);
3455 A->setDelayedArgs(C, delayedArgs_, delayedArgs_Size);
3456 return A;
3457 }
3458
3459 void AnnotateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
3460 bool IsFirstArgument = true; (void)IsFirstArgument;
3461 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
3462 switch (getAttributeSpellingListIndex()) {
3463 default:
3464 llvm_unreachable("Unknown attribute spelling!");
3465 break;
3466 case 0 : {
3467 OS << "__attribute__((annotate";
3468 DelimitAttributeArgument(OS, IsFirstArgument);
3469 OS << "\"" << getAnnotation() << "\"";
3470 OS << "";
3471 for (const auto &Val : args()) {
3472 DelimitAttributeArgument(OS, IsFirstArgument);
3473 OS << Val;
3474 }
3475 OS << "";
3476 if (!IsFirstArgument)
3477 OS << ")";
3478 OS << "))";
3479 break;
3480 }
3481 case 1 : {
3482 OS << "[[clang::annotate";
3483 DelimitAttributeArgument(OS, IsFirstArgument);
3484 OS << "\"" << getAnnotation() << "\"";
3485 OS << "";
3486 for (const auto &Val : args()) {
3487 DelimitAttributeArgument(OS, IsFirstArgument);
3488 OS << Val;
3489 }
3490 OS << "";
3491 if (!IsFirstArgument)
3492 OS << ")";
3493 OS << "]]";
3494 break;
3495 }
3496 case 2 : {
3497 OS << "[[clang::annotate";
3498 DelimitAttributeArgument(OS, IsFirstArgument);
3499 OS << "\"" << getAnnotation() << "\"";
3500 OS << "";
3501 for (const auto &Val : args()) {
3502 DelimitAttributeArgument(OS, IsFirstArgument);
3503 OS << Val;
3504 }
3505 OS << "";
3506 if (!IsFirstArgument)
3507 OS << ")";
3508 OS << "]]";
3509 break;
3510 }
3511 }
3512 }
3513
3514 const char *AnnotateAttr::getSpelling() const {
3515 switch (getAttributeSpellingListIndex()) {
3516 default:
3517 llvm_unreachable("Unknown attribute spelling!");
3518 return "(No spelling)";
3519 case 0:
3520 return "annotate";
3521 case 1:
3522 return "annotate";
3523 case 2:
3524 return "annotate";
3525 }
3526 }
3527
3528
3529 // AnnotateTypeAttr implementation
3530
3531 AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
3532 auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize);
3533 A->setImplicit(true);
3534 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3535 A->setAttributeSpellingListIndex(0);
3536 return A;
3537 }
3538
3539 AnnotateTypeAttr *AnnotateTypeAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
3540 auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize);
3541 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3542 A->setAttributeSpellingListIndex(0);
3543 return A;
3544 }
3545
3546 AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
3547 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3548 switch (S) {
3549 case CXX11_clang_annotate_type:
3550 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3551 case C23_clang_annotate_type:
3552 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3553 default:
3554 llvm_unreachable("Unknown attribute spelling!");
3555 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3556 }
3557 }());
3558 return CreateImplicit(Ctx, Annotation, Args, ArgsSize, I);
3559 }
3560
3561 AnnotateTypeAttr *AnnotateTypeAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
3562 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3563 switch (S) {
3564 case CXX11_clang_annotate_type:
3565 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3566 case C23_clang_annotate_type:
3567 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3568 default:
3569 llvm_unreachable("Unknown attribute spelling!");
3570 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3571 }
3572 }());
3573 return Create(Ctx, Annotation, Args, ArgsSize, I);
3574 }
3575
3576 AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) {
3577 auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo);
3578 A->setImplicit(true);
3579 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3580 A->setAttributeSpellingListIndex(0);
3581 A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize);
3582 return A;
3583 }
3584
3585 AnnotateTypeAttr *AnnotateTypeAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) {
3586 auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo);
3587 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3588 A->setAttributeSpellingListIndex(0);
3589 A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize);
3590 return A;
3591 }
3592
3593 AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, Spelling S) {
3594 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3595 switch (S) {
3596 case CXX11_clang_annotate_type:
3597 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3598 case C23_clang_annotate_type:
3599 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3600 default:
3601 llvm_unreachable("Unknown attribute spelling!");
3602 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3603 }
3604 }());
3605 return CreateImplicitWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I);
3606 }
3607
3608 AnnotateTypeAttr *AnnotateTypeAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, Spelling S) {
3609 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3610 switch (S) {
3611 case CXX11_clang_annotate_type:
3612 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3613 case C23_clang_annotate_type:
3614 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3615 default:
3616 llvm_unreachable("Unknown attribute spelling!");
3617 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3618 }
3619 }());
3620 return CreateWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I);
3621 }
3622
3623 AnnotateTypeAttr::AnnotateTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3624 , llvm::StringRef Annotation
3625 , Expr * *Args, unsigned ArgsSize
3626 )
3627 : TypeAttr(Ctx, CommonInfo, attr::AnnotateType, /*IsLateParsed=*/false)
3628 , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength])
3629 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
3630 , delayedArgs_Size(0), delayedArgs_(nullptr)
3631 {
3632 if (!Annotation.empty())
3633 std::memcpy(annotation, Annotation.data(), annotationLength);
3634 std::copy(Args, Args + args_Size, args_);
3635 }
3636
3637 AnnotateTypeAttr::AnnotateTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3638 , llvm::StringRef Annotation
3639 )
3640 : TypeAttr(Ctx, CommonInfo, attr::AnnotateType, /*IsLateParsed=*/false)
3641 , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength])
3642 , args_Size(0), args_(nullptr)
3643 , delayedArgs_Size(0), delayedArgs_(nullptr)
3644 {
3645 if (!Annotation.empty())
3646 std::memcpy(annotation, Annotation.data(), annotationLength);
3647 }
3648
3649 AnnotateTypeAttr::AnnotateTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3650 )
3651 : TypeAttr(Ctx, CommonInfo, attr::AnnotateType, /*IsLateParsed=*/false)
3652 , annotationLength(0),annotation(nullptr)
3653 , args_Size(0), args_(nullptr)
3654 , delayedArgs_Size(0), delayedArgs_(nullptr)
3655 {
3656 }
3657
3658
3659
3660
3661
3662 AnnotateTypeAttr *AnnotateTypeAttr::clone(ASTContext &C) const {
3663 auto *A = new (C) AnnotateTypeAttr(C, *this, getAnnotation(), args_, args_Size);
3664 A->Inherited = Inherited;
3665 A->IsPackExpansion = IsPackExpansion;
3666 A->setImplicit(Implicit);
3667 A->setDelayedArgs(C, delayedArgs_, delayedArgs_Size);
3668 return A;
3669 }
3670
3671 void AnnotateTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
3672 bool IsFirstArgument = true; (void)IsFirstArgument;
3673 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
3674 switch (getAttributeSpellingListIndex()) {
3675 default:
3676 llvm_unreachable("Unknown attribute spelling!");
3677 break;
3678 case 0 : {
3679 OS << "[[clang::annotate_type";
3680 DelimitAttributeArgument(OS, IsFirstArgument);
3681 OS << "\"" << getAnnotation() << "\"";
3682 OS << "";
3683 for (const auto &Val : args()) {
3684 DelimitAttributeArgument(OS, IsFirstArgument);
3685 OS << Val;
3686 }
3687 OS << "";
3688 if (!IsFirstArgument)
3689 OS << ")";
3690 OS << "]]";
3691 break;
3692 }
3693 case 1 : {
3694 OS << "[[clang::annotate_type";
3695 DelimitAttributeArgument(OS, IsFirstArgument);
3696 OS << "\"" << getAnnotation() << "\"";
3697 OS << "";
3698 for (const auto &Val : args()) {
3699 DelimitAttributeArgument(OS, IsFirstArgument);
3700 OS << Val;
3701 }
3702 OS << "";
3703 if (!IsFirstArgument)
3704 OS << ")";
3705 OS << "]]";
3706 break;
3707 }
3708 }
3709 }
3710
3711 const char *AnnotateTypeAttr::getSpelling() const {
3712 switch (getAttributeSpellingListIndex()) {
3713 default:
3714 llvm_unreachable("Unknown attribute spelling!");
3715 return "(No spelling)";
3716 case 0:
3717 return "annotate_type";
3718 case 1:
3719 return "annotate_type";
3720 }
3721 }
3722
3723
3724 // AnyX86InterruptAttr implementation
3725
3726 AnyX86InterruptAttr *AnyX86InterruptAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3727 auto *A = new (Ctx) AnyX86InterruptAttr(Ctx, CommonInfo);
3728 A->setImplicit(true);
3729 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3730 A->setAttributeSpellingListIndex(0);
3731 return A;
3732 }
3733
3734 AnyX86InterruptAttr *AnyX86InterruptAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3735 auto *A = new (Ctx) AnyX86InterruptAttr(Ctx, CommonInfo);
3736 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3737 A->setAttributeSpellingListIndex(0);
3738 return A;
3739 }
3740
3741 AnyX86InterruptAttr *AnyX86InterruptAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
3742 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3743 switch (S) {
3744 case GNU_interrupt:
3745 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3746 case CXX11_gnu_interrupt:
3747 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3748 case C23_gnu_interrupt:
3749 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3750 default:
3751 llvm_unreachable("Unknown attribute spelling!");
3752 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3753 }
3754 }());
3755 return CreateImplicit(Ctx, I);
3756 }
3757
3758 AnyX86InterruptAttr *AnyX86InterruptAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
3759 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3760 switch (S) {
3761 case GNU_interrupt:
3762 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3763 case CXX11_gnu_interrupt:
3764 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3765 case C23_gnu_interrupt:
3766 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3767 default:
3768 llvm_unreachable("Unknown attribute spelling!");
3769 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3770 }
3771 }());
3772 return Create(Ctx, I);
3773 }
3774
3775 AnyX86InterruptAttr::AnyX86InterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3776 )
3777 : InheritableAttr(Ctx, CommonInfo, attr::AnyX86Interrupt, /*IsLateParsed=*/false, false)
3778 {
3779 }
3780
3781 AnyX86InterruptAttr *AnyX86InterruptAttr::clone(ASTContext &C) const {
3782 auto *A = new (C) AnyX86InterruptAttr(C, *this);
3783 A->Inherited = Inherited;
3784 A->IsPackExpansion = IsPackExpansion;
3785 A->setImplicit(Implicit);
3786 return A;
3787 }
3788
3789 void AnyX86InterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
3790 bool IsFirstArgument = true; (void)IsFirstArgument;
3791 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
3792 switch (getAttributeSpellingListIndex()) {
3793 default:
3794 llvm_unreachable("Unknown attribute spelling!");
3795 break;
3796 case 0 : {
3797 OS << "__attribute__((interrupt";
3798 OS << "))";
3799 break;
3800 }
3801 case 1 : {
3802 OS << "[[gnu::interrupt";
3803 OS << "]]";
3804 break;
3805 }
3806 case 2 : {
3807 OS << "[[gnu::interrupt";
3808 OS << "]]";
3809 break;
3810 }
3811 }
3812 }
3813
3814 const char *AnyX86InterruptAttr::getSpelling() const {
3815 switch (getAttributeSpellingListIndex()) {
3816 default:
3817 llvm_unreachable("Unknown attribute spelling!");
3818 return "(No spelling)";
3819 case 0:
3820 return "interrupt";
3821 case 1:
3822 return "interrupt";
3823 case 2:
3824 return "interrupt";
3825 }
3826 }
3827
3828
3829 // AnyX86NoCallerSavedRegistersAttr implementation
3830
3831 AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3832 auto *A = new (Ctx) AnyX86NoCallerSavedRegistersAttr(Ctx, CommonInfo);
3833 A->setImplicit(true);
3834 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3835 A->setAttributeSpellingListIndex(0);
3836 return A;
3837 }
3838
3839 AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3840 auto *A = new (Ctx) AnyX86NoCallerSavedRegistersAttr(Ctx, CommonInfo);
3841 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3842 A->setAttributeSpellingListIndex(0);
3843 return A;
3844 }
3845
3846 AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
3847 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3848 switch (S) {
3849 case GNU_no_caller_saved_registers:
3850 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3851 case CXX11_gnu_no_caller_saved_registers:
3852 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3853 case C23_gnu_no_caller_saved_registers:
3854 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3855 default:
3856 llvm_unreachable("Unknown attribute spelling!");
3857 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3858 }
3859 }());
3860 return CreateImplicit(Ctx, I);
3861 }
3862
3863 AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
3864 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3865 switch (S) {
3866 case GNU_no_caller_saved_registers:
3867 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3868 case CXX11_gnu_no_caller_saved_registers:
3869 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3870 case C23_gnu_no_caller_saved_registers:
3871 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3872 default:
3873 llvm_unreachable("Unknown attribute spelling!");
3874 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3875 }
3876 }());
3877 return Create(Ctx, I);
3878 }
3879
3880 AnyX86NoCallerSavedRegistersAttr::AnyX86NoCallerSavedRegistersAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3881 )
3882 : InheritableAttr(Ctx, CommonInfo, attr::AnyX86NoCallerSavedRegisters, /*IsLateParsed=*/false, false)
3883 {
3884 }
3885
3886 AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::clone(ASTContext &C) const {
3887 auto *A = new (C) AnyX86NoCallerSavedRegistersAttr(C, *this);
3888 A->Inherited = Inherited;
3889 A->IsPackExpansion = IsPackExpansion;
3890 A->setImplicit(Implicit);
3891 return A;
3892 }
3893
3894 void AnyX86NoCallerSavedRegistersAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
3895 bool IsFirstArgument = true; (void)IsFirstArgument;
3896 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
3897 switch (getAttributeSpellingListIndex()) {
3898 default:
3899 llvm_unreachable("Unknown attribute spelling!");
3900 break;
3901 case 0 : {
3902 OS << "__attribute__((no_caller_saved_registers";
3903 OS << "))";
3904 break;
3905 }
3906 case 1 : {
3907 OS << "[[gnu::no_caller_saved_registers";
3908 OS << "]]";
3909 break;
3910 }
3911 case 2 : {
3912 OS << "[[gnu::no_caller_saved_registers";
3913 OS << "]]";
3914 break;
3915 }
3916 }
3917 }
3918
3919 const char *AnyX86NoCallerSavedRegistersAttr::getSpelling() const {
3920 switch (getAttributeSpellingListIndex()) {
3921 default:
3922 llvm_unreachable("Unknown attribute spelling!");
3923 return "(No spelling)";
3924 case 0:
3925 return "no_caller_saved_registers";
3926 case 1:
3927 return "no_caller_saved_registers";
3928 case 2:
3929 return "no_caller_saved_registers";
3930 }
3931 }
3932
3933
3934 // AnyX86NoCfCheckAttr implementation
3935
3936 AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3937 auto *A = new (Ctx) AnyX86NoCfCheckAttr(Ctx, CommonInfo);
3938 A->setImplicit(true);
3939 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3940 A->setAttributeSpellingListIndex(0);
3941 return A;
3942 }
3943
3944 AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
3945 auto *A = new (Ctx) AnyX86NoCfCheckAttr(Ctx, CommonInfo);
3946 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
3947 A->setAttributeSpellingListIndex(0);
3948 return A;
3949 }
3950
3951 AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
3952 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3953 switch (S) {
3954 case GNU_nocf_check:
3955 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3956 case CXX11_gnu_nocf_check:
3957 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3958 case C23_gnu_nocf_check:
3959 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3960 default:
3961 llvm_unreachable("Unknown attribute spelling!");
3962 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3963 }
3964 }());
3965 return CreateImplicit(Ctx, I);
3966 }
3967
3968 AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
3969 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
3970 switch (S) {
3971 case GNU_nocf_check:
3972 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3973 case CXX11_gnu_nocf_check:
3974 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3975 case C23_gnu_nocf_check:
3976 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3977 default:
3978 llvm_unreachable("Unknown attribute spelling!");
3979 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
3980 }
3981 }());
3982 return Create(Ctx, I);
3983 }
3984
3985 AnyX86NoCfCheckAttr::AnyX86NoCfCheckAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
3986 )
3987 : InheritableAttr(Ctx, CommonInfo, attr::AnyX86NoCfCheck, /*IsLateParsed=*/false, false)
3988 {
3989 }
3990
3991 AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::clone(ASTContext &C) const {
3992 auto *A = new (C) AnyX86NoCfCheckAttr(C, *this);
3993 A->Inherited = Inherited;
3994 A->IsPackExpansion = IsPackExpansion;
3995 A->setImplicit(Implicit);
3996 return A;
3997 }
3998
3999 void AnyX86NoCfCheckAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
4000 bool IsFirstArgument = true; (void)IsFirstArgument;
4001 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
4002 switch (getAttributeSpellingListIndex()) {
4003 default:
4004 llvm_unreachable("Unknown attribute spelling!");
4005 break;
4006 case 0 : {
4007 OS << "__attribute__((nocf_check";
4008 OS << "))";
4009 break;
4010 }
4011 case 1 : {
4012 OS << "[[gnu::nocf_check";
4013 OS << "]]";
4014 break;
4015 }
4016 case 2 : {
4017 OS << "[[gnu::nocf_check";
4018 OS << "]]";
4019 break;
4020 }
4021 }
4022 }
4023
4024 const char *AnyX86NoCfCheckAttr::getSpelling() const {
4025 switch (getAttributeSpellingListIndex()) {
4026 default:
4027 llvm_unreachable("Unknown attribute spelling!");
4028 return "(No spelling)";
4029 case 0:
4030 return "nocf_check";
4031 case 1:
4032 return "nocf_check";
4033 case 2:
4034 return "nocf_check";
4035 }
4036 }
4037
4038
4039 // ArcWeakrefUnavailableAttr implementation
4040
4041 ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
4042 auto *A = new (Ctx) ArcWeakrefUnavailableAttr(Ctx, CommonInfo);
4043 A->setImplicit(true);
4044 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4045 A->setAttributeSpellingListIndex(0);
4046 return A;
4047 }
4048
4049 ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
4050 auto *A = new (Ctx) ArcWeakrefUnavailableAttr(Ctx, CommonInfo);
4051 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4052 A->setAttributeSpellingListIndex(0);
4053 return A;
4054 }
4055
4056 ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
4057 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4058 switch (S) {
4059 case GNU_objc_arc_weak_reference_unavailable:
4060 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4061 case CXX11_clang_objc_arc_weak_reference_unavailable:
4062 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4063 case C23_clang_objc_arc_weak_reference_unavailable:
4064 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4065 default:
4066 llvm_unreachable("Unknown attribute spelling!");
4067 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4068 }
4069 }());
4070 return CreateImplicit(Ctx, I);
4071 }
4072
4073 ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
4074 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4075 switch (S) {
4076 case GNU_objc_arc_weak_reference_unavailable:
4077 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4078 case CXX11_clang_objc_arc_weak_reference_unavailable:
4079 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4080 case C23_clang_objc_arc_weak_reference_unavailable:
4081 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4082 default:
4083 llvm_unreachable("Unknown attribute spelling!");
4084 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4085 }
4086 }());
4087 return Create(Ctx, I);
4088 }
4089
4090 ArcWeakrefUnavailableAttr::ArcWeakrefUnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4091 )
4092 : InheritableAttr(Ctx, CommonInfo, attr::ArcWeakrefUnavailable, /*IsLateParsed=*/false, false)
4093 {
4094 }
4095
4096 ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::clone(ASTContext &C) const {
4097 auto *A = new (C) ArcWeakrefUnavailableAttr(C, *this);
4098 A->Inherited = Inherited;
4099 A->IsPackExpansion = IsPackExpansion;
4100 A->setImplicit(Implicit);
4101 return A;
4102 }
4103
4104 void ArcWeakrefUnavailableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
4105 bool IsFirstArgument = true; (void)IsFirstArgument;
4106 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
4107 switch (getAttributeSpellingListIndex()) {
4108 default:
4109 llvm_unreachable("Unknown attribute spelling!");
4110 break;
4111 case 0 : {
4112 OS << "__attribute__((objc_arc_weak_reference_unavailable";
4113 OS << "))";
4114 break;
4115 }
4116 case 1 : {
4117 OS << "[[clang::objc_arc_weak_reference_unavailable";
4118 OS << "]]";
4119 break;
4120 }
4121 case 2 : {
4122 OS << "[[clang::objc_arc_weak_reference_unavailable";
4123 OS << "]]";
4124 break;
4125 }
4126 }
4127 }
4128
4129 const char *ArcWeakrefUnavailableAttr::getSpelling() const {
4130 switch (getAttributeSpellingListIndex()) {
4131 default:
4132 llvm_unreachable("Unknown attribute spelling!");
4133 return "(No spelling)";
4134 case 0:
4135 return "objc_arc_weak_reference_unavailable";
4136 case 1:
4137 return "objc_arc_weak_reference_unavailable";
4138 case 2:
4139 return "objc_arc_weak_reference_unavailable";
4140 }
4141 }
4142
4143
4144 // ArgumentWithTypeTagAttr implementation
4145
4146 ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, const AttributeCommonInfo &CommonInfo) {
4147 auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer);
4148 A->setImplicit(true);
4149 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4150 A->setAttributeSpellingListIndex(0);
4151 return A;
4152 }
4153
4154 ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, const AttributeCommonInfo &CommonInfo) {
4155 auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer);
4156 return A;
4157 }
4158
4159 ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, SourceRange Range, Spelling S) {
4160 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4161 switch (S) {
4162 case GNU_argument_with_type_tag:
4163 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4164 case CXX11_clang_argument_with_type_tag:
4165 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4166 case C23_clang_argument_with_type_tag:
4167 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4168 case GNU_pointer_with_type_tag:
4169 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4170 case CXX11_clang_pointer_with_type_tag:
4171 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4172 case C23_clang_pointer_with_type_tag:
4173 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4174 default:
4175 llvm_unreachable("Unknown attribute spelling!");
4176 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4177 }
4178 }());
4179 return CreateImplicit(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer, I);
4180 }
4181
4182 ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, SourceRange Range, Spelling S) {
4183 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4184 switch (S) {
4185 case GNU_argument_with_type_tag:
4186 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4187 case CXX11_clang_argument_with_type_tag:
4188 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4189 case C23_clang_argument_with_type_tag:
4190 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4191 case GNU_pointer_with_type_tag:
4192 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4193 case CXX11_clang_pointer_with_type_tag:
4194 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4195 case C23_clang_pointer_with_type_tag:
4196 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4197 default:
4198 llvm_unreachable("Unknown attribute spelling!");
4199 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4200 }
4201 }());
4202 return Create(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer, I);
4203 }
4204
4205 ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, const AttributeCommonInfo &CommonInfo) {
4206 auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx);
4207 A->setImplicit(true);
4208 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4209 A->setAttributeSpellingListIndex(0);
4210 return A;
4211 }
4212
4213 ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, const AttributeCommonInfo &CommonInfo) {
4214 auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx);
4215 return A;
4216 }
4217
4218 ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, SourceRange Range, Spelling S) {
4219 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4220 switch (S) {
4221 case GNU_argument_with_type_tag:
4222 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4223 case CXX11_clang_argument_with_type_tag:
4224 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4225 case C23_clang_argument_with_type_tag:
4226 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4227 case GNU_pointer_with_type_tag:
4228 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4229 case CXX11_clang_pointer_with_type_tag:
4230 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4231 case C23_clang_pointer_with_type_tag:
4232 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4233 default:
4234 llvm_unreachable("Unknown attribute spelling!");
4235 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4236 }
4237 }());
4238 return CreateImplicit(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, I);
4239 }
4240
4241 ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, SourceRange Range, Spelling S) {
4242 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4243 switch (S) {
4244 case GNU_argument_with_type_tag:
4245 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4246 case CXX11_clang_argument_with_type_tag:
4247 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4248 case C23_clang_argument_with_type_tag:
4249 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4250 case GNU_pointer_with_type_tag:
4251 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4252 case CXX11_clang_pointer_with_type_tag:
4253 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4254 case C23_clang_pointer_with_type_tag:
4255 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4256 default:
4257 llvm_unreachable("Unknown attribute spelling!");
4258 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4259 }
4260 }());
4261 return Create(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, I);
4262 }
4263
4264 ArgumentWithTypeTagAttr::ArgumentWithTypeTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4265 , IdentifierInfo * ArgumentKind
4266 , ParamIdx ArgumentIdx
4267 , ParamIdx TypeTagIdx
4268 , bool IsPointer
4269 )
4270 : InheritableAttr(Ctx, CommonInfo, attr::ArgumentWithTypeTag, /*IsLateParsed=*/false, false)
4271 , argumentKind(ArgumentKind)
4272 , argumentIdx(ArgumentIdx)
4273 , typeTagIdx(TypeTagIdx)
4274 , isPointer(IsPointer)
4275 {
4276 }
4277
4278 ArgumentWithTypeTagAttr::ArgumentWithTypeTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4279 , IdentifierInfo * ArgumentKind
4280 , ParamIdx ArgumentIdx
4281 , ParamIdx TypeTagIdx
4282 )
4283 : InheritableAttr(Ctx, CommonInfo, attr::ArgumentWithTypeTag, /*IsLateParsed=*/false, false)
4284 , argumentKind(ArgumentKind)
4285 , argumentIdx(ArgumentIdx)
4286 , typeTagIdx(TypeTagIdx)
4287 , isPointer()
4288 {
4289 }
4290
4291 ArgumentWithTypeTagAttr::Spelling ArgumentWithTypeTagAttr::getSemanticSpelling() const {
4292 switch (getAttributeSpellingListIndex()) {
4293 default: llvm_unreachable("Unknown spelling list index");
4294 case 0: return GNU_argument_with_type_tag;
4295 case 1: return CXX11_clang_argument_with_type_tag;
4296 case 2: return C23_clang_argument_with_type_tag;
4297 case 3: return GNU_pointer_with_type_tag;
4298 case 4: return CXX11_clang_pointer_with_type_tag;
4299 case 5: return C23_clang_pointer_with_type_tag;
4300 }
4301 }
4302
4303
4304
4305
4306
4307
4308
4309
4310 ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::clone(ASTContext &C) const {
4311 auto *A = new (C) ArgumentWithTypeTagAttr(C, *this, argumentKind, argumentIdx, typeTagIdx, isPointer);
4312 A->Inherited = Inherited;
4313 A->IsPackExpansion = IsPackExpansion;
4314 A->setImplicit(Implicit);
4315 return A;
4316 }
4317
4318 void ArgumentWithTypeTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
4319 bool IsFirstArgument = true; (void)IsFirstArgument;
4320 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
4321 switch (getAttributeSpellingListIndex()) {
4322 default:
4323 llvm_unreachable("Unknown attribute spelling!");
4324 break;
4325 case 0 : {
4326 OS << "__attribute__((argument_with_type_tag";
4327 DelimitAttributeArgument(OS, IsFirstArgument);
4328 OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << "";
4329 DelimitAttributeArgument(OS, IsFirstArgument);
4330 OS << "" << getArgumentIdx().getSourceIndex() << "";
4331 DelimitAttributeArgument(OS, IsFirstArgument);
4332 OS << "" << getTypeTagIdx().getSourceIndex() << "";
4333 if (!IsFirstArgument)
4334 OS << ")";
4335 OS << "))";
4336 break;
4337 }
4338 case 1 : {
4339 OS << "[[clang::argument_with_type_tag";
4340 DelimitAttributeArgument(OS, IsFirstArgument);
4341 OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << "";
4342 DelimitAttributeArgument(OS, IsFirstArgument);
4343 OS << "" << getArgumentIdx().getSourceIndex() << "";
4344 DelimitAttributeArgument(OS, IsFirstArgument);
4345 OS << "" << getTypeTagIdx().getSourceIndex() << "";
4346 if (!IsFirstArgument)
4347 OS << ")";
4348 OS << "]]";
4349 break;
4350 }
4351 case 2 : {
4352 OS << "[[clang::argument_with_type_tag";
4353 DelimitAttributeArgument(OS, IsFirstArgument);
4354 OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << "";
4355 DelimitAttributeArgument(OS, IsFirstArgument);
4356 OS << "" << getArgumentIdx().getSourceIndex() << "";
4357 DelimitAttributeArgument(OS, IsFirstArgument);
4358 OS << "" << getTypeTagIdx().getSourceIndex() << "";
4359 if (!IsFirstArgument)
4360 OS << ")";
4361 OS << "]]";
4362 break;
4363 }
4364 case 3 : {
4365 OS << "__attribute__((pointer_with_type_tag";
4366 DelimitAttributeArgument(OS, IsFirstArgument);
4367 OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << "";
4368 DelimitAttributeArgument(OS, IsFirstArgument);
4369 OS << "" << getArgumentIdx().getSourceIndex() << "";
4370 DelimitAttributeArgument(OS, IsFirstArgument);
4371 OS << "" << getTypeTagIdx().getSourceIndex() << "";
4372 if (!IsFirstArgument)
4373 OS << ")";
4374 OS << "))";
4375 break;
4376 }
4377 case 4 : {
4378 OS << "[[clang::pointer_with_type_tag";
4379 DelimitAttributeArgument(OS, IsFirstArgument);
4380 OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << "";
4381 DelimitAttributeArgument(OS, IsFirstArgument);
4382 OS << "" << getArgumentIdx().getSourceIndex() << "";
4383 DelimitAttributeArgument(OS, IsFirstArgument);
4384 OS << "" << getTypeTagIdx().getSourceIndex() << "";
4385 if (!IsFirstArgument)
4386 OS << ")";
4387 OS << "]]";
4388 break;
4389 }
4390 case 5 : {
4391 OS << "[[clang::pointer_with_type_tag";
4392 DelimitAttributeArgument(OS, IsFirstArgument);
4393 OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << "";
4394 DelimitAttributeArgument(OS, IsFirstArgument);
4395 OS << "" << getArgumentIdx().getSourceIndex() << "";
4396 DelimitAttributeArgument(OS, IsFirstArgument);
4397 OS << "" << getTypeTagIdx().getSourceIndex() << "";
4398 if (!IsFirstArgument)
4399 OS << ")";
4400 OS << "]]";
4401 break;
4402 }
4403 }
4404 }
4405
4406 const char *ArgumentWithTypeTagAttr::getSpelling() const {
4407 switch (getAttributeSpellingListIndex()) {
4408 default:
4409 llvm_unreachable("Unknown attribute spelling!");
4410 return "(No spelling)";
4411 case 0:
4412 return "argument_with_type_tag";
4413 case 1:
4414 return "argument_with_type_tag";
4415 case 2:
4416 return "argument_with_type_tag";
4417 case 3:
4418 return "pointer_with_type_tag";
4419 case 4:
4420 return "pointer_with_type_tag";
4421 case 5:
4422 return "pointer_with_type_tag";
4423 }
4424 }
4425
4426
4427 // ArmAgnosticAttr implementation
4428
4429 ArmAgnosticAttr *ArmAgnosticAttr::CreateImplicit(ASTContext &Ctx, StringRef *AgnosticArgs, unsigned AgnosticArgsSize, const AttributeCommonInfo &CommonInfo) {
4430 auto *A = new (Ctx) ArmAgnosticAttr(Ctx, CommonInfo, AgnosticArgs, AgnosticArgsSize);
4431 A->setImplicit(true);
4432 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4433 A->setAttributeSpellingListIndex(0);
4434 return A;
4435 }
4436
4437 ArmAgnosticAttr *ArmAgnosticAttr::Create(ASTContext &Ctx, StringRef *AgnosticArgs, unsigned AgnosticArgsSize, const AttributeCommonInfo &CommonInfo) {
4438 auto *A = new (Ctx) ArmAgnosticAttr(Ctx, CommonInfo, AgnosticArgs, AgnosticArgsSize);
4439 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4440 A->setAttributeSpellingListIndex(0);
4441 return A;
4442 }
4443
4444 ArmAgnosticAttr *ArmAgnosticAttr::CreateImplicit(ASTContext &Ctx, StringRef *AgnosticArgs, unsigned AgnosticArgsSize, SourceRange Range) {
4445 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
4446 return CreateImplicit(Ctx, AgnosticArgs, AgnosticArgsSize, I);
4447 }
4448
4449 ArmAgnosticAttr *ArmAgnosticAttr::Create(ASTContext &Ctx, StringRef *AgnosticArgs, unsigned AgnosticArgsSize, SourceRange Range) {
4450 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
4451 return Create(Ctx, AgnosticArgs, AgnosticArgsSize, I);
4452 }
4453
4454 ArmAgnosticAttr::ArmAgnosticAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4455 , StringRef *AgnosticArgs, unsigned AgnosticArgsSize
4456 )
4457 : TypeAttr(Ctx, CommonInfo, attr::ArmAgnostic, /*IsLateParsed=*/false)
4458 , agnosticArgs_Size(AgnosticArgsSize), agnosticArgs_(new (Ctx, 16) StringRef[agnosticArgs_Size])
4459 {
4460 for (size_t I = 0, E = agnosticArgs_Size; I != E;
4461 ++I) {
4462 StringRef Ref = AgnosticArgs[I];
4463 if (!Ref.empty()) {
4464 char *Mem = new (Ctx, 1) char[Ref.size()];
4465 std::memcpy(Mem, Ref.data(), Ref.size());
4466 agnosticArgs_[I] = StringRef(Mem, Ref.size());
4467 }
4468 }
4469 }
4470
4471 ArmAgnosticAttr::ArmAgnosticAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4472 )
4473 : TypeAttr(Ctx, CommonInfo, attr::ArmAgnostic, /*IsLateParsed=*/false)
4474 , agnosticArgs_Size(0), agnosticArgs_(nullptr)
4475 {
4476 }
4477
4478
4479
4480 ArmAgnosticAttr *ArmAgnosticAttr::clone(ASTContext &C) const {
4481 auto *A = new (C) ArmAgnosticAttr(C, *this, agnosticArgs_, agnosticArgs_Size);
4482 A->Inherited = Inherited;
4483 A->IsPackExpansion = IsPackExpansion;
4484 A->setImplicit(Implicit);
4485 return A;
4486 }
4487
4488 void ArmAgnosticAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
4489 bool IsFirstArgument = true; (void)IsFirstArgument;
4490 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
4491 switch (getAttributeSpellingListIndex()) {
4492 default:
4493 llvm_unreachable("Unknown attribute spelling!");
4494 break;
4495 case 0 : {
4496 OS << "__arm_agnostic";
4497 OS << "";
4498 for (const auto &Val : agnosticArgs()) {
4499 DelimitAttributeArgument(OS, IsFirstArgument);
4500 OS << "\"" << Val << "\"";
4501 }
4502 OS << "";
4503 if (!IsFirstArgument)
4504 OS << ")";
4505 OS << "";
4506 break;
4507 }
4508 }
4509 }
4510
4511 const char *ArmAgnosticAttr::getSpelling() const {
4512 switch (getAttributeSpellingListIndex()) {
4513 default:
4514 llvm_unreachable("Unknown attribute spelling!");
4515 return "(No spelling)";
4516 case 0:
4517 return "__arm_agnostic";
4518 }
4519 }
4520
4521
4522 // ArmBuiltinAliasAttr implementation
4523
4524 ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) {
4525 auto *A = new (Ctx) ArmBuiltinAliasAttr(Ctx, CommonInfo, BuiltinName);
4526 A->setImplicit(true);
4527 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4528 A->setAttributeSpellingListIndex(0);
4529 return A;
4530 }
4531
4532 ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) {
4533 auto *A = new (Ctx) ArmBuiltinAliasAttr(Ctx, CommonInfo, BuiltinName);
4534 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4535 A->setAttributeSpellingListIndex(0);
4536 return A;
4537 }
4538
4539 ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, Spelling S) {
4540 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4541 switch (S) {
4542 case GNU_clang_arm_builtin_alias:
4543 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4544 case CXX11_clang_clang_arm_builtin_alias:
4545 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4546 case C23_clang_clang_arm_builtin_alias:
4547 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4548 default:
4549 llvm_unreachable("Unknown attribute spelling!");
4550 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4551 }
4552 }());
4553 return CreateImplicit(Ctx, BuiltinName, I);
4554 }
4555
4556 ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, Spelling S) {
4557 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4558 switch (S) {
4559 case GNU_clang_arm_builtin_alias:
4560 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4561 case CXX11_clang_clang_arm_builtin_alias:
4562 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4563 case C23_clang_clang_arm_builtin_alias:
4564 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4565 default:
4566 llvm_unreachable("Unknown attribute spelling!");
4567 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4568 }
4569 }());
4570 return Create(Ctx, BuiltinName, I);
4571 }
4572
4573 ArmBuiltinAliasAttr::ArmBuiltinAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4574 , IdentifierInfo * BuiltinName
4575 )
4576 : InheritableAttr(Ctx, CommonInfo, attr::ArmBuiltinAlias, /*IsLateParsed=*/false, false)
4577 , builtinName(BuiltinName)
4578 {
4579 }
4580
4581
4582
4583 ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::clone(ASTContext &C) const {
4584 auto *A = new (C) ArmBuiltinAliasAttr(C, *this, builtinName);
4585 A->Inherited = Inherited;
4586 A->IsPackExpansion = IsPackExpansion;
4587 A->setImplicit(Implicit);
4588 return A;
4589 }
4590
4591 void ArmBuiltinAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
4592 bool IsFirstArgument = true; (void)IsFirstArgument;
4593 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
4594 switch (getAttributeSpellingListIndex()) {
4595 default:
4596 llvm_unreachable("Unknown attribute spelling!");
4597 break;
4598 case 0 : {
4599 OS << "__attribute__((__clang_arm_builtin_alias";
4600 DelimitAttributeArgument(OS, IsFirstArgument);
4601 OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << "";
4602 if (!IsFirstArgument)
4603 OS << ")";
4604 OS << "))";
4605 break;
4606 }
4607 case 1 : {
4608 OS << "[[clang::__clang_arm_builtin_alias";
4609 DelimitAttributeArgument(OS, IsFirstArgument);
4610 OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << "";
4611 if (!IsFirstArgument)
4612 OS << ")";
4613 OS << "]]";
4614 break;
4615 }
4616 case 2 : {
4617 OS << "[[clang::__clang_arm_builtin_alias";
4618 DelimitAttributeArgument(OS, IsFirstArgument);
4619 OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << "";
4620 if (!IsFirstArgument)
4621 OS << ")";
4622 OS << "]]";
4623 break;
4624 }
4625 }
4626 }
4627
4628 const char *ArmBuiltinAliasAttr::getSpelling() const {
4629 switch (getAttributeSpellingListIndex()) {
4630 default:
4631 llvm_unreachable("Unknown attribute spelling!");
4632 return "(No spelling)";
4633 case 0:
4634 return "__clang_arm_builtin_alias";
4635 case 1:
4636 return "__clang_arm_builtin_alias";
4637 case 2:
4638 return "__clang_arm_builtin_alias";
4639 }
4640 }
4641
4642
4643 // ArmInAttr implementation
4644
4645 ArmInAttr *ArmInAttr::CreateImplicit(ASTContext &Ctx, StringRef *InArgs, unsigned InArgsSize, const AttributeCommonInfo &CommonInfo) {
4646 auto *A = new (Ctx) ArmInAttr(Ctx, CommonInfo, InArgs, InArgsSize);
4647 A->setImplicit(true);
4648 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4649 A->setAttributeSpellingListIndex(0);
4650 return A;
4651 }
4652
4653 ArmInAttr *ArmInAttr::Create(ASTContext &Ctx, StringRef *InArgs, unsigned InArgsSize, const AttributeCommonInfo &CommonInfo) {
4654 auto *A = new (Ctx) ArmInAttr(Ctx, CommonInfo, InArgs, InArgsSize);
4655 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4656 A->setAttributeSpellingListIndex(0);
4657 return A;
4658 }
4659
4660 ArmInAttr *ArmInAttr::CreateImplicit(ASTContext &Ctx, StringRef *InArgs, unsigned InArgsSize, SourceRange Range) {
4661 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
4662 return CreateImplicit(Ctx, InArgs, InArgsSize, I);
4663 }
4664
4665 ArmInAttr *ArmInAttr::Create(ASTContext &Ctx, StringRef *InArgs, unsigned InArgsSize, SourceRange Range) {
4666 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
4667 return Create(Ctx, InArgs, InArgsSize, I);
4668 }
4669
4670 ArmInAttr::ArmInAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4671 , StringRef *InArgs, unsigned InArgsSize
4672 )
4673 : TypeAttr(Ctx, CommonInfo, attr::ArmIn, /*IsLateParsed=*/false)
4674 , inArgs_Size(InArgsSize), inArgs_(new (Ctx, 16) StringRef[inArgs_Size])
4675 {
4676 for (size_t I = 0, E = inArgs_Size; I != E;
4677 ++I) {
4678 StringRef Ref = InArgs[I];
4679 if (!Ref.empty()) {
4680 char *Mem = new (Ctx, 1) char[Ref.size()];
4681 std::memcpy(Mem, Ref.data(), Ref.size());
4682 inArgs_[I] = StringRef(Mem, Ref.size());
4683 }
4684 }
4685 }
4686
4687 ArmInAttr::ArmInAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4688 )
4689 : TypeAttr(Ctx, CommonInfo, attr::ArmIn, /*IsLateParsed=*/false)
4690 , inArgs_Size(0), inArgs_(nullptr)
4691 {
4692 }
4693
4694
4695
4696 ArmInAttr *ArmInAttr::clone(ASTContext &C) const {
4697 auto *A = new (C) ArmInAttr(C, *this, inArgs_, inArgs_Size);
4698 A->Inherited = Inherited;
4699 A->IsPackExpansion = IsPackExpansion;
4700 A->setImplicit(Implicit);
4701 return A;
4702 }
4703
4704 void ArmInAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
4705 bool IsFirstArgument = true; (void)IsFirstArgument;
4706 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
4707 switch (getAttributeSpellingListIndex()) {
4708 default:
4709 llvm_unreachable("Unknown attribute spelling!");
4710 break;
4711 case 0 : {
4712 OS << "__arm_in";
4713 OS << "";
4714 for (const auto &Val : inArgs()) {
4715 DelimitAttributeArgument(OS, IsFirstArgument);
4716 OS << "\"" << Val << "\"";
4717 }
4718 OS << "";
4719 if (!IsFirstArgument)
4720 OS << ")";
4721 OS << "";
4722 break;
4723 }
4724 }
4725 }
4726
4727 const char *ArmInAttr::getSpelling() const {
4728 switch (getAttributeSpellingListIndex()) {
4729 default:
4730 llvm_unreachable("Unknown attribute spelling!");
4731 return "(No spelling)";
4732 case 0:
4733 return "__arm_in";
4734 }
4735 }
4736
4737
4738 // ArmInOutAttr implementation
4739
4740 ArmInOutAttr *ArmInOutAttr::CreateImplicit(ASTContext &Ctx, StringRef *InOutArgs, unsigned InOutArgsSize, const AttributeCommonInfo &CommonInfo) {
4741 auto *A = new (Ctx) ArmInOutAttr(Ctx, CommonInfo, InOutArgs, InOutArgsSize);
4742 A->setImplicit(true);
4743 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4744 A->setAttributeSpellingListIndex(0);
4745 return A;
4746 }
4747
4748 ArmInOutAttr *ArmInOutAttr::Create(ASTContext &Ctx, StringRef *InOutArgs, unsigned InOutArgsSize, const AttributeCommonInfo &CommonInfo) {
4749 auto *A = new (Ctx) ArmInOutAttr(Ctx, CommonInfo, InOutArgs, InOutArgsSize);
4750 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4751 A->setAttributeSpellingListIndex(0);
4752 return A;
4753 }
4754
4755 ArmInOutAttr *ArmInOutAttr::CreateImplicit(ASTContext &Ctx, StringRef *InOutArgs, unsigned InOutArgsSize, SourceRange Range) {
4756 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
4757 return CreateImplicit(Ctx, InOutArgs, InOutArgsSize, I);
4758 }
4759
4760 ArmInOutAttr *ArmInOutAttr::Create(ASTContext &Ctx, StringRef *InOutArgs, unsigned InOutArgsSize, SourceRange Range) {
4761 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
4762 return Create(Ctx, InOutArgs, InOutArgsSize, I);
4763 }
4764
4765 ArmInOutAttr::ArmInOutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4766 , StringRef *InOutArgs, unsigned InOutArgsSize
4767 )
4768 : TypeAttr(Ctx, CommonInfo, attr::ArmInOut, /*IsLateParsed=*/false)
4769 , inOutArgs_Size(InOutArgsSize), inOutArgs_(new (Ctx, 16) StringRef[inOutArgs_Size])
4770 {
4771 for (size_t I = 0, E = inOutArgs_Size; I != E;
4772 ++I) {
4773 StringRef Ref = InOutArgs[I];
4774 if (!Ref.empty()) {
4775 char *Mem = new (Ctx, 1) char[Ref.size()];
4776 std::memcpy(Mem, Ref.data(), Ref.size());
4777 inOutArgs_[I] = StringRef(Mem, Ref.size());
4778 }
4779 }
4780 }
4781
4782 ArmInOutAttr::ArmInOutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4783 )
4784 : TypeAttr(Ctx, CommonInfo, attr::ArmInOut, /*IsLateParsed=*/false)
4785 , inOutArgs_Size(0), inOutArgs_(nullptr)
4786 {
4787 }
4788
4789
4790
4791 ArmInOutAttr *ArmInOutAttr::clone(ASTContext &C) const {
4792 auto *A = new (C) ArmInOutAttr(C, *this, inOutArgs_, inOutArgs_Size);
4793 A->Inherited = Inherited;
4794 A->IsPackExpansion = IsPackExpansion;
4795 A->setImplicit(Implicit);
4796 return A;
4797 }
4798
4799 void ArmInOutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
4800 bool IsFirstArgument = true; (void)IsFirstArgument;
4801 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
4802 switch (getAttributeSpellingListIndex()) {
4803 default:
4804 llvm_unreachable("Unknown attribute spelling!");
4805 break;
4806 case 0 : {
4807 OS << "__arm_inout";
4808 OS << "";
4809 for (const auto &Val : inOutArgs()) {
4810 DelimitAttributeArgument(OS, IsFirstArgument);
4811 OS << "\"" << Val << "\"";
4812 }
4813 OS << "";
4814 if (!IsFirstArgument)
4815 OS << ")";
4816 OS << "";
4817 break;
4818 }
4819 }
4820 }
4821
4822 const char *ArmInOutAttr::getSpelling() const {
4823 switch (getAttributeSpellingListIndex()) {
4824 default:
4825 llvm_unreachable("Unknown attribute spelling!");
4826 return "(No spelling)";
4827 case 0:
4828 return "__arm_inout";
4829 }
4830 }
4831
4832
4833 // ArmLocallyStreamingAttr implementation
4834
4835 ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
4836 auto *A = new (Ctx) ArmLocallyStreamingAttr(Ctx, CommonInfo);
4837 A->setImplicit(true);
4838 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4839 A->setAttributeSpellingListIndex(0);
4840 return A;
4841 }
4842
4843 ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
4844 auto *A = new (Ctx) ArmLocallyStreamingAttr(Ctx, CommonInfo);
4845 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4846 A->setAttributeSpellingListIndex(0);
4847 return A;
4848 }
4849
4850 ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
4851 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
4852 return CreateImplicit(Ctx, I);
4853 }
4854
4855 ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::Create(ASTContext &Ctx, SourceRange Range) {
4856 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
4857 return Create(Ctx, I);
4858 }
4859
4860 ArmLocallyStreamingAttr::ArmLocallyStreamingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4861 )
4862 : InheritableAttr(Ctx, CommonInfo, attr::ArmLocallyStreaming, /*IsLateParsed=*/false, false)
4863 {
4864 }
4865
4866 ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::clone(ASTContext &C) const {
4867 auto *A = new (C) ArmLocallyStreamingAttr(C, *this);
4868 A->Inherited = Inherited;
4869 A->IsPackExpansion = IsPackExpansion;
4870 A->setImplicit(Implicit);
4871 return A;
4872 }
4873
4874 void ArmLocallyStreamingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
4875 bool IsFirstArgument = true; (void)IsFirstArgument;
4876 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
4877 switch (getAttributeSpellingListIndex()) {
4878 default:
4879 llvm_unreachable("Unknown attribute spelling!");
4880 break;
4881 case 0 : {
4882 OS << "__arm_locally_streaming";
4883 OS << "";
4884 break;
4885 }
4886 }
4887 }
4888
4889 const char *ArmLocallyStreamingAttr::getSpelling() const {
4890 switch (getAttributeSpellingListIndex()) {
4891 default:
4892 llvm_unreachable("Unknown attribute spelling!");
4893 return "(No spelling)";
4894 case 0:
4895 return "__arm_locally_streaming";
4896 }
4897 }
4898
4899
4900 // ArmMveStrictPolymorphismAttr implementation
4901
4902 ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
4903 auto *A = new (Ctx) ArmMveStrictPolymorphismAttr(Ctx, CommonInfo);
4904 A->setImplicit(true);
4905 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4906 A->setAttributeSpellingListIndex(0);
4907 return A;
4908 }
4909
4910 ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
4911 auto *A = new (Ctx) ArmMveStrictPolymorphismAttr(Ctx, CommonInfo);
4912 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
4913 A->setAttributeSpellingListIndex(0);
4914 return A;
4915 }
4916
4917 ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
4918 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4919 switch (S) {
4920 case GNU_clang_arm_mve_strict_polymorphism:
4921 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4922 case CXX11_clang_clang_arm_mve_strict_polymorphism:
4923 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4924 case C23_clang_clang_arm_mve_strict_polymorphism:
4925 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4926 default:
4927 llvm_unreachable("Unknown attribute spelling!");
4928 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4929 }
4930 }());
4931 return CreateImplicit(Ctx, I);
4932 }
4933
4934 ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
4935 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
4936 switch (S) {
4937 case GNU_clang_arm_mve_strict_polymorphism:
4938 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4939 case CXX11_clang_clang_arm_mve_strict_polymorphism:
4940 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4941 case C23_clang_clang_arm_mve_strict_polymorphism:
4942 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4943 default:
4944 llvm_unreachable("Unknown attribute spelling!");
4945 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
4946 }
4947 }());
4948 return Create(Ctx, I);
4949 }
4950
4951 ArmMveStrictPolymorphismAttr::ArmMveStrictPolymorphismAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
4952 )
4953 : TypeAttr(Ctx, CommonInfo, attr::ArmMveStrictPolymorphism, /*IsLateParsed=*/false)
4954 {
4955 }
4956
4957 ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::clone(ASTContext &C) const {
4958 auto *A = new (C) ArmMveStrictPolymorphismAttr(C, *this);
4959 A->Inherited = Inherited;
4960 A->IsPackExpansion = IsPackExpansion;
4961 A->setImplicit(Implicit);
4962 return A;
4963 }
4964
4965 void ArmMveStrictPolymorphismAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
4966 bool IsFirstArgument = true; (void)IsFirstArgument;
4967 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
4968 switch (getAttributeSpellingListIndex()) {
4969 default:
4970 llvm_unreachable("Unknown attribute spelling!");
4971 break;
4972 case 0 : {
4973 OS << "__attribute__((__clang_arm_mve_strict_polymorphism";
4974 OS << "))";
4975 break;
4976 }
4977 case 1 : {
4978 OS << "[[clang::__clang_arm_mve_strict_polymorphism";
4979 OS << "]]";
4980 break;
4981 }
4982 case 2 : {
4983 OS << "[[clang::__clang_arm_mve_strict_polymorphism";
4984 OS << "]]";
4985 break;
4986 }
4987 }
4988 }
4989
4990 const char *ArmMveStrictPolymorphismAttr::getSpelling() const {
4991 switch (getAttributeSpellingListIndex()) {
4992 default:
4993 llvm_unreachable("Unknown attribute spelling!");
4994 return "(No spelling)";
4995 case 0:
4996 return "__clang_arm_mve_strict_polymorphism";
4997 case 1:
4998 return "__clang_arm_mve_strict_polymorphism";
4999 case 2:
5000 return "__clang_arm_mve_strict_polymorphism";
5001 }
5002 }
5003
5004
5005 // ArmNewAttr implementation
5006
5007 ArmNewAttr *ArmNewAttr::CreateImplicit(ASTContext &Ctx, StringRef *NewArgs, unsigned NewArgsSize, const AttributeCommonInfo &CommonInfo) {
5008 auto *A = new (Ctx) ArmNewAttr(Ctx, CommonInfo, NewArgs, NewArgsSize);
5009 A->setImplicit(true);
5010 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5011 A->setAttributeSpellingListIndex(0);
5012 return A;
5013 }
5014
5015 ArmNewAttr *ArmNewAttr::Create(ASTContext &Ctx, StringRef *NewArgs, unsigned NewArgsSize, const AttributeCommonInfo &CommonInfo) {
5016 auto *A = new (Ctx) ArmNewAttr(Ctx, CommonInfo, NewArgs, NewArgsSize);
5017 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5018 A->setAttributeSpellingListIndex(0);
5019 return A;
5020 }
5021
5022 ArmNewAttr *ArmNewAttr::CreateImplicit(ASTContext &Ctx, StringRef *NewArgs, unsigned NewArgsSize, SourceRange Range) {
5023 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5024 return CreateImplicit(Ctx, NewArgs, NewArgsSize, I);
5025 }
5026
5027 ArmNewAttr *ArmNewAttr::Create(ASTContext &Ctx, StringRef *NewArgs, unsigned NewArgsSize, SourceRange Range) {
5028 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5029 return Create(Ctx, NewArgs, NewArgsSize, I);
5030 }
5031
5032 ArmNewAttr::ArmNewAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5033 , StringRef *NewArgs, unsigned NewArgsSize
5034 )
5035 : InheritableAttr(Ctx, CommonInfo, attr::ArmNew, /*IsLateParsed=*/false, false)
5036 , newArgs_Size(NewArgsSize), newArgs_(new (Ctx, 16) StringRef[newArgs_Size])
5037 {
5038 for (size_t I = 0, E = newArgs_Size; I != E;
5039 ++I) {
5040 StringRef Ref = NewArgs[I];
5041 if (!Ref.empty()) {
5042 char *Mem = new (Ctx, 1) char[Ref.size()];
5043 std::memcpy(Mem, Ref.data(), Ref.size());
5044 newArgs_[I] = StringRef(Mem, Ref.size());
5045 }
5046 }
5047 }
5048
5049 ArmNewAttr::ArmNewAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5050 )
5051 : InheritableAttr(Ctx, CommonInfo, attr::ArmNew, /*IsLateParsed=*/false, false)
5052 , newArgs_Size(0), newArgs_(nullptr)
5053 {
5054 }
5055
5056
5057
5058 ArmNewAttr *ArmNewAttr::clone(ASTContext &C) const {
5059 auto *A = new (C) ArmNewAttr(C, *this, newArgs_, newArgs_Size);
5060 A->Inherited = Inherited;
5061 A->IsPackExpansion = IsPackExpansion;
5062 A->setImplicit(Implicit);
5063 return A;
5064 }
5065
5066 void ArmNewAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5067 bool IsFirstArgument = true; (void)IsFirstArgument;
5068 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5069 switch (getAttributeSpellingListIndex()) {
5070 default:
5071 llvm_unreachable("Unknown attribute spelling!");
5072 break;
5073 case 0 : {
5074 OS << "__arm_new";
5075 OS << "";
5076 for (const auto &Val : newArgs()) {
5077 DelimitAttributeArgument(OS, IsFirstArgument);
5078 OS << "\"" << Val << "\"";
5079 }
5080 OS << "";
5081 if (!IsFirstArgument)
5082 OS << ")";
5083 OS << "";
5084 break;
5085 }
5086 }
5087 }
5088
5089 const char *ArmNewAttr::getSpelling() const {
5090 switch (getAttributeSpellingListIndex()) {
5091 default:
5092 llvm_unreachable("Unknown attribute spelling!");
5093 return "(No spelling)";
5094 case 0:
5095 return "__arm_new";
5096 }
5097 }
5098
5099
5100 // ArmOutAttr implementation
5101
5102 ArmOutAttr *ArmOutAttr::CreateImplicit(ASTContext &Ctx, StringRef *OutArgs, unsigned OutArgsSize, const AttributeCommonInfo &CommonInfo) {
5103 auto *A = new (Ctx) ArmOutAttr(Ctx, CommonInfo, OutArgs, OutArgsSize);
5104 A->setImplicit(true);
5105 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5106 A->setAttributeSpellingListIndex(0);
5107 return A;
5108 }
5109
5110 ArmOutAttr *ArmOutAttr::Create(ASTContext &Ctx, StringRef *OutArgs, unsigned OutArgsSize, const AttributeCommonInfo &CommonInfo) {
5111 auto *A = new (Ctx) ArmOutAttr(Ctx, CommonInfo, OutArgs, OutArgsSize);
5112 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5113 A->setAttributeSpellingListIndex(0);
5114 return A;
5115 }
5116
5117 ArmOutAttr *ArmOutAttr::CreateImplicit(ASTContext &Ctx, StringRef *OutArgs, unsigned OutArgsSize, SourceRange Range) {
5118 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5119 return CreateImplicit(Ctx, OutArgs, OutArgsSize, I);
5120 }
5121
5122 ArmOutAttr *ArmOutAttr::Create(ASTContext &Ctx, StringRef *OutArgs, unsigned OutArgsSize, SourceRange Range) {
5123 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5124 return Create(Ctx, OutArgs, OutArgsSize, I);
5125 }
5126
5127 ArmOutAttr::ArmOutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5128 , StringRef *OutArgs, unsigned OutArgsSize
5129 )
5130 : TypeAttr(Ctx, CommonInfo, attr::ArmOut, /*IsLateParsed=*/false)
5131 , outArgs_Size(OutArgsSize), outArgs_(new (Ctx, 16) StringRef[outArgs_Size])
5132 {
5133 for (size_t I = 0, E = outArgs_Size; I != E;
5134 ++I) {
5135 StringRef Ref = OutArgs[I];
5136 if (!Ref.empty()) {
5137 char *Mem = new (Ctx, 1) char[Ref.size()];
5138 std::memcpy(Mem, Ref.data(), Ref.size());
5139 outArgs_[I] = StringRef(Mem, Ref.size());
5140 }
5141 }
5142 }
5143
5144 ArmOutAttr::ArmOutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5145 )
5146 : TypeAttr(Ctx, CommonInfo, attr::ArmOut, /*IsLateParsed=*/false)
5147 , outArgs_Size(0), outArgs_(nullptr)
5148 {
5149 }
5150
5151
5152
5153 ArmOutAttr *ArmOutAttr::clone(ASTContext &C) const {
5154 auto *A = new (C) ArmOutAttr(C, *this, outArgs_, outArgs_Size);
5155 A->Inherited = Inherited;
5156 A->IsPackExpansion = IsPackExpansion;
5157 A->setImplicit(Implicit);
5158 return A;
5159 }
5160
5161 void ArmOutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5162 bool IsFirstArgument = true; (void)IsFirstArgument;
5163 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5164 switch (getAttributeSpellingListIndex()) {
5165 default:
5166 llvm_unreachable("Unknown attribute spelling!");
5167 break;
5168 case 0 : {
5169 OS << "__arm_out";
5170 OS << "";
5171 for (const auto &Val : outArgs()) {
5172 DelimitAttributeArgument(OS, IsFirstArgument);
5173 OS << "\"" << Val << "\"";
5174 }
5175 OS << "";
5176 if (!IsFirstArgument)
5177 OS << ")";
5178 OS << "";
5179 break;
5180 }
5181 }
5182 }
5183
5184 const char *ArmOutAttr::getSpelling() const {
5185 switch (getAttributeSpellingListIndex()) {
5186 default:
5187 llvm_unreachable("Unknown attribute spelling!");
5188 return "(No spelling)";
5189 case 0:
5190 return "__arm_out";
5191 }
5192 }
5193
5194
5195 // ArmPreservesAttr implementation
5196
5197 ArmPreservesAttr *ArmPreservesAttr::CreateImplicit(ASTContext &Ctx, StringRef *PreserveArgs, unsigned PreserveArgsSize, const AttributeCommonInfo &CommonInfo) {
5198 auto *A = new (Ctx) ArmPreservesAttr(Ctx, CommonInfo, PreserveArgs, PreserveArgsSize);
5199 A->setImplicit(true);
5200 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5201 A->setAttributeSpellingListIndex(0);
5202 return A;
5203 }
5204
5205 ArmPreservesAttr *ArmPreservesAttr::Create(ASTContext &Ctx, StringRef *PreserveArgs, unsigned PreserveArgsSize, const AttributeCommonInfo &CommonInfo) {
5206 auto *A = new (Ctx) ArmPreservesAttr(Ctx, CommonInfo, PreserveArgs, PreserveArgsSize);
5207 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5208 A->setAttributeSpellingListIndex(0);
5209 return A;
5210 }
5211
5212 ArmPreservesAttr *ArmPreservesAttr::CreateImplicit(ASTContext &Ctx, StringRef *PreserveArgs, unsigned PreserveArgsSize, SourceRange Range) {
5213 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5214 return CreateImplicit(Ctx, PreserveArgs, PreserveArgsSize, I);
5215 }
5216
5217 ArmPreservesAttr *ArmPreservesAttr::Create(ASTContext &Ctx, StringRef *PreserveArgs, unsigned PreserveArgsSize, SourceRange Range) {
5218 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5219 return Create(Ctx, PreserveArgs, PreserveArgsSize, I);
5220 }
5221
5222 ArmPreservesAttr::ArmPreservesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5223 , StringRef *PreserveArgs, unsigned PreserveArgsSize
5224 )
5225 : TypeAttr(Ctx, CommonInfo, attr::ArmPreserves, /*IsLateParsed=*/false)
5226 , preserveArgs_Size(PreserveArgsSize), preserveArgs_(new (Ctx, 16) StringRef[preserveArgs_Size])
5227 {
5228 for (size_t I = 0, E = preserveArgs_Size; I != E;
5229 ++I) {
5230 StringRef Ref = PreserveArgs[I];
5231 if (!Ref.empty()) {
5232 char *Mem = new (Ctx, 1) char[Ref.size()];
5233 std::memcpy(Mem, Ref.data(), Ref.size());
5234 preserveArgs_[I] = StringRef(Mem, Ref.size());
5235 }
5236 }
5237 }
5238
5239 ArmPreservesAttr::ArmPreservesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5240 )
5241 : TypeAttr(Ctx, CommonInfo, attr::ArmPreserves, /*IsLateParsed=*/false)
5242 , preserveArgs_Size(0), preserveArgs_(nullptr)
5243 {
5244 }
5245
5246
5247
5248 ArmPreservesAttr *ArmPreservesAttr::clone(ASTContext &C) const {
5249 auto *A = new (C) ArmPreservesAttr(C, *this, preserveArgs_, preserveArgs_Size);
5250 A->Inherited = Inherited;
5251 A->IsPackExpansion = IsPackExpansion;
5252 A->setImplicit(Implicit);
5253 return A;
5254 }
5255
5256 void ArmPreservesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5257 bool IsFirstArgument = true; (void)IsFirstArgument;
5258 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5259 switch (getAttributeSpellingListIndex()) {
5260 default:
5261 llvm_unreachable("Unknown attribute spelling!");
5262 break;
5263 case 0 : {
5264 OS << "__arm_preserves";
5265 OS << "";
5266 for (const auto &Val : preserveArgs()) {
5267 DelimitAttributeArgument(OS, IsFirstArgument);
5268 OS << "\"" << Val << "\"";
5269 }
5270 OS << "";
5271 if (!IsFirstArgument)
5272 OS << ")";
5273 OS << "";
5274 break;
5275 }
5276 }
5277 }
5278
5279 const char *ArmPreservesAttr::getSpelling() const {
5280 switch (getAttributeSpellingListIndex()) {
5281 default:
5282 llvm_unreachable("Unknown attribute spelling!");
5283 return "(No spelling)";
5284 case 0:
5285 return "__arm_preserves";
5286 }
5287 }
5288
5289
5290 // ArmStreamingAttr implementation
5291
5292 ArmStreamingAttr *ArmStreamingAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
5293 auto *A = new (Ctx) ArmStreamingAttr(Ctx, CommonInfo);
5294 A->setImplicit(true);
5295 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5296 A->setAttributeSpellingListIndex(0);
5297 return A;
5298 }
5299
5300 ArmStreamingAttr *ArmStreamingAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
5301 auto *A = new (Ctx) ArmStreamingAttr(Ctx, CommonInfo);
5302 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5303 A->setAttributeSpellingListIndex(0);
5304 return A;
5305 }
5306
5307 ArmStreamingAttr *ArmStreamingAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
5308 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5309 return CreateImplicit(Ctx, I);
5310 }
5311
5312 ArmStreamingAttr *ArmStreamingAttr::Create(ASTContext &Ctx, SourceRange Range) {
5313 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5314 return Create(Ctx, I);
5315 }
5316
5317 ArmStreamingAttr::ArmStreamingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5318 )
5319 : TypeAttr(Ctx, CommonInfo, attr::ArmStreaming, /*IsLateParsed=*/false)
5320 {
5321 }
5322
5323 ArmStreamingAttr *ArmStreamingAttr::clone(ASTContext &C) const {
5324 auto *A = new (C) ArmStreamingAttr(C, *this);
5325 A->Inherited = Inherited;
5326 A->IsPackExpansion = IsPackExpansion;
5327 A->setImplicit(Implicit);
5328 return A;
5329 }
5330
5331 void ArmStreamingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5332 bool IsFirstArgument = true; (void)IsFirstArgument;
5333 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5334 switch (getAttributeSpellingListIndex()) {
5335 default:
5336 llvm_unreachable("Unknown attribute spelling!");
5337 break;
5338 case 0 : {
5339 OS << "__arm_streaming";
5340 OS << "";
5341 break;
5342 }
5343 }
5344 }
5345
5346 const char *ArmStreamingAttr::getSpelling() const {
5347 switch (getAttributeSpellingListIndex()) {
5348 default:
5349 llvm_unreachable("Unknown attribute spelling!");
5350 return "(No spelling)";
5351 case 0:
5352 return "__arm_streaming";
5353 }
5354 }
5355
5356
5357 // ArmStreamingCompatibleAttr implementation
5358
5359 ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
5360 auto *A = new (Ctx) ArmStreamingCompatibleAttr(Ctx, CommonInfo);
5361 A->setImplicit(true);
5362 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5363 A->setAttributeSpellingListIndex(0);
5364 return A;
5365 }
5366
5367 ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
5368 auto *A = new (Ctx) ArmStreamingCompatibleAttr(Ctx, CommonInfo);
5369 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5370 A->setAttributeSpellingListIndex(0);
5371 return A;
5372 }
5373
5374 ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
5375 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5376 return CreateImplicit(Ctx, I);
5377 }
5378
5379 ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::Create(ASTContext &Ctx, SourceRange Range) {
5380 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/});
5381 return Create(Ctx, I);
5382 }
5383
5384 ArmStreamingCompatibleAttr::ArmStreamingCompatibleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5385 )
5386 : TypeAttr(Ctx, CommonInfo, attr::ArmStreamingCompatible, /*IsLateParsed=*/false)
5387 {
5388 }
5389
5390 ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::clone(ASTContext &C) const {
5391 auto *A = new (C) ArmStreamingCompatibleAttr(C, *this);
5392 A->Inherited = Inherited;
5393 A->IsPackExpansion = IsPackExpansion;
5394 A->setImplicit(Implicit);
5395 return A;
5396 }
5397
5398 void ArmStreamingCompatibleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5399 bool IsFirstArgument = true; (void)IsFirstArgument;
5400 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5401 switch (getAttributeSpellingListIndex()) {
5402 default:
5403 llvm_unreachable("Unknown attribute spelling!");
5404 break;
5405 case 0 : {
5406 OS << "__arm_streaming_compatible";
5407 OS << "";
5408 break;
5409 }
5410 }
5411 }
5412
5413 const char *ArmStreamingCompatibleAttr::getSpelling() const {
5414 switch (getAttributeSpellingListIndex()) {
5415 default:
5416 llvm_unreachable("Unknown attribute spelling!");
5417 return "(No spelling)";
5418 case 0:
5419 return "__arm_streaming_compatible";
5420 }
5421 }
5422
5423
5424 // ArtificialAttr implementation
5425
5426 ArtificialAttr *ArtificialAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
5427 auto *A = new (Ctx) ArtificialAttr(Ctx, CommonInfo);
5428 A->setImplicit(true);
5429 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5430 A->setAttributeSpellingListIndex(0);
5431 return A;
5432 }
5433
5434 ArtificialAttr *ArtificialAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
5435 auto *A = new (Ctx) ArtificialAttr(Ctx, CommonInfo);
5436 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5437 A->setAttributeSpellingListIndex(0);
5438 return A;
5439 }
5440
5441 ArtificialAttr *ArtificialAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
5442 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
5443 switch (S) {
5444 case GNU_artificial:
5445 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5446 case CXX11_gnu_artificial:
5447 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5448 case C23_gnu_artificial:
5449 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5450 default:
5451 llvm_unreachable("Unknown attribute spelling!");
5452 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5453 }
5454 }());
5455 return CreateImplicit(Ctx, I);
5456 }
5457
5458 ArtificialAttr *ArtificialAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
5459 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
5460 switch (S) {
5461 case GNU_artificial:
5462 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5463 case CXX11_gnu_artificial:
5464 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5465 case C23_gnu_artificial:
5466 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5467 default:
5468 llvm_unreachable("Unknown attribute spelling!");
5469 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5470 }
5471 }());
5472 return Create(Ctx, I);
5473 }
5474
5475 ArtificialAttr::ArtificialAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5476 )
5477 : InheritableAttr(Ctx, CommonInfo, attr::Artificial, /*IsLateParsed=*/false, false)
5478 {
5479 }
5480
5481 ArtificialAttr *ArtificialAttr::clone(ASTContext &C) const {
5482 auto *A = new (C) ArtificialAttr(C, *this);
5483 A->Inherited = Inherited;
5484 A->IsPackExpansion = IsPackExpansion;
5485 A->setImplicit(Implicit);
5486 return A;
5487 }
5488
5489 void ArtificialAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5490 bool IsFirstArgument = true; (void)IsFirstArgument;
5491 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5492 switch (getAttributeSpellingListIndex()) {
5493 default:
5494 llvm_unreachable("Unknown attribute spelling!");
5495 break;
5496 case 0 : {
5497 OS << "__attribute__((artificial";
5498 OS << "))";
5499 break;
5500 }
5501 case 1 : {
5502 OS << "[[gnu::artificial";
5503 OS << "]]";
5504 break;
5505 }
5506 case 2 : {
5507 OS << "[[gnu::artificial";
5508 OS << "]]";
5509 break;
5510 }
5511 }
5512 }
5513
5514 const char *ArtificialAttr::getSpelling() const {
5515 switch (getAttributeSpellingListIndex()) {
5516 default:
5517 llvm_unreachable("Unknown attribute spelling!");
5518 return "(No spelling)";
5519 case 0:
5520 return "artificial";
5521 case 1:
5522 return "artificial";
5523 case 2:
5524 return "artificial";
5525 }
5526 }
5527
5528
5529 // AsmLabelAttr implementation
5530
5531 AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, const AttributeCommonInfo &CommonInfo) {
5532 auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label, IsLiteralLabel);
5533 A->setImplicit(true);
5534 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5535 A->setAttributeSpellingListIndex(0);
5536 return A;
5537 }
5538
5539 AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, const AttributeCommonInfo &CommonInfo) {
5540 auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label, IsLiteralLabel);
5541 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5542 A->setAttributeSpellingListIndex(0);
5543 return A;
5544 }
5545
5546 AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, SourceRange Range, Spelling S) {
5547 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
5548 switch (S) {
5549 case Keyword_asm:
5550 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_asm, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5551 default:
5552 llvm_unreachable("Unknown attribute spelling!");
5553 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5554 }
5555 }());
5556 return CreateImplicit(Ctx, Label, IsLiteralLabel, I);
5557 }
5558
5559 AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, SourceRange Range, Spelling S) {
5560 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
5561 switch (S) {
5562 case Keyword_asm:
5563 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_asm, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5564 default:
5565 llvm_unreachable("Unknown attribute spelling!");
5566 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5567 }
5568 }());
5569 return Create(Ctx, Label, IsLiteralLabel, I);
5570 }
5571
5572 AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, const AttributeCommonInfo &CommonInfo) {
5573 auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label);
5574 A->setImplicit(true);
5575 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5576 A->setAttributeSpellingListIndex(0);
5577 return A;
5578 }
5579
5580 AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, const AttributeCommonInfo &CommonInfo) {
5581 auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label);
5582 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5583 A->setAttributeSpellingListIndex(0);
5584 return A;
5585 }
5586
5587 AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, SourceRange Range, Spelling S) {
5588 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
5589 switch (S) {
5590 case Keyword_asm:
5591 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_asm, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5592 default:
5593 llvm_unreachable("Unknown attribute spelling!");
5594 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5595 }
5596 }());
5597 return CreateImplicit(Ctx, Label, I);
5598 }
5599
5600 AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, SourceRange Range, Spelling S) {
5601 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
5602 switch (S) {
5603 case Keyword_asm:
5604 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_asm, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5605 default:
5606 llvm_unreachable("Unknown attribute spelling!");
5607 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5608 }
5609 }());
5610 return Create(Ctx, Label, I);
5611 }
5612
5613 AsmLabelAttr::AsmLabelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5614 , llvm::StringRef Label
5615 , bool IsLiteralLabel
5616 )
5617 : InheritableAttr(Ctx, CommonInfo, attr::AsmLabel, /*IsLateParsed=*/false, false)
5618 , labelLength(Label.size()),label(new (Ctx, 1) char[labelLength])
5619 , isLiteralLabel(IsLiteralLabel)
5620 {
5621 if (!Label.empty())
5622 std::memcpy(label, Label.data(), labelLength);
5623 }
5624
5625 AsmLabelAttr::AsmLabelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5626 , llvm::StringRef Label
5627 )
5628 : InheritableAttr(Ctx, CommonInfo, attr::AsmLabel, /*IsLateParsed=*/false, false)
5629 , labelLength(Label.size()),label(new (Ctx, 1) char[labelLength])
5630 , isLiteralLabel()
5631 {
5632 if (!Label.empty())
5633 std::memcpy(label, Label.data(), labelLength);
5634 }
5635
5636
5637
5638
5639
5640 AsmLabelAttr *AsmLabelAttr::clone(ASTContext &C) const {
5641 auto *A = new (C) AsmLabelAttr(C, *this, getLabel(), isLiteralLabel);
5642 A->Inherited = Inherited;
5643 A->IsPackExpansion = IsPackExpansion;
5644 A->setImplicit(Implicit);
5645 return A;
5646 }
5647
5648 void AsmLabelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5649 bool IsFirstArgument = true; (void)IsFirstArgument;
5650 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5651 switch (getAttributeSpellingListIndex()) {
5652 default:
5653 llvm_unreachable("Unknown attribute spelling!");
5654 break;
5655 case 0 : {
5656 OS << "asm";
5657 DelimitAttributeArgument(OS, IsFirstArgument);
5658 OS << "\"" << getLabel() << "\"";
5659 if (!IsFirstArgument)
5660 OS << ")";
5661 OS << "";
5662 break;
5663 }
5664 case 1 : {
5665 OS << "__asm__";
5666 DelimitAttributeArgument(OS, IsFirstArgument);
5667 OS << "\"" << getLabel() << "\"";
5668 if (!IsFirstArgument)
5669 OS << ")";
5670 OS << "";
5671 break;
5672 }
5673 }
5674 }
5675
5676 const char *AsmLabelAttr::getSpelling() const {
5677 switch (getAttributeSpellingListIndex()) {
5678 default:
5679 llvm_unreachable("Unknown attribute spelling!");
5680 return "(No spelling)";
5681 case 0:
5682 return "asm";
5683 case 1:
5684 return "__asm__";
5685 }
5686 }
5687
5688
5689 // AssertCapabilityAttr implementation
5690
5691 AssertCapabilityAttr *AssertCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
5692 auto *A = new (Ctx) AssertCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize);
5693 A->setImplicit(true);
5694 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5695 A->setAttributeSpellingListIndex(0);
5696 return A;
5697 }
5698
5699 AssertCapabilityAttr *AssertCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
5700 auto *A = new (Ctx) AssertCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize);
5701 return A;
5702 }
5703
5704 AssertCapabilityAttr *AssertCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
5705 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
5706 switch (S) {
5707 case GNU_assert_capability:
5708 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assert_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5709 case CXX11_clang_assert_capability:
5710 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assert_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5711 case GNU_assert_shared_capability:
5712 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assert_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5713 case CXX11_clang_assert_shared_capability:
5714 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assert_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5715 default:
5716 llvm_unreachable("Unknown attribute spelling!");
5717 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5718 }
5719 }());
5720 return CreateImplicit(Ctx, Args, ArgsSize, I);
5721 }
5722
5723 AssertCapabilityAttr *AssertCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
5724 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
5725 switch (S) {
5726 case GNU_assert_capability:
5727 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assert_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5728 case CXX11_clang_assert_capability:
5729 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assert_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5730 case GNU_assert_shared_capability:
5731 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assert_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5732 case CXX11_clang_assert_shared_capability:
5733 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assert_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5734 default:
5735 llvm_unreachable("Unknown attribute spelling!");
5736 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
5737 }
5738 }());
5739 return Create(Ctx, Args, ArgsSize, I);
5740 }
5741
5742 AssertCapabilityAttr::AssertCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5743 , Expr * *Args, unsigned ArgsSize
5744 )
5745 : InheritableAttr(Ctx, CommonInfo, attr::AssertCapability, /*IsLateParsed=*/true, true)
5746 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
5747 {
5748 std::copy(Args, Args + args_Size, args_);
5749 }
5750
5751 AssertCapabilityAttr::AssertCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5752 )
5753 : InheritableAttr(Ctx, CommonInfo, attr::AssertCapability, /*IsLateParsed=*/true, true)
5754 , args_Size(0), args_(nullptr)
5755 {
5756 }
5757
5758 AssertCapabilityAttr::Spelling AssertCapabilityAttr::getSemanticSpelling() const {
5759 switch (getAttributeSpellingListIndex()) {
5760 default: llvm_unreachable("Unknown spelling list index");
5761 case 0: return GNU_assert_capability;
5762 case 1: return CXX11_clang_assert_capability;
5763 case 2: return GNU_assert_shared_capability;
5764 case 3: return CXX11_clang_assert_shared_capability;
5765 }
5766 }
5767
5768
5769 AssertCapabilityAttr *AssertCapabilityAttr::clone(ASTContext &C) const {
5770 auto *A = new (C) AssertCapabilityAttr(C, *this, args_, args_Size);
5771 A->Inherited = Inherited;
5772 A->IsPackExpansion = IsPackExpansion;
5773 A->setImplicit(Implicit);
5774 return A;
5775 }
5776
5777 void AssertCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5778 bool IsFirstArgument = true; (void)IsFirstArgument;
5779 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5780 switch (getAttributeSpellingListIndex()) {
5781 default:
5782 llvm_unreachable("Unknown attribute spelling!");
5783 break;
5784 case 0 : {
5785 OS << "__attribute__((assert_capability";
5786 OS << "";
5787 for (const auto &Val : args()) {
5788 DelimitAttributeArgument(OS, IsFirstArgument);
5789 OS << Val;
5790 }
5791 OS << "";
5792 if (!IsFirstArgument)
5793 OS << ")";
5794 OS << "))";
5795 break;
5796 }
5797 case 1 : {
5798 OS << "[[clang::assert_capability";
5799 OS << "";
5800 for (const auto &Val : args()) {
5801 DelimitAttributeArgument(OS, IsFirstArgument);
5802 OS << Val;
5803 }
5804 OS << "";
5805 if (!IsFirstArgument)
5806 OS << ")";
5807 OS << "]]";
5808 break;
5809 }
5810 case 2 : {
5811 OS << "__attribute__((assert_shared_capability";
5812 OS << "";
5813 for (const auto &Val : args()) {
5814 DelimitAttributeArgument(OS, IsFirstArgument);
5815 OS << Val;
5816 }
5817 OS << "";
5818 if (!IsFirstArgument)
5819 OS << ")";
5820 OS << "))";
5821 break;
5822 }
5823 case 3 : {
5824 OS << "[[clang::assert_shared_capability";
5825 OS << "";
5826 for (const auto &Val : args()) {
5827 DelimitAttributeArgument(OS, IsFirstArgument);
5828 OS << Val;
5829 }
5830 OS << "";
5831 if (!IsFirstArgument)
5832 OS << ")";
5833 OS << "]]";
5834 break;
5835 }
5836 }
5837 }
5838
5839 const char *AssertCapabilityAttr::getSpelling() const {
5840 switch (getAttributeSpellingListIndex()) {
5841 default:
5842 llvm_unreachable("Unknown attribute spelling!");
5843 return "(No spelling)";
5844 case 0:
5845 return "assert_capability";
5846 case 1:
5847 return "assert_capability";
5848 case 2:
5849 return "assert_shared_capability";
5850 case 3:
5851 return "assert_shared_capability";
5852 }
5853 }
5854
5855
5856 // AssertExclusiveLockAttr implementation
5857
5858 AssertExclusiveLockAttr *AssertExclusiveLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
5859 auto *A = new (Ctx) AssertExclusiveLockAttr(Ctx, CommonInfo, Args, ArgsSize);
5860 A->setImplicit(true);
5861 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5862 A->setAttributeSpellingListIndex(0);
5863 return A;
5864 }
5865
5866 AssertExclusiveLockAttr *AssertExclusiveLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
5867 auto *A = new (Ctx) AssertExclusiveLockAttr(Ctx, CommonInfo, Args, ArgsSize);
5868 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5869 A->setAttributeSpellingListIndex(0);
5870 return A;
5871 }
5872
5873 AssertExclusiveLockAttr *AssertExclusiveLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
5874 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
5875 return CreateImplicit(Ctx, Args, ArgsSize, I);
5876 }
5877
5878 AssertExclusiveLockAttr *AssertExclusiveLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
5879 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
5880 return Create(Ctx, Args, ArgsSize, I);
5881 }
5882
5883 AssertExclusiveLockAttr::AssertExclusiveLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5884 , Expr * *Args, unsigned ArgsSize
5885 )
5886 : InheritableAttr(Ctx, CommonInfo, attr::AssertExclusiveLock, /*IsLateParsed=*/true, true)
5887 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
5888 {
5889 std::copy(Args, Args + args_Size, args_);
5890 }
5891
5892 AssertExclusiveLockAttr::AssertExclusiveLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5893 )
5894 : InheritableAttr(Ctx, CommonInfo, attr::AssertExclusiveLock, /*IsLateParsed=*/true, true)
5895 , args_Size(0), args_(nullptr)
5896 {
5897 }
5898
5899
5900
5901 AssertExclusiveLockAttr *AssertExclusiveLockAttr::clone(ASTContext &C) const {
5902 auto *A = new (C) AssertExclusiveLockAttr(C, *this, args_, args_Size);
5903 A->Inherited = Inherited;
5904 A->IsPackExpansion = IsPackExpansion;
5905 A->setImplicit(Implicit);
5906 return A;
5907 }
5908
5909 void AssertExclusiveLockAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5910 bool IsFirstArgument = true; (void)IsFirstArgument;
5911 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5912 switch (getAttributeSpellingListIndex()) {
5913 default:
5914 llvm_unreachable("Unknown attribute spelling!");
5915 break;
5916 case 0 : {
5917 OS << "__attribute__((assert_exclusive_lock";
5918 OS << "";
5919 for (const auto &Val : args()) {
5920 DelimitAttributeArgument(OS, IsFirstArgument);
5921 OS << Val;
5922 }
5923 OS << "";
5924 if (!IsFirstArgument)
5925 OS << ")";
5926 OS << "))";
5927 break;
5928 }
5929 }
5930 }
5931
5932 const char *AssertExclusiveLockAttr::getSpelling() const {
5933 switch (getAttributeSpellingListIndex()) {
5934 default:
5935 llvm_unreachable("Unknown attribute spelling!");
5936 return "(No spelling)";
5937 case 0:
5938 return "assert_exclusive_lock";
5939 }
5940 }
5941
5942
5943 // AssertSharedLockAttr implementation
5944
5945 AssertSharedLockAttr *AssertSharedLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
5946 auto *A = new (Ctx) AssertSharedLockAttr(Ctx, CommonInfo, Args, ArgsSize);
5947 A->setImplicit(true);
5948 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5949 A->setAttributeSpellingListIndex(0);
5950 return A;
5951 }
5952
5953 AssertSharedLockAttr *AssertSharedLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
5954 auto *A = new (Ctx) AssertSharedLockAttr(Ctx, CommonInfo, Args, ArgsSize);
5955 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
5956 A->setAttributeSpellingListIndex(0);
5957 return A;
5958 }
5959
5960 AssertSharedLockAttr *AssertSharedLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
5961 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
5962 return CreateImplicit(Ctx, Args, ArgsSize, I);
5963 }
5964
5965 AssertSharedLockAttr *AssertSharedLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
5966 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
5967 return Create(Ctx, Args, ArgsSize, I);
5968 }
5969
5970 AssertSharedLockAttr::AssertSharedLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5971 , Expr * *Args, unsigned ArgsSize
5972 )
5973 : InheritableAttr(Ctx, CommonInfo, attr::AssertSharedLock, /*IsLateParsed=*/true, true)
5974 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
5975 {
5976 std::copy(Args, Args + args_Size, args_);
5977 }
5978
5979 AssertSharedLockAttr::AssertSharedLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
5980 )
5981 : InheritableAttr(Ctx, CommonInfo, attr::AssertSharedLock, /*IsLateParsed=*/true, true)
5982 , args_Size(0), args_(nullptr)
5983 {
5984 }
5985
5986
5987
5988 AssertSharedLockAttr *AssertSharedLockAttr::clone(ASTContext &C) const {
5989 auto *A = new (C) AssertSharedLockAttr(C, *this, args_, args_Size);
5990 A->Inherited = Inherited;
5991 A->IsPackExpansion = IsPackExpansion;
5992 A->setImplicit(Implicit);
5993 return A;
5994 }
5995
5996 void AssertSharedLockAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
5997 bool IsFirstArgument = true; (void)IsFirstArgument;
5998 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
5999 switch (getAttributeSpellingListIndex()) {
6000 default:
6001 llvm_unreachable("Unknown attribute spelling!");
6002 break;
6003 case 0 : {
6004 OS << "__attribute__((assert_shared_lock";
6005 OS << "";
6006 for (const auto &Val : args()) {
6007 DelimitAttributeArgument(OS, IsFirstArgument);
6008 OS << Val;
6009 }
6010 OS << "";
6011 if (!IsFirstArgument)
6012 OS << ")";
6013 OS << "))";
6014 break;
6015 }
6016 }
6017 }
6018
6019 const char *AssertSharedLockAttr::getSpelling() const {
6020 switch (getAttributeSpellingListIndex()) {
6021 default:
6022 llvm_unreachable("Unknown attribute spelling!");
6023 return "(No spelling)";
6024 case 0:
6025 return "assert_shared_lock";
6026 }
6027 }
6028
6029
6030 // AssumeAlignedAttr implementation
6031
6032 AssumeAlignedAttr *AssumeAlignedAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, Expr * Offset, const AttributeCommonInfo &CommonInfo) {
6033 auto *A = new (Ctx) AssumeAlignedAttr(Ctx, CommonInfo, Alignment, Offset);
6034 A->setImplicit(true);
6035 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6036 A->setAttributeSpellingListIndex(0);
6037 return A;
6038 }
6039
6040 AssumeAlignedAttr *AssumeAlignedAttr::Create(ASTContext &Ctx, Expr * Alignment, Expr * Offset, const AttributeCommonInfo &CommonInfo) {
6041 auto *A = new (Ctx) AssumeAlignedAttr(Ctx, CommonInfo, Alignment, Offset);
6042 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6043 A->setAttributeSpellingListIndex(0);
6044 return A;
6045 }
6046
6047 AssumeAlignedAttr *AssumeAlignedAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, Expr * Offset, SourceRange Range, Spelling S) {
6048 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6049 switch (S) {
6050 case GNU_assume_aligned:
6051 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6052 case CXX11_gnu_assume_aligned:
6053 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6054 case C23_gnu_assume_aligned:
6055 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6056 default:
6057 llvm_unreachable("Unknown attribute spelling!");
6058 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6059 }
6060 }());
6061 return CreateImplicit(Ctx, Alignment, Offset, I);
6062 }
6063
6064 AssumeAlignedAttr *AssumeAlignedAttr::Create(ASTContext &Ctx, Expr * Alignment, Expr * Offset, SourceRange Range, Spelling S) {
6065 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6066 switch (S) {
6067 case GNU_assume_aligned:
6068 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6069 case CXX11_gnu_assume_aligned:
6070 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6071 case C23_gnu_assume_aligned:
6072 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6073 default:
6074 llvm_unreachable("Unknown attribute spelling!");
6075 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6076 }
6077 }());
6078 return Create(Ctx, Alignment, Offset, I);
6079 }
6080
6081 AssumeAlignedAttr::AssumeAlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
6082 , Expr * Alignment
6083 , Expr * Offset
6084 )
6085 : InheritableAttr(Ctx, CommonInfo, attr::AssumeAligned, /*IsLateParsed=*/false, false)
6086 , alignment(Alignment)
6087 , offset(Offset)
6088 {
6089 }
6090
6091 AssumeAlignedAttr::AssumeAlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
6092 , Expr * Alignment
6093 )
6094 : InheritableAttr(Ctx, CommonInfo, attr::AssumeAligned, /*IsLateParsed=*/false, false)
6095 , alignment(Alignment)
6096 , offset()
6097 {
6098 }
6099
6100
6101
6102
6103
6104 AssumeAlignedAttr *AssumeAlignedAttr::clone(ASTContext &C) const {
6105 auto *A = new (C) AssumeAlignedAttr(C, *this, alignment, offset);
6106 A->Inherited = Inherited;
6107 A->IsPackExpansion = IsPackExpansion;
6108 A->setImplicit(Implicit);
6109 return A;
6110 }
6111
6112 void AssumeAlignedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
6113 bool IsFirstArgument = true; (void)IsFirstArgument;
6114 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
6115 switch (getAttributeSpellingListIndex()) {
6116 default:
6117 llvm_unreachable("Unknown attribute spelling!");
6118 break;
6119 case 0 : {
6120 OS << "__attribute__((assume_aligned";
6121 if (!getOffset())
6122 ++TrailingOmittedArgs;
6123 DelimitAttributeArgument(OS, IsFirstArgument);
6124 OS << "";
6125 getAlignment()->printPretty(OS, nullptr, Policy);
6126 OS << "";
6127 if (!(!getOffset())) {
6128 DelimitAttributeArgument(OS, IsFirstArgument);
6129 OS << "";
6130 getOffset()->printPretty(OS, nullptr, Policy);
6131 OS << "";
6132 }
6133 if (!IsFirstArgument)
6134 OS << ")";
6135 OS << "))";
6136 break;
6137 }
6138 case 1 : {
6139 OS << "[[gnu::assume_aligned";
6140 if (!getOffset())
6141 ++TrailingOmittedArgs;
6142 DelimitAttributeArgument(OS, IsFirstArgument);
6143 OS << "";
6144 getAlignment()->printPretty(OS, nullptr, Policy);
6145 OS << "";
6146 if (!(!getOffset())) {
6147 DelimitAttributeArgument(OS, IsFirstArgument);
6148 OS << "";
6149 getOffset()->printPretty(OS, nullptr, Policy);
6150 OS << "";
6151 }
6152 if (!IsFirstArgument)
6153 OS << ")";
6154 OS << "]]";
6155 break;
6156 }
6157 case 2 : {
6158 OS << "[[gnu::assume_aligned";
6159 if (!getOffset())
6160 ++TrailingOmittedArgs;
6161 DelimitAttributeArgument(OS, IsFirstArgument);
6162 OS << "";
6163 getAlignment()->printPretty(OS, nullptr, Policy);
6164 OS << "";
6165 if (!(!getOffset())) {
6166 DelimitAttributeArgument(OS, IsFirstArgument);
6167 OS << "";
6168 getOffset()->printPretty(OS, nullptr, Policy);
6169 OS << "";
6170 }
6171 if (!IsFirstArgument)
6172 OS << ")";
6173 OS << "]]";
6174 break;
6175 }
6176 }
6177 }
6178
6179 const char *AssumeAlignedAttr::getSpelling() const {
6180 switch (getAttributeSpellingListIndex()) {
6181 default:
6182 llvm_unreachable("Unknown attribute spelling!");
6183 return "(No spelling)";
6184 case 0:
6185 return "assume_aligned";
6186 case 1:
6187 return "assume_aligned";
6188 case 2:
6189 return "assume_aligned";
6190 }
6191 }
6192
6193
6194 // AvailabilityAttr implementation
6195
6196 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, IdentifierInfo * Environment, const AttributeCommonInfo &CommonInfo) {
6197 auto *A = new (Ctx) AvailabilityAttr(Ctx, CommonInfo, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, Environment);
6198 A->setImplicit(true);
6199 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6200 A->setAttributeSpellingListIndex(0);
6201 return A;
6202 }
6203
6204 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, IdentifierInfo * Environment, const AttributeCommonInfo &CommonInfo) {
6205 auto *A = new (Ctx) AvailabilityAttr(Ctx, CommonInfo, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, Environment);
6206 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6207 A->setAttributeSpellingListIndex(0);
6208 return A;
6209 }
6210
6211 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, IdentifierInfo * Environment, SourceRange Range, Spelling S) {
6212 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6213 switch (S) {
6214 case GNU_availability:
6215 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6216 case CXX11_clang_availability:
6217 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6218 case C23_clang_availability:
6219 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6220 default:
6221 llvm_unreachable("Unknown attribute spelling!");
6222 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6223 }
6224 }());
6225 return CreateImplicit(Ctx, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, Environment, I);
6226 }
6227
6228 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, IdentifierInfo * Environment, SourceRange Range, Spelling S) {
6229 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6230 switch (S) {
6231 case GNU_availability:
6232 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6233 case CXX11_clang_availability:
6234 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6235 case C23_clang_availability:
6236 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6237 default:
6238 llvm_unreachable("Unknown attribute spelling!");
6239 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6240 }
6241 }());
6242 return Create(Ctx, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, Environment, I);
6243 }
6244
6245 AvailabilityAttr::AvailabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
6246 , IdentifierInfo * Platform
6247 , VersionTuple Introduced
6248 , VersionTuple Deprecated
6249 , VersionTuple Obsoleted
6250 , bool Unavailable
6251 , llvm::StringRef Message
6252 , bool Strict
6253 , llvm::StringRef Replacement
6254 , int Priority
6255 , IdentifierInfo * Environment
6256 )
6257 : InheritableAttr(Ctx, CommonInfo, attr::Availability, /*IsLateParsed=*/false, true)
6258 , platform(Platform)
6259 , introduced(Introduced)
6260 , deprecated(Deprecated)
6261 , obsoleted(Obsoleted)
6262 , unavailable(Unavailable)
6263 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
6264 , strict(Strict)
6265 , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength])
6266 , priority(Priority)
6267 , environment(Environment)
6268 {
6269 if (!Message.empty())
6270 std::memcpy(message, Message.data(), messageLength);
6271 if (!Replacement.empty())
6272 std::memcpy(replacement, Replacement.data(), replacementLength);
6273 }
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295 AvailabilityAttr *AvailabilityAttr::clone(ASTContext &C) const {
6296 auto *A = new (C) AvailabilityAttr(C, *this, platform, getIntroduced(), getDeprecated(), getObsoleted(), unavailable, getMessage(), strict, getReplacement(), priority, environment);
6297 A->Inherited = Inherited;
6298 A->IsPackExpansion = IsPackExpansion;
6299 A->setImplicit(Implicit);
6300 return A;
6301 }
6302
6303 void AvailabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
6304 bool IsFirstArgument = true; (void)IsFirstArgument;
6305 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
6306 switch (getAttributeSpellingListIndex()) {
6307 default:
6308 llvm_unreachable("Unknown attribute spelling!");
6309 break;
6310 case 0 : {
6311 OS << "__attribute__((availability";
6312 OS << "(" << getPlatform()->getName();
6313 if (getStrict()) OS << ", strict";
6314 if (!getIntroduced().empty()) OS << ", introduced=" << getIntroduced();
6315 if (!getDeprecated().empty()) OS << ", deprecated=" << getDeprecated();
6316 if (!getObsoleted().empty()) OS << ", obsoleted=" << getObsoleted();
6317 if (getUnavailable()) OS << ", unavailable";
6318 OS << ")";
6319 OS << "))";
6320 break;
6321 }
6322 case 1 : {
6323 OS << "[[clang::availability";
6324 DelimitAttributeArgument(OS, IsFirstArgument);
6325 OS << "" << (getPlatform() ? getPlatform()->getName() : "") << "";
6326 DelimitAttributeArgument(OS, IsFirstArgument);
6327 OS << "introduced=" << getIntroduced() << "";
6328 DelimitAttributeArgument(OS, IsFirstArgument);
6329 OS << "deprecated=" << getDeprecated() << "";
6330 DelimitAttributeArgument(OS, IsFirstArgument);
6331 OS << "obsoleted=" << getObsoleted() << "";
6332 DelimitAttributeArgument(OS, IsFirstArgument);
6333 OS << "" << getUnavailable() << "";
6334 DelimitAttributeArgument(OS, IsFirstArgument);
6335 OS << "\"" << getMessage() << "\"";
6336 DelimitAttributeArgument(OS, IsFirstArgument);
6337 OS << "" << getStrict() << "";
6338 DelimitAttributeArgument(OS, IsFirstArgument);
6339 OS << "\"" << getReplacement() << "\"";
6340 DelimitAttributeArgument(OS, IsFirstArgument);
6341 OS << "" << getPriority() << "";
6342 DelimitAttributeArgument(OS, IsFirstArgument);
6343 OS << "" << (getEnvironment() ? getEnvironment()->getName() : "") << "";
6344 if (!IsFirstArgument)
6345 OS << ")";
6346 OS << "]]";
6347 break;
6348 }
6349 case 2 : {
6350 OS << "[[clang::availability";
6351 DelimitAttributeArgument(OS, IsFirstArgument);
6352 OS << "" << (getPlatform() ? getPlatform()->getName() : "") << "";
6353 DelimitAttributeArgument(OS, IsFirstArgument);
6354 OS << "introduced=" << getIntroduced() << "";
6355 DelimitAttributeArgument(OS, IsFirstArgument);
6356 OS << "deprecated=" << getDeprecated() << "";
6357 DelimitAttributeArgument(OS, IsFirstArgument);
6358 OS << "obsoleted=" << getObsoleted() << "";
6359 DelimitAttributeArgument(OS, IsFirstArgument);
6360 OS << "" << getUnavailable() << "";
6361 DelimitAttributeArgument(OS, IsFirstArgument);
6362 OS << "\"" << getMessage() << "\"";
6363 DelimitAttributeArgument(OS, IsFirstArgument);
6364 OS << "" << getStrict() << "";
6365 DelimitAttributeArgument(OS, IsFirstArgument);
6366 OS << "\"" << getReplacement() << "\"";
6367 DelimitAttributeArgument(OS, IsFirstArgument);
6368 OS << "" << getPriority() << "";
6369 DelimitAttributeArgument(OS, IsFirstArgument);
6370 OS << "" << (getEnvironment() ? getEnvironment()->getName() : "") << "";
6371 if (!IsFirstArgument)
6372 OS << ")";
6373 OS << "]]";
6374 break;
6375 }
6376 }
6377 }
6378
6379 const char *AvailabilityAttr::getSpelling() const {
6380 switch (getAttributeSpellingListIndex()) {
6381 default:
6382 llvm_unreachable("Unknown attribute spelling!");
6383 return "(No spelling)";
6384 case 0:
6385 return "availability";
6386 case 1:
6387 return "availability";
6388 case 2:
6389 return "availability";
6390 }
6391 }
6392
6393
6394 // AvailableOnlyInDefaultEvalMethodAttr implementation
6395
6396 AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
6397 auto *A = new (Ctx) AvailableOnlyInDefaultEvalMethodAttr(Ctx, CommonInfo);
6398 A->setImplicit(true);
6399 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6400 A->setAttributeSpellingListIndex(0);
6401 return A;
6402 }
6403
6404 AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
6405 auto *A = new (Ctx) AvailableOnlyInDefaultEvalMethodAttr(Ctx, CommonInfo);
6406 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6407 A->setAttributeSpellingListIndex(0);
6408 return A;
6409 }
6410
6411 AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
6412 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6413 switch (S) {
6414 case GNU_available_only_in_default_eval_method:
6415 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6416 case CXX11_clang_available_only_in_default_eval_method:
6417 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6418 case C23_clang_available_only_in_default_eval_method:
6419 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6420 default:
6421 llvm_unreachable("Unknown attribute spelling!");
6422 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6423 }
6424 }());
6425 return CreateImplicit(Ctx, I);
6426 }
6427
6428 AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
6429 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6430 switch (S) {
6431 case GNU_available_only_in_default_eval_method:
6432 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6433 case CXX11_clang_available_only_in_default_eval_method:
6434 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6435 case C23_clang_available_only_in_default_eval_method:
6436 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6437 default:
6438 llvm_unreachable("Unknown attribute spelling!");
6439 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6440 }
6441 }());
6442 return Create(Ctx, I);
6443 }
6444
6445 AvailableOnlyInDefaultEvalMethodAttr::AvailableOnlyInDefaultEvalMethodAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
6446 )
6447 : InheritableAttr(Ctx, CommonInfo, attr::AvailableOnlyInDefaultEvalMethod, /*IsLateParsed=*/false, false)
6448 {
6449 }
6450
6451 AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::clone(ASTContext &C) const {
6452 auto *A = new (C) AvailableOnlyInDefaultEvalMethodAttr(C, *this);
6453 A->Inherited = Inherited;
6454 A->IsPackExpansion = IsPackExpansion;
6455 A->setImplicit(Implicit);
6456 return A;
6457 }
6458
6459 void AvailableOnlyInDefaultEvalMethodAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
6460 bool IsFirstArgument = true; (void)IsFirstArgument;
6461 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
6462 switch (getAttributeSpellingListIndex()) {
6463 default:
6464 llvm_unreachable("Unknown attribute spelling!");
6465 break;
6466 case 0 : {
6467 OS << "__attribute__((available_only_in_default_eval_method";
6468 OS << "))";
6469 break;
6470 }
6471 case 1 : {
6472 OS << "[[clang::available_only_in_default_eval_method";
6473 OS << "]]";
6474 break;
6475 }
6476 case 2 : {
6477 OS << "[[clang::available_only_in_default_eval_method";
6478 OS << "]]";
6479 break;
6480 }
6481 }
6482 }
6483
6484 const char *AvailableOnlyInDefaultEvalMethodAttr::getSpelling() const {
6485 switch (getAttributeSpellingListIndex()) {
6486 default:
6487 llvm_unreachable("Unknown attribute spelling!");
6488 return "(No spelling)";
6489 case 0:
6490 return "available_only_in_default_eval_method";
6491 case 1:
6492 return "available_only_in_default_eval_method";
6493 case 2:
6494 return "available_only_in_default_eval_method";
6495 }
6496 }
6497
6498
6499 // BPFFastCallAttr implementation
6500
6501 BPFFastCallAttr *BPFFastCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
6502 auto *A = new (Ctx) BPFFastCallAttr(Ctx, CommonInfo);
6503 A->setImplicit(true);
6504 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6505 A->setAttributeSpellingListIndex(0);
6506 return A;
6507 }
6508
6509 BPFFastCallAttr *BPFFastCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
6510 auto *A = new (Ctx) BPFFastCallAttr(Ctx, CommonInfo);
6511 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6512 A->setAttributeSpellingListIndex(0);
6513 return A;
6514 }
6515
6516 BPFFastCallAttr *BPFFastCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
6517 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6518 switch (S) {
6519 case GNU_bpf_fastcall:
6520 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6521 case CXX11_clang_bpf_fastcall:
6522 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6523 case C23_clang_bpf_fastcall:
6524 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6525 default:
6526 llvm_unreachable("Unknown attribute spelling!");
6527 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6528 }
6529 }());
6530 return CreateImplicit(Ctx, I);
6531 }
6532
6533 BPFFastCallAttr *BPFFastCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
6534 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6535 switch (S) {
6536 case GNU_bpf_fastcall:
6537 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6538 case CXX11_clang_bpf_fastcall:
6539 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6540 case C23_clang_bpf_fastcall:
6541 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6542 default:
6543 llvm_unreachable("Unknown attribute spelling!");
6544 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6545 }
6546 }());
6547 return Create(Ctx, I);
6548 }
6549
6550 BPFFastCallAttr::BPFFastCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
6551 )
6552 : InheritableAttr(Ctx, CommonInfo, attr::BPFFastCall, /*IsLateParsed=*/false, false)
6553 {
6554 }
6555
6556 BPFFastCallAttr *BPFFastCallAttr::clone(ASTContext &C) const {
6557 auto *A = new (C) BPFFastCallAttr(C, *this);
6558 A->Inherited = Inherited;
6559 A->IsPackExpansion = IsPackExpansion;
6560 A->setImplicit(Implicit);
6561 return A;
6562 }
6563
6564 void BPFFastCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
6565 bool IsFirstArgument = true; (void)IsFirstArgument;
6566 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
6567 switch (getAttributeSpellingListIndex()) {
6568 default:
6569 llvm_unreachable("Unknown attribute spelling!");
6570 break;
6571 case 0 : {
6572 OS << "__attribute__((bpf_fastcall";
6573 OS << "))";
6574 break;
6575 }
6576 case 1 : {
6577 OS << "[[clang::bpf_fastcall";
6578 OS << "]]";
6579 break;
6580 }
6581 case 2 : {
6582 OS << "[[clang::bpf_fastcall";
6583 OS << "]]";
6584 break;
6585 }
6586 }
6587 }
6588
6589 const char *BPFFastCallAttr::getSpelling() const {
6590 switch (getAttributeSpellingListIndex()) {
6591 default:
6592 llvm_unreachable("Unknown attribute spelling!");
6593 return "(No spelling)";
6594 case 0:
6595 return "bpf_fastcall";
6596 case 1:
6597 return "bpf_fastcall";
6598 case 2:
6599 return "bpf_fastcall";
6600 }
6601 }
6602
6603
6604 // BPFPreserveAccessIndexAttr implementation
6605
6606 BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
6607 auto *A = new (Ctx) BPFPreserveAccessIndexAttr(Ctx, CommonInfo);
6608 A->setImplicit(true);
6609 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6610 A->setAttributeSpellingListIndex(0);
6611 return A;
6612 }
6613
6614 BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
6615 auto *A = new (Ctx) BPFPreserveAccessIndexAttr(Ctx, CommonInfo);
6616 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6617 A->setAttributeSpellingListIndex(0);
6618 return A;
6619 }
6620
6621 BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
6622 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6623 switch (S) {
6624 case GNU_preserve_access_index:
6625 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6626 case CXX11_clang_preserve_access_index:
6627 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6628 case C23_clang_preserve_access_index:
6629 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6630 default:
6631 llvm_unreachable("Unknown attribute spelling!");
6632 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6633 }
6634 }());
6635 return CreateImplicit(Ctx, I);
6636 }
6637
6638 BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
6639 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6640 switch (S) {
6641 case GNU_preserve_access_index:
6642 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6643 case CXX11_clang_preserve_access_index:
6644 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6645 case C23_clang_preserve_access_index:
6646 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6647 default:
6648 llvm_unreachable("Unknown attribute spelling!");
6649 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6650 }
6651 }());
6652 return Create(Ctx, I);
6653 }
6654
6655 BPFPreserveAccessIndexAttr::BPFPreserveAccessIndexAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
6656 )
6657 : InheritableAttr(Ctx, CommonInfo, attr::BPFPreserveAccessIndex, /*IsLateParsed=*/false, false)
6658 {
6659 }
6660
6661 BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::clone(ASTContext &C) const {
6662 auto *A = new (C) BPFPreserveAccessIndexAttr(C, *this);
6663 A->Inherited = Inherited;
6664 A->IsPackExpansion = IsPackExpansion;
6665 A->setImplicit(Implicit);
6666 return A;
6667 }
6668
6669 void BPFPreserveAccessIndexAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
6670 bool IsFirstArgument = true; (void)IsFirstArgument;
6671 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
6672 switch (getAttributeSpellingListIndex()) {
6673 default:
6674 llvm_unreachable("Unknown attribute spelling!");
6675 break;
6676 case 0 : {
6677 OS << "__attribute__((preserve_access_index";
6678 OS << "))";
6679 break;
6680 }
6681 case 1 : {
6682 OS << "[[clang::preserve_access_index";
6683 OS << "]]";
6684 break;
6685 }
6686 case 2 : {
6687 OS << "[[clang::preserve_access_index";
6688 OS << "]]";
6689 break;
6690 }
6691 }
6692 }
6693
6694 const char *BPFPreserveAccessIndexAttr::getSpelling() const {
6695 switch (getAttributeSpellingListIndex()) {
6696 default:
6697 llvm_unreachable("Unknown attribute spelling!");
6698 return "(No spelling)";
6699 case 0:
6700 return "preserve_access_index";
6701 case 1:
6702 return "preserve_access_index";
6703 case 2:
6704 return "preserve_access_index";
6705 }
6706 }
6707
6708
6709 // BPFPreserveStaticOffsetAttr implementation
6710
6711 BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
6712 auto *A = new (Ctx) BPFPreserveStaticOffsetAttr(Ctx, CommonInfo);
6713 A->setImplicit(true);
6714 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6715 A->setAttributeSpellingListIndex(0);
6716 return A;
6717 }
6718
6719 BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
6720 auto *A = new (Ctx) BPFPreserveStaticOffsetAttr(Ctx, CommonInfo);
6721 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6722 A->setAttributeSpellingListIndex(0);
6723 return A;
6724 }
6725
6726 BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
6727 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6728 switch (S) {
6729 case GNU_preserve_static_offset:
6730 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6731 case CXX11_clang_preserve_static_offset:
6732 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6733 case C23_clang_preserve_static_offset:
6734 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6735 default:
6736 llvm_unreachable("Unknown attribute spelling!");
6737 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6738 }
6739 }());
6740 return CreateImplicit(Ctx, I);
6741 }
6742
6743 BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
6744 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6745 switch (S) {
6746 case GNU_preserve_static_offset:
6747 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6748 case CXX11_clang_preserve_static_offset:
6749 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6750 case C23_clang_preserve_static_offset:
6751 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6752 default:
6753 llvm_unreachable("Unknown attribute spelling!");
6754 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6755 }
6756 }());
6757 return Create(Ctx, I);
6758 }
6759
6760 BPFPreserveStaticOffsetAttr::BPFPreserveStaticOffsetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
6761 )
6762 : InheritableAttr(Ctx, CommonInfo, attr::BPFPreserveStaticOffset, /*IsLateParsed=*/false, false)
6763 {
6764 }
6765
6766 BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::clone(ASTContext &C) const {
6767 auto *A = new (C) BPFPreserveStaticOffsetAttr(C, *this);
6768 A->Inherited = Inherited;
6769 A->IsPackExpansion = IsPackExpansion;
6770 A->setImplicit(Implicit);
6771 return A;
6772 }
6773
6774 void BPFPreserveStaticOffsetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
6775 bool IsFirstArgument = true; (void)IsFirstArgument;
6776 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
6777 switch (getAttributeSpellingListIndex()) {
6778 default:
6779 llvm_unreachable("Unknown attribute spelling!");
6780 break;
6781 case 0 : {
6782 OS << "__attribute__((preserve_static_offset";
6783 OS << "))";
6784 break;
6785 }
6786 case 1 : {
6787 OS << "[[clang::preserve_static_offset";
6788 OS << "]]";
6789 break;
6790 }
6791 case 2 : {
6792 OS << "[[clang::preserve_static_offset";
6793 OS << "]]";
6794 break;
6795 }
6796 }
6797 }
6798
6799 const char *BPFPreserveStaticOffsetAttr::getSpelling() const {
6800 switch (getAttributeSpellingListIndex()) {
6801 default:
6802 llvm_unreachable("Unknown attribute spelling!");
6803 return "(No spelling)";
6804 case 0:
6805 return "preserve_static_offset";
6806 case 1:
6807 return "preserve_static_offset";
6808 case 2:
6809 return "preserve_static_offset";
6810 }
6811 }
6812
6813
6814 // BTFDeclTagAttr implementation
6815
6816 BTFDeclTagAttr *BTFDeclTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFDeclTag, const AttributeCommonInfo &CommonInfo) {
6817 auto *A = new (Ctx) BTFDeclTagAttr(Ctx, CommonInfo, BTFDeclTag);
6818 A->setImplicit(true);
6819 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6820 A->setAttributeSpellingListIndex(0);
6821 return A;
6822 }
6823
6824 BTFDeclTagAttr *BTFDeclTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFDeclTag, const AttributeCommonInfo &CommonInfo) {
6825 auto *A = new (Ctx) BTFDeclTagAttr(Ctx, CommonInfo, BTFDeclTag);
6826 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6827 A->setAttributeSpellingListIndex(0);
6828 return A;
6829 }
6830
6831 BTFDeclTagAttr *BTFDeclTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFDeclTag, SourceRange Range, Spelling S) {
6832 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6833 switch (S) {
6834 case GNU_btf_decl_tag:
6835 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6836 case CXX11_clang_btf_decl_tag:
6837 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6838 case C23_clang_btf_decl_tag:
6839 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6840 default:
6841 llvm_unreachable("Unknown attribute spelling!");
6842 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6843 }
6844 }());
6845 return CreateImplicit(Ctx, BTFDeclTag, I);
6846 }
6847
6848 BTFDeclTagAttr *BTFDeclTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFDeclTag, SourceRange Range, Spelling S) {
6849 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6850 switch (S) {
6851 case GNU_btf_decl_tag:
6852 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6853 case CXX11_clang_btf_decl_tag:
6854 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6855 case C23_clang_btf_decl_tag:
6856 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6857 default:
6858 llvm_unreachable("Unknown attribute spelling!");
6859 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6860 }
6861 }());
6862 return Create(Ctx, BTFDeclTag, I);
6863 }
6864
6865 BTFDeclTagAttr::BTFDeclTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
6866 , llvm::StringRef BTFDeclTag
6867 )
6868 : InheritableAttr(Ctx, CommonInfo, attr::BTFDeclTag, /*IsLateParsed=*/false, false)
6869 , bTFDeclTagLength(BTFDeclTag.size()),bTFDeclTag(new (Ctx, 1) char[bTFDeclTagLength])
6870 {
6871 if (!BTFDeclTag.empty())
6872 std::memcpy(bTFDeclTag, BTFDeclTag.data(), bTFDeclTagLength);
6873 }
6874
6875
6876
6877 BTFDeclTagAttr *BTFDeclTagAttr::clone(ASTContext &C) const {
6878 auto *A = new (C) BTFDeclTagAttr(C, *this, getBTFDeclTag());
6879 A->Inherited = Inherited;
6880 A->IsPackExpansion = IsPackExpansion;
6881 A->setImplicit(Implicit);
6882 return A;
6883 }
6884
6885 void BTFDeclTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
6886 bool IsFirstArgument = true; (void)IsFirstArgument;
6887 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
6888 switch (getAttributeSpellingListIndex()) {
6889 default:
6890 llvm_unreachable("Unknown attribute spelling!");
6891 break;
6892 case 0 : {
6893 OS << "__attribute__((btf_decl_tag";
6894 DelimitAttributeArgument(OS, IsFirstArgument);
6895 OS << "\"" << getBTFDeclTag() << "\"";
6896 if (!IsFirstArgument)
6897 OS << ")";
6898 OS << "))";
6899 break;
6900 }
6901 case 1 : {
6902 OS << "[[clang::btf_decl_tag";
6903 DelimitAttributeArgument(OS, IsFirstArgument);
6904 OS << "\"" << getBTFDeclTag() << "\"";
6905 if (!IsFirstArgument)
6906 OS << ")";
6907 OS << "]]";
6908 break;
6909 }
6910 case 2 : {
6911 OS << "[[clang::btf_decl_tag";
6912 DelimitAttributeArgument(OS, IsFirstArgument);
6913 OS << "\"" << getBTFDeclTag() << "\"";
6914 if (!IsFirstArgument)
6915 OS << ")";
6916 OS << "]]";
6917 break;
6918 }
6919 }
6920 }
6921
6922 const char *BTFDeclTagAttr::getSpelling() const {
6923 switch (getAttributeSpellingListIndex()) {
6924 default:
6925 llvm_unreachable("Unknown attribute spelling!");
6926 return "(No spelling)";
6927 case 0:
6928 return "btf_decl_tag";
6929 case 1:
6930 return "btf_decl_tag";
6931 case 2:
6932 return "btf_decl_tag";
6933 }
6934 }
6935
6936
6937 // BTFTypeTagAttr implementation
6938
6939 BTFTypeTagAttr *BTFTypeTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFTypeTag, const AttributeCommonInfo &CommonInfo) {
6940 auto *A = new (Ctx) BTFTypeTagAttr(Ctx, CommonInfo, BTFTypeTag);
6941 A->setImplicit(true);
6942 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6943 A->setAttributeSpellingListIndex(0);
6944 return A;
6945 }
6946
6947 BTFTypeTagAttr *BTFTypeTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFTypeTag, const AttributeCommonInfo &CommonInfo) {
6948 auto *A = new (Ctx) BTFTypeTagAttr(Ctx, CommonInfo, BTFTypeTag);
6949 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
6950 A->setAttributeSpellingListIndex(0);
6951 return A;
6952 }
6953
6954 BTFTypeTagAttr *BTFTypeTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFTypeTag, SourceRange Range, Spelling S) {
6955 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6956 switch (S) {
6957 case GNU_btf_type_tag:
6958 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6959 case CXX11_clang_btf_type_tag:
6960 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6961 case C23_clang_btf_type_tag:
6962 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6963 default:
6964 llvm_unreachable("Unknown attribute spelling!");
6965 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6966 }
6967 }());
6968 return CreateImplicit(Ctx, BTFTypeTag, I);
6969 }
6970
6971 BTFTypeTagAttr *BTFTypeTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFTypeTag, SourceRange Range, Spelling S) {
6972 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
6973 switch (S) {
6974 case GNU_btf_type_tag:
6975 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6976 case CXX11_clang_btf_type_tag:
6977 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6978 case C23_clang_btf_type_tag:
6979 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6980 default:
6981 llvm_unreachable("Unknown attribute spelling!");
6982 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
6983 }
6984 }());
6985 return Create(Ctx, BTFTypeTag, I);
6986 }
6987
6988 BTFTypeTagAttr::BTFTypeTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
6989 , llvm::StringRef BTFTypeTag
6990 )
6991 : TypeAttr(Ctx, CommonInfo, attr::BTFTypeTag, /*IsLateParsed=*/false)
6992 , bTFTypeTagLength(BTFTypeTag.size()),bTFTypeTag(new (Ctx, 1) char[bTFTypeTagLength])
6993 {
6994 if (!BTFTypeTag.empty())
6995 std::memcpy(bTFTypeTag, BTFTypeTag.data(), bTFTypeTagLength);
6996 }
6997
6998
6999
7000 BTFTypeTagAttr *BTFTypeTagAttr::clone(ASTContext &C) const {
7001 auto *A = new (C) BTFTypeTagAttr(C, *this, getBTFTypeTag());
7002 A->Inherited = Inherited;
7003 A->IsPackExpansion = IsPackExpansion;
7004 A->setImplicit(Implicit);
7005 return A;
7006 }
7007
7008 void BTFTypeTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
7009 bool IsFirstArgument = true; (void)IsFirstArgument;
7010 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
7011 switch (getAttributeSpellingListIndex()) {
7012 default:
7013 llvm_unreachable("Unknown attribute spelling!");
7014 break;
7015 case 0 : {
7016 OS << "__attribute__((btf_type_tag";
7017 DelimitAttributeArgument(OS, IsFirstArgument);
7018 OS << "\"" << getBTFTypeTag() << "\"";
7019 if (!IsFirstArgument)
7020 OS << ")";
7021 OS << "))";
7022 break;
7023 }
7024 case 1 : {
7025 OS << "[[clang::btf_type_tag";
7026 DelimitAttributeArgument(OS, IsFirstArgument);
7027 OS << "\"" << getBTFTypeTag() << "\"";
7028 if (!IsFirstArgument)
7029 OS << ")";
7030 OS << "]]";
7031 break;
7032 }
7033 case 2 : {
7034 OS << "[[clang::btf_type_tag";
7035 DelimitAttributeArgument(OS, IsFirstArgument);
7036 OS << "\"" << getBTFTypeTag() << "\"";
7037 if (!IsFirstArgument)
7038 OS << ")";
7039 OS << "]]";
7040 break;
7041 }
7042 }
7043 }
7044
7045 const char *BTFTypeTagAttr::getSpelling() const {
7046 switch (getAttributeSpellingListIndex()) {
7047 default:
7048 llvm_unreachable("Unknown attribute spelling!");
7049 return "(No spelling)";
7050 case 0:
7051 return "btf_type_tag";
7052 case 1:
7053 return "btf_type_tag";
7054 case 2:
7055 return "btf_type_tag";
7056 }
7057 }
7058
7059
7060 // BlockingAttr implementation
7061
7062 BlockingAttr *BlockingAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7063 auto *A = new (Ctx) BlockingAttr(Ctx, CommonInfo);
7064 A->setImplicit(true);
7065 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7066 A->setAttributeSpellingListIndex(0);
7067 return A;
7068 }
7069
7070 BlockingAttr *BlockingAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7071 auto *A = new (Ctx) BlockingAttr(Ctx, CommonInfo);
7072 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7073 A->setAttributeSpellingListIndex(0);
7074 return A;
7075 }
7076
7077 BlockingAttr *BlockingAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
7078 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7079 switch (S) {
7080 case GNU_blocking:
7081 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7082 case CXX11_clang_blocking:
7083 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7084 case C23_clang_blocking:
7085 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7086 default:
7087 llvm_unreachable("Unknown attribute spelling!");
7088 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7089 }
7090 }());
7091 return CreateImplicit(Ctx, I);
7092 }
7093
7094 BlockingAttr *BlockingAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
7095 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7096 switch (S) {
7097 case GNU_blocking:
7098 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7099 case CXX11_clang_blocking:
7100 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7101 case C23_clang_blocking:
7102 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7103 default:
7104 llvm_unreachable("Unknown attribute spelling!");
7105 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7106 }
7107 }());
7108 return Create(Ctx, I);
7109 }
7110
7111 BlockingAttr::BlockingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
7112 )
7113 : TypeAttr(Ctx, CommonInfo, attr::Blocking, /*IsLateParsed=*/false)
7114 {
7115 }
7116
7117 BlockingAttr *BlockingAttr::clone(ASTContext &C) const {
7118 auto *A = new (C) BlockingAttr(C, *this);
7119 A->Inherited = Inherited;
7120 A->IsPackExpansion = IsPackExpansion;
7121 A->setImplicit(Implicit);
7122 return A;
7123 }
7124
7125 void BlockingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
7126 bool IsFirstArgument = true; (void)IsFirstArgument;
7127 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
7128 switch (getAttributeSpellingListIndex()) {
7129 default:
7130 llvm_unreachable("Unknown attribute spelling!");
7131 break;
7132 case 0 : {
7133 OS << "__attribute__((blocking";
7134 OS << "))";
7135 break;
7136 }
7137 case 1 : {
7138 OS << "[[clang::blocking";
7139 OS << "]]";
7140 break;
7141 }
7142 case 2 : {
7143 OS << "[[clang::blocking";
7144 OS << "]]";
7145 break;
7146 }
7147 }
7148 }
7149
7150 const char *BlockingAttr::getSpelling() const {
7151 switch (getAttributeSpellingListIndex()) {
7152 default:
7153 llvm_unreachable("Unknown attribute spelling!");
7154 return "(No spelling)";
7155 case 0:
7156 return "blocking";
7157 case 1:
7158 return "blocking";
7159 case 2:
7160 return "blocking";
7161 }
7162 }
7163
7164
7165 // BlocksAttr implementation
7166
7167 BlocksAttr *BlocksAttr::CreateImplicit(ASTContext &Ctx, BlocksAttr::BlockType Type, const AttributeCommonInfo &CommonInfo) {
7168 auto *A = new (Ctx) BlocksAttr(Ctx, CommonInfo, Type);
7169 A->setImplicit(true);
7170 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7171 A->setAttributeSpellingListIndex(0);
7172 return A;
7173 }
7174
7175 BlocksAttr *BlocksAttr::Create(ASTContext &Ctx, BlocksAttr::BlockType Type, const AttributeCommonInfo &CommonInfo) {
7176 auto *A = new (Ctx) BlocksAttr(Ctx, CommonInfo, Type);
7177 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7178 A->setAttributeSpellingListIndex(0);
7179 return A;
7180 }
7181
7182 BlocksAttr *BlocksAttr::CreateImplicit(ASTContext &Ctx, BlocksAttr::BlockType Type, SourceRange Range, Spelling S) {
7183 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7184 switch (S) {
7185 case GNU_blocks:
7186 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7187 case CXX11_clang_blocks:
7188 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7189 case C23_clang_blocks:
7190 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7191 default:
7192 llvm_unreachable("Unknown attribute spelling!");
7193 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7194 }
7195 }());
7196 return CreateImplicit(Ctx, Type, I);
7197 }
7198
7199 BlocksAttr *BlocksAttr::Create(ASTContext &Ctx, BlocksAttr::BlockType Type, SourceRange Range, Spelling S) {
7200 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7201 switch (S) {
7202 case GNU_blocks:
7203 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7204 case CXX11_clang_blocks:
7205 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7206 case C23_clang_blocks:
7207 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7208 default:
7209 llvm_unreachable("Unknown attribute spelling!");
7210 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7211 }
7212 }());
7213 return Create(Ctx, Type, I);
7214 }
7215
7216 BlocksAttr::BlocksAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
7217 , BlocksAttr::BlockType Type
7218 )
7219 : InheritableAttr(Ctx, CommonInfo, attr::Blocks, /*IsLateParsed=*/false, false)
7220 , type(Type)
7221 {
7222 }
7223
7224
7225
7226 bool BlocksAttr::ConvertStrToBlockType(StringRef Val, BlocksAttr::BlockType &Out) {
7227 std::optional<BlocksAttr::BlockType> R = llvm::StringSwitch<std::optional<BlocksAttr::BlockType>>(Val)
7228 .Case("byref", BlocksAttr::BlockType::ByRef)
7229 .Default(std::optional<BlocksAttr::BlockType>());
7230 if (R) {
7231 Out = *R;
7232 return true;
7233 }
7234 return false;
7235 }
7236
7237 const char *BlocksAttr::ConvertBlockTypeToStr(BlocksAttr::BlockType Val) {
7238 switch(Val) {
7239 case BlocksAttr::BlockType::ByRef: return "byref";
7240 }
7241 llvm_unreachable("No enumerator with that value");
7242 }
7243 BlocksAttr *BlocksAttr::clone(ASTContext &C) const {
7244 auto *A = new (C) BlocksAttr(C, *this, type);
7245 A->Inherited = Inherited;
7246 A->IsPackExpansion = IsPackExpansion;
7247 A->setImplicit(Implicit);
7248 return A;
7249 }
7250
7251 void BlocksAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
7252 bool IsFirstArgument = true; (void)IsFirstArgument;
7253 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
7254 switch (getAttributeSpellingListIndex()) {
7255 default:
7256 llvm_unreachable("Unknown attribute spelling!");
7257 break;
7258 case 0 : {
7259 OS << "__attribute__((blocks";
7260 DelimitAttributeArgument(OS, IsFirstArgument);
7261 OS << "\"" << BlocksAttr::ConvertBlockTypeToStr(getType()) << "\"";
7262 if (!IsFirstArgument)
7263 OS << ")";
7264 OS << "))";
7265 break;
7266 }
7267 case 1 : {
7268 OS << "[[clang::blocks";
7269 DelimitAttributeArgument(OS, IsFirstArgument);
7270 OS << "\"" << BlocksAttr::ConvertBlockTypeToStr(getType()) << "\"";
7271 if (!IsFirstArgument)
7272 OS << ")";
7273 OS << "]]";
7274 break;
7275 }
7276 case 2 : {
7277 OS << "[[clang::blocks";
7278 DelimitAttributeArgument(OS, IsFirstArgument);
7279 OS << "\"" << BlocksAttr::ConvertBlockTypeToStr(getType()) << "\"";
7280 if (!IsFirstArgument)
7281 OS << ")";
7282 OS << "]]";
7283 break;
7284 }
7285 }
7286 }
7287
7288 const char *BlocksAttr::getSpelling() const {
7289 switch (getAttributeSpellingListIndex()) {
7290 default:
7291 llvm_unreachable("Unknown attribute spelling!");
7292 return "(No spelling)";
7293 case 0:
7294 return "blocks";
7295 case 1:
7296 return "blocks";
7297 case 2:
7298 return "blocks";
7299 }
7300 }
7301
7302
7303 // BuiltinAttr implementation
7304
7305 BuiltinAttr *BuiltinAttr::CreateImplicit(ASTContext &Ctx, unsigned ID, const AttributeCommonInfo &CommonInfo) {
7306 auto *A = new (Ctx) BuiltinAttr(Ctx, CommonInfo, ID);
7307 A->setImplicit(true);
7308 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7309 A->setAttributeSpellingListIndex(0);
7310 return A;
7311 }
7312
7313 BuiltinAttr *BuiltinAttr::Create(ASTContext &Ctx, unsigned ID, const AttributeCommonInfo &CommonInfo) {
7314 auto *A = new (Ctx) BuiltinAttr(Ctx, CommonInfo, ID);
7315 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7316 A->setAttributeSpellingListIndex(0);
7317 return A;
7318 }
7319
7320 BuiltinAttr *BuiltinAttr::CreateImplicit(ASTContext &Ctx, unsigned ID, SourceRange Range) {
7321 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
7322 return CreateImplicit(Ctx, ID, I);
7323 }
7324
7325 BuiltinAttr *BuiltinAttr::Create(ASTContext &Ctx, unsigned ID, SourceRange Range) {
7326 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
7327 return Create(Ctx, ID, I);
7328 }
7329
7330 BuiltinAttr::BuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
7331 , unsigned ID
7332 )
7333 : InheritableAttr(Ctx, CommonInfo, attr::Builtin, /*IsLateParsed=*/false, false)
7334 , iD(ID)
7335 {
7336 }
7337
7338
7339
7340 BuiltinAttr *BuiltinAttr::clone(ASTContext &C) const {
7341 auto *A = new (C) BuiltinAttr(C, *this, iD);
7342 A->Inherited = Inherited;
7343 A->IsPackExpansion = IsPackExpansion;
7344 A->setImplicit(Implicit);
7345 return A;
7346 }
7347
7348 void BuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
7349 }
7350
7351 const char *BuiltinAttr::getSpelling() const {
7352 return "(No spelling)";
7353 }
7354
7355
7356 // BuiltinAliasAttr implementation
7357
7358 BuiltinAliasAttr *BuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) {
7359 auto *A = new (Ctx) BuiltinAliasAttr(Ctx, CommonInfo, BuiltinName);
7360 A->setImplicit(true);
7361 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7362 A->setAttributeSpellingListIndex(0);
7363 return A;
7364 }
7365
7366 BuiltinAliasAttr *BuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) {
7367 auto *A = new (Ctx) BuiltinAliasAttr(Ctx, CommonInfo, BuiltinName);
7368 return A;
7369 }
7370
7371 BuiltinAliasAttr *BuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, Spelling S) {
7372 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7373 switch (S) {
7374 case CXX11_clang_builtin_alias:
7375 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7376 case C23_clang_builtin_alias:
7377 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7378 case GNU_clang_builtin_alias:
7379 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7380 default:
7381 llvm_unreachable("Unknown attribute spelling!");
7382 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7383 }
7384 }());
7385 return CreateImplicit(Ctx, BuiltinName, I);
7386 }
7387
7388 BuiltinAliasAttr *BuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, Spelling S) {
7389 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7390 switch (S) {
7391 case CXX11_clang_builtin_alias:
7392 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7393 case C23_clang_builtin_alias:
7394 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7395 case GNU_clang_builtin_alias:
7396 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7397 default:
7398 llvm_unreachable("Unknown attribute spelling!");
7399 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7400 }
7401 }());
7402 return Create(Ctx, BuiltinName, I);
7403 }
7404
7405 BuiltinAliasAttr::BuiltinAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
7406 , IdentifierInfo * BuiltinName
7407 )
7408 : Attr(Ctx, CommonInfo, attr::BuiltinAlias, /*IsLateParsed=*/false)
7409 , builtinName(BuiltinName)
7410 {
7411 }
7412
7413 BuiltinAliasAttr::Spelling BuiltinAliasAttr::getSemanticSpelling() const {
7414 switch (getAttributeSpellingListIndex()) {
7415 default: llvm_unreachable("Unknown spelling list index");
7416 case 0: return CXX11_clang_builtin_alias;
7417 case 1: return C23_clang_builtin_alias;
7418 case 2: return GNU_clang_builtin_alias;
7419 }
7420 }
7421
7422
7423 BuiltinAliasAttr *BuiltinAliasAttr::clone(ASTContext &C) const {
7424 auto *A = new (C) BuiltinAliasAttr(C, *this, builtinName);
7425 A->Inherited = Inherited;
7426 A->IsPackExpansion = IsPackExpansion;
7427 A->setImplicit(Implicit);
7428 return A;
7429 }
7430
7431 void BuiltinAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
7432 bool IsFirstArgument = true; (void)IsFirstArgument;
7433 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
7434 switch (getAttributeSpellingListIndex()) {
7435 default:
7436 llvm_unreachable("Unknown attribute spelling!");
7437 break;
7438 case 0 : {
7439 OS << "[[clang::builtin_alias";
7440 DelimitAttributeArgument(OS, IsFirstArgument);
7441 OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << "";
7442 if (!IsFirstArgument)
7443 OS << ")";
7444 OS << "]]";
7445 break;
7446 }
7447 case 1 : {
7448 OS << "[[clang::builtin_alias";
7449 DelimitAttributeArgument(OS, IsFirstArgument);
7450 OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << "";
7451 if (!IsFirstArgument)
7452 OS << ")";
7453 OS << "]]";
7454 break;
7455 }
7456 case 2 : {
7457 OS << "__attribute__((clang_builtin_alias";
7458 DelimitAttributeArgument(OS, IsFirstArgument);
7459 OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << "";
7460 if (!IsFirstArgument)
7461 OS << ")";
7462 OS << "))";
7463 break;
7464 }
7465 }
7466 }
7467
7468 const char *BuiltinAliasAttr::getSpelling() const {
7469 switch (getAttributeSpellingListIndex()) {
7470 default:
7471 llvm_unreachable("Unknown attribute spelling!");
7472 return "(No spelling)";
7473 case 0:
7474 return "builtin_alias";
7475 case 1:
7476 return "builtin_alias";
7477 case 2:
7478 return "clang_builtin_alias";
7479 }
7480 }
7481
7482
7483 // C11NoReturnAttr implementation
7484
7485 C11NoReturnAttr *C11NoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7486 auto *A = new (Ctx) C11NoReturnAttr(Ctx, CommonInfo);
7487 A->setImplicit(true);
7488 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7489 A->setAttributeSpellingListIndex(0);
7490 return A;
7491 }
7492
7493 C11NoReturnAttr *C11NoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7494 auto *A = new (Ctx) C11NoReturnAttr(Ctx, CommonInfo);
7495 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7496 A->setAttributeSpellingListIndex(0);
7497 return A;
7498 }
7499
7500 C11NoReturnAttr *C11NoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
7501 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
7502 return CreateImplicit(Ctx, I);
7503 }
7504
7505 C11NoReturnAttr *C11NoReturnAttr::Create(ASTContext &Ctx, SourceRange Range) {
7506 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
7507 return Create(Ctx, I);
7508 }
7509
7510 C11NoReturnAttr::C11NoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
7511 )
7512 : InheritableAttr(Ctx, CommonInfo, attr::C11NoReturn, /*IsLateParsed=*/false, false)
7513 {
7514 }
7515
7516 C11NoReturnAttr *C11NoReturnAttr::clone(ASTContext &C) const {
7517 auto *A = new (C) C11NoReturnAttr(C, *this);
7518 A->Inherited = Inherited;
7519 A->IsPackExpansion = IsPackExpansion;
7520 A->setImplicit(Implicit);
7521 return A;
7522 }
7523
7524 void C11NoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
7525 bool IsFirstArgument = true; (void)IsFirstArgument;
7526 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
7527 switch (getAttributeSpellingListIndex()) {
7528 default:
7529 llvm_unreachable("Unknown attribute spelling!");
7530 break;
7531 case 0 : {
7532 OS << "_Noreturn";
7533 OS << "";
7534 break;
7535 }
7536 }
7537 }
7538
7539 const char *C11NoReturnAttr::getSpelling() const {
7540 switch (getAttributeSpellingListIndex()) {
7541 default:
7542 llvm_unreachable("Unknown attribute spelling!");
7543 return "(No spelling)";
7544 case 0:
7545 return "_Noreturn";
7546 }
7547 }
7548
7549
7550 // CDeclAttr implementation
7551
7552 CDeclAttr *CDeclAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7553 auto *A = new (Ctx) CDeclAttr(Ctx, CommonInfo);
7554 A->setImplicit(true);
7555 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7556 A->setAttributeSpellingListIndex(0);
7557 return A;
7558 }
7559
7560 CDeclAttr *CDeclAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7561 auto *A = new (Ctx) CDeclAttr(Ctx, CommonInfo);
7562 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7563 A->setAttributeSpellingListIndex(0);
7564 return A;
7565 }
7566
7567 CDeclAttr *CDeclAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
7568 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7569 switch (S) {
7570 case GNU_cdecl:
7571 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7572 case CXX11_gnu_cdecl:
7573 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7574 case C23_gnu_cdecl:
7575 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7576 case Keyword_cdecl:
7577 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7578 default:
7579 llvm_unreachable("Unknown attribute spelling!");
7580 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7581 }
7582 }());
7583 return CreateImplicit(Ctx, I);
7584 }
7585
7586 CDeclAttr *CDeclAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
7587 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7588 switch (S) {
7589 case GNU_cdecl:
7590 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7591 case CXX11_gnu_cdecl:
7592 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7593 case C23_gnu_cdecl:
7594 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7595 case Keyword_cdecl:
7596 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7597 default:
7598 llvm_unreachable("Unknown attribute spelling!");
7599 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7600 }
7601 }());
7602 return Create(Ctx, I);
7603 }
7604
7605 CDeclAttr::CDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
7606 )
7607 : InheritableAttr(Ctx, CommonInfo, attr::CDecl, /*IsLateParsed=*/false, false)
7608 {
7609 }
7610
7611 CDeclAttr *CDeclAttr::clone(ASTContext &C) const {
7612 auto *A = new (C) CDeclAttr(C, *this);
7613 A->Inherited = Inherited;
7614 A->IsPackExpansion = IsPackExpansion;
7615 A->setImplicit(Implicit);
7616 return A;
7617 }
7618
7619 void CDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
7620 bool IsFirstArgument = true; (void)IsFirstArgument;
7621 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
7622 switch (getAttributeSpellingListIndex()) {
7623 default:
7624 llvm_unreachable("Unknown attribute spelling!");
7625 break;
7626 case 0 : {
7627 OS << "__attribute__((cdecl";
7628 OS << "))";
7629 break;
7630 }
7631 case 1 : {
7632 OS << "[[gnu::cdecl";
7633 OS << "]]";
7634 break;
7635 }
7636 case 2 : {
7637 OS << "[[gnu::cdecl";
7638 OS << "]]";
7639 break;
7640 }
7641 case 3 : {
7642 OS << "__cdecl";
7643 OS << "";
7644 break;
7645 }
7646 case 4 : {
7647 OS << "_cdecl";
7648 OS << "";
7649 break;
7650 }
7651 }
7652 }
7653
7654 const char *CDeclAttr::getSpelling() const {
7655 switch (getAttributeSpellingListIndex()) {
7656 default:
7657 llvm_unreachable("Unknown attribute spelling!");
7658 return "(No spelling)";
7659 case 0:
7660 return "cdecl";
7661 case 1:
7662 return "cdecl";
7663 case 2:
7664 return "cdecl";
7665 case 3:
7666 return "__cdecl";
7667 case 4:
7668 return "_cdecl";
7669 }
7670 }
7671
7672
7673 // CFAuditedTransferAttr implementation
7674
7675 CFAuditedTransferAttr *CFAuditedTransferAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7676 auto *A = new (Ctx) CFAuditedTransferAttr(Ctx, CommonInfo);
7677 A->setImplicit(true);
7678 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7679 A->setAttributeSpellingListIndex(0);
7680 return A;
7681 }
7682
7683 CFAuditedTransferAttr *CFAuditedTransferAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7684 auto *A = new (Ctx) CFAuditedTransferAttr(Ctx, CommonInfo);
7685 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7686 A->setAttributeSpellingListIndex(0);
7687 return A;
7688 }
7689
7690 CFAuditedTransferAttr *CFAuditedTransferAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
7691 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7692 switch (S) {
7693 case GNU_cf_audited_transfer:
7694 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7695 case CXX11_clang_cf_audited_transfer:
7696 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7697 case C23_clang_cf_audited_transfer:
7698 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7699 default:
7700 llvm_unreachable("Unknown attribute spelling!");
7701 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7702 }
7703 }());
7704 return CreateImplicit(Ctx, I);
7705 }
7706
7707 CFAuditedTransferAttr *CFAuditedTransferAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
7708 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7709 switch (S) {
7710 case GNU_cf_audited_transfer:
7711 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7712 case CXX11_clang_cf_audited_transfer:
7713 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7714 case C23_clang_cf_audited_transfer:
7715 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7716 default:
7717 llvm_unreachable("Unknown attribute spelling!");
7718 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7719 }
7720 }());
7721 return Create(Ctx, I);
7722 }
7723
7724 CFAuditedTransferAttr::CFAuditedTransferAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
7725 )
7726 : InheritableAttr(Ctx, CommonInfo, attr::CFAuditedTransfer, /*IsLateParsed=*/false, false)
7727 {
7728 }
7729
7730 CFAuditedTransferAttr *CFAuditedTransferAttr::clone(ASTContext &C) const {
7731 auto *A = new (C) CFAuditedTransferAttr(C, *this);
7732 A->Inherited = Inherited;
7733 A->IsPackExpansion = IsPackExpansion;
7734 A->setImplicit(Implicit);
7735 return A;
7736 }
7737
7738 void CFAuditedTransferAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
7739 bool IsFirstArgument = true; (void)IsFirstArgument;
7740 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
7741 switch (getAttributeSpellingListIndex()) {
7742 default:
7743 llvm_unreachable("Unknown attribute spelling!");
7744 break;
7745 case 0 : {
7746 OS << "__attribute__((cf_audited_transfer";
7747 OS << "))";
7748 break;
7749 }
7750 case 1 : {
7751 OS << "[[clang::cf_audited_transfer";
7752 OS << "]]";
7753 break;
7754 }
7755 case 2 : {
7756 OS << "[[clang::cf_audited_transfer";
7757 OS << "]]";
7758 break;
7759 }
7760 }
7761 }
7762
7763 const char *CFAuditedTransferAttr::getSpelling() const {
7764 switch (getAttributeSpellingListIndex()) {
7765 default:
7766 llvm_unreachable("Unknown attribute spelling!");
7767 return "(No spelling)";
7768 case 0:
7769 return "cf_audited_transfer";
7770 case 1:
7771 return "cf_audited_transfer";
7772 case 2:
7773 return "cf_audited_transfer";
7774 }
7775 }
7776
7777
7778 // CFConsumedAttr implementation
7779
7780 CFConsumedAttr *CFConsumedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7781 auto *A = new (Ctx) CFConsumedAttr(Ctx, CommonInfo);
7782 A->setImplicit(true);
7783 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7784 A->setAttributeSpellingListIndex(0);
7785 return A;
7786 }
7787
7788 CFConsumedAttr *CFConsumedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
7789 auto *A = new (Ctx) CFConsumedAttr(Ctx, CommonInfo);
7790 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7791 A->setAttributeSpellingListIndex(0);
7792 return A;
7793 }
7794
7795 CFConsumedAttr *CFConsumedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
7796 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7797 switch (S) {
7798 case GNU_cf_consumed:
7799 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7800 case CXX11_clang_cf_consumed:
7801 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7802 case C23_clang_cf_consumed:
7803 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7804 default:
7805 llvm_unreachable("Unknown attribute spelling!");
7806 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7807 }
7808 }());
7809 return CreateImplicit(Ctx, I);
7810 }
7811
7812 CFConsumedAttr *CFConsumedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
7813 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7814 switch (S) {
7815 case GNU_cf_consumed:
7816 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7817 case CXX11_clang_cf_consumed:
7818 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7819 case C23_clang_cf_consumed:
7820 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7821 default:
7822 llvm_unreachable("Unknown attribute spelling!");
7823 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7824 }
7825 }());
7826 return Create(Ctx, I);
7827 }
7828
7829 CFConsumedAttr::CFConsumedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
7830 )
7831 : InheritableParamAttr(Ctx, CommonInfo, attr::CFConsumed, /*IsLateParsed=*/false, false)
7832 {
7833 }
7834
7835 CFConsumedAttr *CFConsumedAttr::clone(ASTContext &C) const {
7836 auto *A = new (C) CFConsumedAttr(C, *this);
7837 A->Inherited = Inherited;
7838 A->IsPackExpansion = IsPackExpansion;
7839 A->setImplicit(Implicit);
7840 return A;
7841 }
7842
7843 void CFConsumedAttr::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__((cf_consumed";
7852 OS << "))";
7853 break;
7854 }
7855 case 1 : {
7856 OS << "[[clang::cf_consumed";
7857 OS << "]]";
7858 break;
7859 }
7860 case 2 : {
7861 OS << "[[clang::cf_consumed";
7862 OS << "]]";
7863 break;
7864 }
7865 }
7866 }
7867
7868 const char *CFConsumedAttr::getSpelling() const {
7869 switch (getAttributeSpellingListIndex()) {
7870 default:
7871 llvm_unreachable("Unknown attribute spelling!");
7872 return "(No spelling)";
7873 case 0:
7874 return "cf_consumed";
7875 case 1:
7876 return "cf_consumed";
7877 case 2:
7878 return "cf_consumed";
7879 }
7880 }
7881
7882
7883 // CFGuardAttr implementation
7884
7885 CFGuardAttr *CFGuardAttr::CreateImplicit(ASTContext &Ctx, CFGuardAttr::GuardArg Guard, const AttributeCommonInfo &CommonInfo) {
7886 auto *A = new (Ctx) CFGuardAttr(Ctx, CommonInfo, Guard);
7887 A->setImplicit(true);
7888 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7889 A->setAttributeSpellingListIndex(0);
7890 return A;
7891 }
7892
7893 CFGuardAttr *CFGuardAttr::Create(ASTContext &Ctx, CFGuardAttr::GuardArg Guard, const AttributeCommonInfo &CommonInfo) {
7894 auto *A = new (Ctx) CFGuardAttr(Ctx, CommonInfo, Guard);
7895 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
7896 A->setAttributeSpellingListIndex(0);
7897 return A;
7898 }
7899
7900 CFGuardAttr *CFGuardAttr::CreateImplicit(ASTContext &Ctx, CFGuardAttr::GuardArg Guard, SourceRange Range, Spelling S) {
7901 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7902 switch (S) {
7903 case Declspec_guard:
7904 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7905 case GNU_guard:
7906 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7907 case CXX11_clang_guard:
7908 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7909 case C23_clang_guard:
7910 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7911 default:
7912 llvm_unreachable("Unknown attribute spelling!");
7913 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7914 }
7915 }());
7916 return CreateImplicit(Ctx, Guard, I);
7917 }
7918
7919 CFGuardAttr *CFGuardAttr::Create(ASTContext &Ctx, CFGuardAttr::GuardArg Guard, SourceRange Range, Spelling S) {
7920 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
7921 switch (S) {
7922 case Declspec_guard:
7923 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7924 case GNU_guard:
7925 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7926 case CXX11_clang_guard:
7927 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7928 case C23_clang_guard:
7929 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7930 default:
7931 llvm_unreachable("Unknown attribute spelling!");
7932 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
7933 }
7934 }());
7935 return Create(Ctx, Guard, I);
7936 }
7937
7938 CFGuardAttr::CFGuardAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
7939 , CFGuardAttr::GuardArg Guard
7940 )
7941 : InheritableAttr(Ctx, CommonInfo, attr::CFGuard, /*IsLateParsed=*/false, false)
7942 , guard(Guard)
7943 {
7944 }
7945
7946
7947
7948 bool CFGuardAttr::ConvertStrToGuardArg(StringRef Val, CFGuardAttr::GuardArg &Out) {
7949 std::optional<CFGuardAttr::GuardArg> R = llvm::StringSwitch<std::optional<CFGuardAttr::GuardArg>>(Val)
7950 .Case("nocf", CFGuardAttr::GuardArg::nocf)
7951 .Default(std::optional<CFGuardAttr::GuardArg>());
7952 if (R) {
7953 Out = *R;
7954 return true;
7955 }
7956 return false;
7957 }
7958
7959 const char *CFGuardAttr::ConvertGuardArgToStr(CFGuardAttr::GuardArg Val) {
7960 switch(Val) {
7961 case CFGuardAttr::GuardArg::nocf: return "nocf";
7962 }
7963 llvm_unreachable("No enumerator with that value");
7964 }
7965 CFGuardAttr *CFGuardAttr::clone(ASTContext &C) const {
7966 auto *A = new (C) CFGuardAttr(C, *this, guard);
7967 A->Inherited = Inherited;
7968 A->IsPackExpansion = IsPackExpansion;
7969 A->setImplicit(Implicit);
7970 return A;
7971 }
7972
7973 void CFGuardAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
7974 bool IsFirstArgument = true; (void)IsFirstArgument;
7975 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
7976 switch (getAttributeSpellingListIndex()) {
7977 default:
7978 llvm_unreachable("Unknown attribute spelling!");
7979 break;
7980 case 0 : {
7981 OS << "__declspec(guard";
7982 DelimitAttributeArgument(OS, IsFirstArgument);
7983 OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\"";
7984 if (!IsFirstArgument)
7985 OS << ")";
7986 OS << ")";
7987 break;
7988 }
7989 case 1 : {
7990 OS << "__attribute__((guard";
7991 DelimitAttributeArgument(OS, IsFirstArgument);
7992 OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\"";
7993 if (!IsFirstArgument)
7994 OS << ")";
7995 OS << "))";
7996 break;
7997 }
7998 case 2 : {
7999 OS << "[[clang::guard";
8000 DelimitAttributeArgument(OS, IsFirstArgument);
8001 OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\"";
8002 if (!IsFirstArgument)
8003 OS << ")";
8004 OS << "]]";
8005 break;
8006 }
8007 case 3 : {
8008 OS << "[[clang::guard";
8009 DelimitAttributeArgument(OS, IsFirstArgument);
8010 OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\"";
8011 if (!IsFirstArgument)
8012 OS << ")";
8013 OS << "]]";
8014 break;
8015 }
8016 }
8017 }
8018
8019 const char *CFGuardAttr::getSpelling() const {
8020 switch (getAttributeSpellingListIndex()) {
8021 default:
8022 llvm_unreachable("Unknown attribute spelling!");
8023 return "(No spelling)";
8024 case 0:
8025 return "guard";
8026 case 1:
8027 return "guard";
8028 case 2:
8029 return "guard";
8030 case 3:
8031 return "guard";
8032 }
8033 }
8034
8035
8036 // CFICanonicalJumpTableAttr implementation
8037
8038 CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8039 auto *A = new (Ctx) CFICanonicalJumpTableAttr(Ctx, CommonInfo);
8040 A->setImplicit(true);
8041 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8042 A->setAttributeSpellingListIndex(0);
8043 return A;
8044 }
8045
8046 CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8047 auto *A = new (Ctx) CFICanonicalJumpTableAttr(Ctx, CommonInfo);
8048 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8049 A->setAttributeSpellingListIndex(0);
8050 return A;
8051 }
8052
8053 CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
8054 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8055 switch (S) {
8056 case GNU_cfi_canonical_jump_table:
8057 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8058 case CXX11_clang_cfi_canonical_jump_table:
8059 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8060 case C23_clang_cfi_canonical_jump_table:
8061 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8062 default:
8063 llvm_unreachable("Unknown attribute spelling!");
8064 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8065 }
8066 }());
8067 return CreateImplicit(Ctx, I);
8068 }
8069
8070 CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
8071 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8072 switch (S) {
8073 case GNU_cfi_canonical_jump_table:
8074 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8075 case CXX11_clang_cfi_canonical_jump_table:
8076 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8077 case C23_clang_cfi_canonical_jump_table:
8078 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8079 default:
8080 llvm_unreachable("Unknown attribute spelling!");
8081 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8082 }
8083 }());
8084 return Create(Ctx, I);
8085 }
8086
8087 CFICanonicalJumpTableAttr::CFICanonicalJumpTableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8088 )
8089 : InheritableAttr(Ctx, CommonInfo, attr::CFICanonicalJumpTable, /*IsLateParsed=*/false, false)
8090 {
8091 }
8092
8093 CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::clone(ASTContext &C) const {
8094 auto *A = new (C) CFICanonicalJumpTableAttr(C, *this);
8095 A->Inherited = Inherited;
8096 A->IsPackExpansion = IsPackExpansion;
8097 A->setImplicit(Implicit);
8098 return A;
8099 }
8100
8101 void CFICanonicalJumpTableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
8102 bool IsFirstArgument = true; (void)IsFirstArgument;
8103 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
8104 switch (getAttributeSpellingListIndex()) {
8105 default:
8106 llvm_unreachable("Unknown attribute spelling!");
8107 break;
8108 case 0 : {
8109 OS << "__attribute__((cfi_canonical_jump_table";
8110 OS << "))";
8111 break;
8112 }
8113 case 1 : {
8114 OS << "[[clang::cfi_canonical_jump_table";
8115 OS << "]]";
8116 break;
8117 }
8118 case 2 : {
8119 OS << "[[clang::cfi_canonical_jump_table";
8120 OS << "]]";
8121 break;
8122 }
8123 }
8124 }
8125
8126 const char *CFICanonicalJumpTableAttr::getSpelling() const {
8127 switch (getAttributeSpellingListIndex()) {
8128 default:
8129 llvm_unreachable("Unknown attribute spelling!");
8130 return "(No spelling)";
8131 case 0:
8132 return "cfi_canonical_jump_table";
8133 case 1:
8134 return "cfi_canonical_jump_table";
8135 case 2:
8136 return "cfi_canonical_jump_table";
8137 }
8138 }
8139
8140
8141 // CFReturnsNotRetainedAttr implementation
8142
8143 CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8144 auto *A = new (Ctx) CFReturnsNotRetainedAttr(Ctx, CommonInfo);
8145 A->setImplicit(true);
8146 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8147 A->setAttributeSpellingListIndex(0);
8148 return A;
8149 }
8150
8151 CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8152 auto *A = new (Ctx) CFReturnsNotRetainedAttr(Ctx, CommonInfo);
8153 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8154 A->setAttributeSpellingListIndex(0);
8155 return A;
8156 }
8157
8158 CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
8159 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8160 switch (S) {
8161 case GNU_cf_returns_not_retained:
8162 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8163 case CXX11_clang_cf_returns_not_retained:
8164 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8165 case C23_clang_cf_returns_not_retained:
8166 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8167 default:
8168 llvm_unreachable("Unknown attribute spelling!");
8169 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8170 }
8171 }());
8172 return CreateImplicit(Ctx, I);
8173 }
8174
8175 CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
8176 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8177 switch (S) {
8178 case GNU_cf_returns_not_retained:
8179 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8180 case CXX11_clang_cf_returns_not_retained:
8181 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8182 case C23_clang_cf_returns_not_retained:
8183 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8184 default:
8185 llvm_unreachable("Unknown attribute spelling!");
8186 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8187 }
8188 }());
8189 return Create(Ctx, I);
8190 }
8191
8192 CFReturnsNotRetainedAttr::CFReturnsNotRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8193 )
8194 : InheritableAttr(Ctx, CommonInfo, attr::CFReturnsNotRetained, /*IsLateParsed=*/false, false)
8195 {
8196 }
8197
8198 CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::clone(ASTContext &C) const {
8199 auto *A = new (C) CFReturnsNotRetainedAttr(C, *this);
8200 A->Inherited = Inherited;
8201 A->IsPackExpansion = IsPackExpansion;
8202 A->setImplicit(Implicit);
8203 return A;
8204 }
8205
8206 void CFReturnsNotRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
8207 bool IsFirstArgument = true; (void)IsFirstArgument;
8208 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
8209 switch (getAttributeSpellingListIndex()) {
8210 default:
8211 llvm_unreachable("Unknown attribute spelling!");
8212 break;
8213 case 0 : {
8214 OS << "__attribute__((cf_returns_not_retained";
8215 OS << "))";
8216 break;
8217 }
8218 case 1 : {
8219 OS << "[[clang::cf_returns_not_retained";
8220 OS << "]]";
8221 break;
8222 }
8223 case 2 : {
8224 OS << "[[clang::cf_returns_not_retained";
8225 OS << "]]";
8226 break;
8227 }
8228 }
8229 }
8230
8231 const char *CFReturnsNotRetainedAttr::getSpelling() const {
8232 switch (getAttributeSpellingListIndex()) {
8233 default:
8234 llvm_unreachable("Unknown attribute spelling!");
8235 return "(No spelling)";
8236 case 0:
8237 return "cf_returns_not_retained";
8238 case 1:
8239 return "cf_returns_not_retained";
8240 case 2:
8241 return "cf_returns_not_retained";
8242 }
8243 }
8244
8245
8246 // CFReturnsRetainedAttr implementation
8247
8248 CFReturnsRetainedAttr *CFReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8249 auto *A = new (Ctx) CFReturnsRetainedAttr(Ctx, CommonInfo);
8250 A->setImplicit(true);
8251 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8252 A->setAttributeSpellingListIndex(0);
8253 return A;
8254 }
8255
8256 CFReturnsRetainedAttr *CFReturnsRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8257 auto *A = new (Ctx) CFReturnsRetainedAttr(Ctx, CommonInfo);
8258 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8259 A->setAttributeSpellingListIndex(0);
8260 return A;
8261 }
8262
8263 CFReturnsRetainedAttr *CFReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
8264 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8265 switch (S) {
8266 case GNU_cf_returns_retained:
8267 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8268 case CXX11_clang_cf_returns_retained:
8269 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8270 case C23_clang_cf_returns_retained:
8271 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8272 default:
8273 llvm_unreachable("Unknown attribute spelling!");
8274 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8275 }
8276 }());
8277 return CreateImplicit(Ctx, I);
8278 }
8279
8280 CFReturnsRetainedAttr *CFReturnsRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
8281 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8282 switch (S) {
8283 case GNU_cf_returns_retained:
8284 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8285 case CXX11_clang_cf_returns_retained:
8286 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8287 case C23_clang_cf_returns_retained:
8288 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8289 default:
8290 llvm_unreachable("Unknown attribute spelling!");
8291 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8292 }
8293 }());
8294 return Create(Ctx, I);
8295 }
8296
8297 CFReturnsRetainedAttr::CFReturnsRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8298 )
8299 : InheritableAttr(Ctx, CommonInfo, attr::CFReturnsRetained, /*IsLateParsed=*/false, false)
8300 {
8301 }
8302
8303 CFReturnsRetainedAttr *CFReturnsRetainedAttr::clone(ASTContext &C) const {
8304 auto *A = new (C) CFReturnsRetainedAttr(C, *this);
8305 A->Inherited = Inherited;
8306 A->IsPackExpansion = IsPackExpansion;
8307 A->setImplicit(Implicit);
8308 return A;
8309 }
8310
8311 void CFReturnsRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
8312 bool IsFirstArgument = true; (void)IsFirstArgument;
8313 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
8314 switch (getAttributeSpellingListIndex()) {
8315 default:
8316 llvm_unreachable("Unknown attribute spelling!");
8317 break;
8318 case 0 : {
8319 OS << "__attribute__((cf_returns_retained";
8320 OS << "))";
8321 break;
8322 }
8323 case 1 : {
8324 OS << "[[clang::cf_returns_retained";
8325 OS << "]]";
8326 break;
8327 }
8328 case 2 : {
8329 OS << "[[clang::cf_returns_retained";
8330 OS << "]]";
8331 break;
8332 }
8333 }
8334 }
8335
8336 const char *CFReturnsRetainedAttr::getSpelling() const {
8337 switch (getAttributeSpellingListIndex()) {
8338 default:
8339 llvm_unreachable("Unknown attribute spelling!");
8340 return "(No spelling)";
8341 case 0:
8342 return "cf_returns_retained";
8343 case 1:
8344 return "cf_returns_retained";
8345 case 2:
8346 return "cf_returns_retained";
8347 }
8348 }
8349
8350
8351 // CFUnknownTransferAttr implementation
8352
8353 CFUnknownTransferAttr *CFUnknownTransferAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8354 auto *A = new (Ctx) CFUnknownTransferAttr(Ctx, CommonInfo);
8355 A->setImplicit(true);
8356 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8357 A->setAttributeSpellingListIndex(0);
8358 return A;
8359 }
8360
8361 CFUnknownTransferAttr *CFUnknownTransferAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8362 auto *A = new (Ctx) CFUnknownTransferAttr(Ctx, CommonInfo);
8363 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8364 A->setAttributeSpellingListIndex(0);
8365 return A;
8366 }
8367
8368 CFUnknownTransferAttr *CFUnknownTransferAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
8369 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8370 switch (S) {
8371 case GNU_cf_unknown_transfer:
8372 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8373 case CXX11_clang_cf_unknown_transfer:
8374 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8375 case C23_clang_cf_unknown_transfer:
8376 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8377 default:
8378 llvm_unreachable("Unknown attribute spelling!");
8379 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8380 }
8381 }());
8382 return CreateImplicit(Ctx, I);
8383 }
8384
8385 CFUnknownTransferAttr *CFUnknownTransferAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
8386 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8387 switch (S) {
8388 case GNU_cf_unknown_transfer:
8389 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8390 case CXX11_clang_cf_unknown_transfer:
8391 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8392 case C23_clang_cf_unknown_transfer:
8393 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8394 default:
8395 llvm_unreachable("Unknown attribute spelling!");
8396 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8397 }
8398 }());
8399 return Create(Ctx, I);
8400 }
8401
8402 CFUnknownTransferAttr::CFUnknownTransferAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8403 )
8404 : InheritableAttr(Ctx, CommonInfo, attr::CFUnknownTransfer, /*IsLateParsed=*/false, false)
8405 {
8406 }
8407
8408 CFUnknownTransferAttr *CFUnknownTransferAttr::clone(ASTContext &C) const {
8409 auto *A = new (C) CFUnknownTransferAttr(C, *this);
8410 A->Inherited = Inherited;
8411 A->IsPackExpansion = IsPackExpansion;
8412 A->setImplicit(Implicit);
8413 return A;
8414 }
8415
8416 void CFUnknownTransferAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
8417 bool IsFirstArgument = true; (void)IsFirstArgument;
8418 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
8419 switch (getAttributeSpellingListIndex()) {
8420 default:
8421 llvm_unreachable("Unknown attribute spelling!");
8422 break;
8423 case 0 : {
8424 OS << "__attribute__((cf_unknown_transfer";
8425 OS << "))";
8426 break;
8427 }
8428 case 1 : {
8429 OS << "[[clang::cf_unknown_transfer";
8430 OS << "]]";
8431 break;
8432 }
8433 case 2 : {
8434 OS << "[[clang::cf_unknown_transfer";
8435 OS << "]]";
8436 break;
8437 }
8438 }
8439 }
8440
8441 const char *CFUnknownTransferAttr::getSpelling() const {
8442 switch (getAttributeSpellingListIndex()) {
8443 default:
8444 llvm_unreachable("Unknown attribute spelling!");
8445 return "(No spelling)";
8446 case 0:
8447 return "cf_unknown_transfer";
8448 case 1:
8449 return "cf_unknown_transfer";
8450 case 2:
8451 return "cf_unknown_transfer";
8452 }
8453 }
8454
8455
8456 // CPUDispatchAttr implementation
8457
8458 CPUDispatchAttr *CPUDispatchAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) {
8459 auto *A = new (Ctx) CPUDispatchAttr(Ctx, CommonInfo, Cpus, CpusSize);
8460 A->setImplicit(true);
8461 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8462 A->setAttributeSpellingListIndex(0);
8463 return A;
8464 }
8465
8466 CPUDispatchAttr *CPUDispatchAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) {
8467 auto *A = new (Ctx) CPUDispatchAttr(Ctx, CommonInfo, Cpus, CpusSize);
8468 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8469 A->setAttributeSpellingListIndex(0);
8470 return A;
8471 }
8472
8473 CPUDispatchAttr *CPUDispatchAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, Spelling S) {
8474 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8475 switch (S) {
8476 case GNU_cpu_dispatch:
8477 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8478 case CXX11_clang_cpu_dispatch:
8479 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8480 case C23_clang_cpu_dispatch:
8481 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8482 case Declspec_cpu_dispatch:
8483 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8484 default:
8485 llvm_unreachable("Unknown attribute spelling!");
8486 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8487 }
8488 }());
8489 return CreateImplicit(Ctx, Cpus, CpusSize, I);
8490 }
8491
8492 CPUDispatchAttr *CPUDispatchAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, Spelling S) {
8493 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8494 switch (S) {
8495 case GNU_cpu_dispatch:
8496 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8497 case CXX11_clang_cpu_dispatch:
8498 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8499 case C23_clang_cpu_dispatch:
8500 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8501 case Declspec_cpu_dispatch:
8502 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8503 default:
8504 llvm_unreachable("Unknown attribute spelling!");
8505 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8506 }
8507 }());
8508 return Create(Ctx, Cpus, CpusSize, I);
8509 }
8510
8511 CPUDispatchAttr::CPUDispatchAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8512 , IdentifierInfo * *Cpus, unsigned CpusSize
8513 )
8514 : InheritableAttr(Ctx, CommonInfo, attr::CPUDispatch, /*IsLateParsed=*/false, false)
8515 , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size])
8516 {
8517 std::copy(Cpus, Cpus + cpus_Size, cpus_);
8518 }
8519
8520 CPUDispatchAttr::CPUDispatchAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8521 )
8522 : InheritableAttr(Ctx, CommonInfo, attr::CPUDispatch, /*IsLateParsed=*/false, false)
8523 , cpus_Size(0), cpus_(nullptr)
8524 {
8525 }
8526
8527
8528
8529 CPUDispatchAttr *CPUDispatchAttr::clone(ASTContext &C) const {
8530 auto *A = new (C) CPUDispatchAttr(C, *this, cpus_, cpus_Size);
8531 A->Inherited = Inherited;
8532 A->IsPackExpansion = IsPackExpansion;
8533 A->setImplicit(Implicit);
8534 return A;
8535 }
8536
8537 void CPUDispatchAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
8538 bool IsFirstArgument = true; (void)IsFirstArgument;
8539 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
8540 switch (getAttributeSpellingListIndex()) {
8541 default:
8542 llvm_unreachable("Unknown attribute spelling!");
8543 break;
8544 case 0 : {
8545 OS << "__attribute__((cpu_dispatch";
8546 OS << "";
8547 for (const auto &Val : cpus()) {
8548 DelimitAttributeArgument(OS, IsFirstArgument);
8549 OS << Val;
8550 }
8551 OS << "";
8552 if (!IsFirstArgument)
8553 OS << ")";
8554 OS << "))";
8555 break;
8556 }
8557 case 1 : {
8558 OS << "[[clang::cpu_dispatch";
8559 OS << "";
8560 for (const auto &Val : cpus()) {
8561 DelimitAttributeArgument(OS, IsFirstArgument);
8562 OS << Val;
8563 }
8564 OS << "";
8565 if (!IsFirstArgument)
8566 OS << ")";
8567 OS << "]]";
8568 break;
8569 }
8570 case 2 : {
8571 OS << "[[clang::cpu_dispatch";
8572 OS << "";
8573 for (const auto &Val : cpus()) {
8574 DelimitAttributeArgument(OS, IsFirstArgument);
8575 OS << Val;
8576 }
8577 OS << "";
8578 if (!IsFirstArgument)
8579 OS << ")";
8580 OS << "]]";
8581 break;
8582 }
8583 case 3 : {
8584 OS << "__declspec(cpu_dispatch";
8585 OS << "";
8586 for (const auto &Val : cpus()) {
8587 DelimitAttributeArgument(OS, IsFirstArgument);
8588 OS << Val;
8589 }
8590 OS << "";
8591 if (!IsFirstArgument)
8592 OS << ")";
8593 OS << ")";
8594 break;
8595 }
8596 }
8597 }
8598
8599 const char *CPUDispatchAttr::getSpelling() const {
8600 switch (getAttributeSpellingListIndex()) {
8601 default:
8602 llvm_unreachable("Unknown attribute spelling!");
8603 return "(No spelling)";
8604 case 0:
8605 return "cpu_dispatch";
8606 case 1:
8607 return "cpu_dispatch";
8608 case 2:
8609 return "cpu_dispatch";
8610 case 3:
8611 return "cpu_dispatch";
8612 }
8613 }
8614
8615
8616 // CPUSpecificAttr implementation
8617
8618 CPUSpecificAttr *CPUSpecificAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) {
8619 auto *A = new (Ctx) CPUSpecificAttr(Ctx, CommonInfo, Cpus, CpusSize);
8620 A->setImplicit(true);
8621 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8622 A->setAttributeSpellingListIndex(0);
8623 return A;
8624 }
8625
8626 CPUSpecificAttr *CPUSpecificAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) {
8627 auto *A = new (Ctx) CPUSpecificAttr(Ctx, CommonInfo, Cpus, CpusSize);
8628 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8629 A->setAttributeSpellingListIndex(0);
8630 return A;
8631 }
8632
8633 CPUSpecificAttr *CPUSpecificAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, Spelling S) {
8634 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8635 switch (S) {
8636 case GNU_cpu_specific:
8637 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8638 case CXX11_clang_cpu_specific:
8639 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8640 case C23_clang_cpu_specific:
8641 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8642 case Declspec_cpu_specific:
8643 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8644 default:
8645 llvm_unreachable("Unknown attribute spelling!");
8646 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8647 }
8648 }());
8649 return CreateImplicit(Ctx, Cpus, CpusSize, I);
8650 }
8651
8652 CPUSpecificAttr *CPUSpecificAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, Spelling S) {
8653 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8654 switch (S) {
8655 case GNU_cpu_specific:
8656 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8657 case CXX11_clang_cpu_specific:
8658 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8659 case C23_clang_cpu_specific:
8660 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8661 case Declspec_cpu_specific:
8662 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8663 default:
8664 llvm_unreachable("Unknown attribute spelling!");
8665 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8666 }
8667 }());
8668 return Create(Ctx, Cpus, CpusSize, I);
8669 }
8670
8671 CPUSpecificAttr::CPUSpecificAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8672 , IdentifierInfo * *Cpus, unsigned CpusSize
8673 )
8674 : InheritableAttr(Ctx, CommonInfo, attr::CPUSpecific, /*IsLateParsed=*/false, false)
8675 , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size])
8676 {
8677 std::copy(Cpus, Cpus + cpus_Size, cpus_);
8678 }
8679
8680 CPUSpecificAttr::CPUSpecificAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8681 )
8682 : InheritableAttr(Ctx, CommonInfo, attr::CPUSpecific, /*IsLateParsed=*/false, false)
8683 , cpus_Size(0), cpus_(nullptr)
8684 {
8685 }
8686
8687
8688
8689 CPUSpecificAttr *CPUSpecificAttr::clone(ASTContext &C) const {
8690 auto *A = new (C) CPUSpecificAttr(C, *this, cpus_, cpus_Size);
8691 A->Inherited = Inherited;
8692 A->IsPackExpansion = IsPackExpansion;
8693 A->setImplicit(Implicit);
8694 return A;
8695 }
8696
8697 void CPUSpecificAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
8698 bool IsFirstArgument = true; (void)IsFirstArgument;
8699 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
8700 switch (getAttributeSpellingListIndex()) {
8701 default:
8702 llvm_unreachable("Unknown attribute spelling!");
8703 break;
8704 case 0 : {
8705 OS << "__attribute__((cpu_specific";
8706 OS << "";
8707 for (const auto &Val : cpus()) {
8708 DelimitAttributeArgument(OS, IsFirstArgument);
8709 OS << Val;
8710 }
8711 OS << "";
8712 if (!IsFirstArgument)
8713 OS << ")";
8714 OS << "))";
8715 break;
8716 }
8717 case 1 : {
8718 OS << "[[clang::cpu_specific";
8719 OS << "";
8720 for (const auto &Val : cpus()) {
8721 DelimitAttributeArgument(OS, IsFirstArgument);
8722 OS << Val;
8723 }
8724 OS << "";
8725 if (!IsFirstArgument)
8726 OS << ")";
8727 OS << "]]";
8728 break;
8729 }
8730 case 2 : {
8731 OS << "[[clang::cpu_specific";
8732 OS << "";
8733 for (const auto &Val : cpus()) {
8734 DelimitAttributeArgument(OS, IsFirstArgument);
8735 OS << Val;
8736 }
8737 OS << "";
8738 if (!IsFirstArgument)
8739 OS << ")";
8740 OS << "]]";
8741 break;
8742 }
8743 case 3 : {
8744 OS << "__declspec(cpu_specific";
8745 OS << "";
8746 for (const auto &Val : cpus()) {
8747 DelimitAttributeArgument(OS, IsFirstArgument);
8748 OS << Val;
8749 }
8750 OS << "";
8751 if (!IsFirstArgument)
8752 OS << ")";
8753 OS << ")";
8754 break;
8755 }
8756 }
8757 }
8758
8759 const char *CPUSpecificAttr::getSpelling() const {
8760 switch (getAttributeSpellingListIndex()) {
8761 default:
8762 llvm_unreachable("Unknown attribute spelling!");
8763 return "(No spelling)";
8764 case 0:
8765 return "cpu_specific";
8766 case 1:
8767 return "cpu_specific";
8768 case 2:
8769 return "cpu_specific";
8770 case 3:
8771 return "cpu_specific";
8772 }
8773 }
8774
8775
8776 // CUDAConstantAttr implementation
8777
8778 CUDAConstantAttr *CUDAConstantAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8779 auto *A = new (Ctx) CUDAConstantAttr(Ctx, CommonInfo);
8780 A->setImplicit(true);
8781 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8782 A->setAttributeSpellingListIndex(0);
8783 return A;
8784 }
8785
8786 CUDAConstantAttr *CUDAConstantAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8787 auto *A = new (Ctx) CUDAConstantAttr(Ctx, CommonInfo);
8788 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8789 A->setAttributeSpellingListIndex(0);
8790 return A;
8791 }
8792
8793 CUDAConstantAttr *CUDAConstantAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
8794 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8795 switch (S) {
8796 case GNU_constant:
8797 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8798 case Declspec_constant:
8799 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8800 default:
8801 llvm_unreachable("Unknown attribute spelling!");
8802 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8803 }
8804 }());
8805 return CreateImplicit(Ctx, I);
8806 }
8807
8808 CUDAConstantAttr *CUDAConstantAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
8809 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8810 switch (S) {
8811 case GNU_constant:
8812 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8813 case Declspec_constant:
8814 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8815 default:
8816 llvm_unreachable("Unknown attribute spelling!");
8817 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8818 }
8819 }());
8820 return Create(Ctx, I);
8821 }
8822
8823 CUDAConstantAttr::CUDAConstantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8824 )
8825 : InheritableAttr(Ctx, CommonInfo, attr::CUDAConstant, /*IsLateParsed=*/false, false)
8826 {
8827 }
8828
8829 CUDAConstantAttr *CUDAConstantAttr::clone(ASTContext &C) const {
8830 auto *A = new (C) CUDAConstantAttr(C, *this);
8831 A->Inherited = Inherited;
8832 A->IsPackExpansion = IsPackExpansion;
8833 A->setImplicit(Implicit);
8834 return A;
8835 }
8836
8837 void CUDAConstantAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
8838 bool IsFirstArgument = true; (void)IsFirstArgument;
8839 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
8840 switch (getAttributeSpellingListIndex()) {
8841 default:
8842 llvm_unreachable("Unknown attribute spelling!");
8843 break;
8844 case 0 : {
8845 OS << "__attribute__((constant";
8846 OS << "))";
8847 break;
8848 }
8849 case 1 : {
8850 OS << "__declspec(__constant__";
8851 OS << ")";
8852 break;
8853 }
8854 }
8855 }
8856
8857 const char *CUDAConstantAttr::getSpelling() const {
8858 switch (getAttributeSpellingListIndex()) {
8859 default:
8860 llvm_unreachable("Unknown attribute spelling!");
8861 return "(No spelling)";
8862 case 0:
8863 return "constant";
8864 case 1:
8865 return "__constant__";
8866 }
8867 }
8868
8869
8870 // CUDADeviceAttr implementation
8871
8872 CUDADeviceAttr *CUDADeviceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8873 auto *A = new (Ctx) CUDADeviceAttr(Ctx, CommonInfo);
8874 A->setImplicit(true);
8875 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8876 A->setAttributeSpellingListIndex(0);
8877 return A;
8878 }
8879
8880 CUDADeviceAttr *CUDADeviceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8881 auto *A = new (Ctx) CUDADeviceAttr(Ctx, CommonInfo);
8882 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8883 A->setAttributeSpellingListIndex(0);
8884 return A;
8885 }
8886
8887 CUDADeviceAttr *CUDADeviceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
8888 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8889 switch (S) {
8890 case GNU_device:
8891 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8892 case Declspec_device:
8893 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8894 default:
8895 llvm_unreachable("Unknown attribute spelling!");
8896 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8897 }
8898 }());
8899 return CreateImplicit(Ctx, I);
8900 }
8901
8902 CUDADeviceAttr *CUDADeviceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
8903 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8904 switch (S) {
8905 case GNU_device:
8906 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8907 case Declspec_device:
8908 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8909 default:
8910 llvm_unreachable("Unknown attribute spelling!");
8911 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8912 }
8913 }());
8914 return Create(Ctx, I);
8915 }
8916
8917 CUDADeviceAttr::CUDADeviceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
8918 )
8919 : InheritableAttr(Ctx, CommonInfo, attr::CUDADevice, /*IsLateParsed=*/false, false)
8920 {
8921 }
8922
8923 CUDADeviceAttr *CUDADeviceAttr::clone(ASTContext &C) const {
8924 auto *A = new (C) CUDADeviceAttr(C, *this);
8925 A->Inherited = Inherited;
8926 A->IsPackExpansion = IsPackExpansion;
8927 A->setImplicit(Implicit);
8928 return A;
8929 }
8930
8931 void CUDADeviceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
8932 bool IsFirstArgument = true; (void)IsFirstArgument;
8933 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
8934 switch (getAttributeSpellingListIndex()) {
8935 default:
8936 llvm_unreachable("Unknown attribute spelling!");
8937 break;
8938 case 0 : {
8939 OS << "__attribute__((device";
8940 OS << "))";
8941 break;
8942 }
8943 case 1 : {
8944 OS << "__declspec(__device__";
8945 OS << ")";
8946 break;
8947 }
8948 }
8949 }
8950
8951 const char *CUDADeviceAttr::getSpelling() const {
8952 switch (getAttributeSpellingListIndex()) {
8953 default:
8954 llvm_unreachable("Unknown attribute spelling!");
8955 return "(No spelling)";
8956 case 0:
8957 return "device";
8958 case 1:
8959 return "__device__";
8960 }
8961 }
8962
8963
8964 // CUDADeviceBuiltinSurfaceTypeAttr implementation
8965
8966 CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8967 auto *A = new (Ctx) CUDADeviceBuiltinSurfaceTypeAttr(Ctx, CommonInfo);
8968 A->setImplicit(true);
8969 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8970 A->setAttributeSpellingListIndex(0);
8971 return A;
8972 }
8973
8974 CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
8975 auto *A = new (Ctx) CUDADeviceBuiltinSurfaceTypeAttr(Ctx, CommonInfo);
8976 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
8977 A->setAttributeSpellingListIndex(0);
8978 return A;
8979 }
8980
8981 CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
8982 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8983 switch (S) {
8984 case GNU_device_builtin_surface_type:
8985 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device_builtin_surface_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8986 case Declspec_device_builtin_surface_type:
8987 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device_builtin_surface_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8988 default:
8989 llvm_unreachable("Unknown attribute spelling!");
8990 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
8991 }
8992 }());
8993 return CreateImplicit(Ctx, I);
8994 }
8995
8996 CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
8997 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
8998 switch (S) {
8999 case GNU_device_builtin_surface_type:
9000 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device_builtin_surface_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9001 case Declspec_device_builtin_surface_type:
9002 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device_builtin_surface_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9003 default:
9004 llvm_unreachable("Unknown attribute spelling!");
9005 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9006 }
9007 }());
9008 return Create(Ctx, I);
9009 }
9010
9011 CUDADeviceBuiltinSurfaceTypeAttr::CUDADeviceBuiltinSurfaceTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9012 )
9013 : InheritableAttr(Ctx, CommonInfo, attr::CUDADeviceBuiltinSurfaceType, /*IsLateParsed=*/false, false)
9014 {
9015 }
9016
9017 CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::clone(ASTContext &C) const {
9018 auto *A = new (C) CUDADeviceBuiltinSurfaceTypeAttr(C, *this);
9019 A->Inherited = Inherited;
9020 A->IsPackExpansion = IsPackExpansion;
9021 A->setImplicit(Implicit);
9022 return A;
9023 }
9024
9025 void CUDADeviceBuiltinSurfaceTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9026 bool IsFirstArgument = true; (void)IsFirstArgument;
9027 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
9028 switch (getAttributeSpellingListIndex()) {
9029 default:
9030 llvm_unreachable("Unknown attribute spelling!");
9031 break;
9032 case 0 : {
9033 OS << "__attribute__((device_builtin_surface_type";
9034 OS << "))";
9035 break;
9036 }
9037 case 1 : {
9038 OS << "__declspec(__device_builtin_surface_type__";
9039 OS << ")";
9040 break;
9041 }
9042 }
9043 }
9044
9045 const char *CUDADeviceBuiltinSurfaceTypeAttr::getSpelling() const {
9046 switch (getAttributeSpellingListIndex()) {
9047 default:
9048 llvm_unreachable("Unknown attribute spelling!");
9049 return "(No spelling)";
9050 case 0:
9051 return "device_builtin_surface_type";
9052 case 1:
9053 return "__device_builtin_surface_type__";
9054 }
9055 }
9056
9057
9058 // CUDADeviceBuiltinTextureTypeAttr implementation
9059
9060 CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9061 auto *A = new (Ctx) CUDADeviceBuiltinTextureTypeAttr(Ctx, CommonInfo);
9062 A->setImplicit(true);
9063 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9064 A->setAttributeSpellingListIndex(0);
9065 return A;
9066 }
9067
9068 CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9069 auto *A = new (Ctx) CUDADeviceBuiltinTextureTypeAttr(Ctx, CommonInfo);
9070 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9071 A->setAttributeSpellingListIndex(0);
9072 return A;
9073 }
9074
9075 CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
9076 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9077 switch (S) {
9078 case GNU_device_builtin_texture_type:
9079 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device_builtin_texture_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9080 case Declspec_device_builtin_texture_type:
9081 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device_builtin_texture_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9082 default:
9083 llvm_unreachable("Unknown attribute spelling!");
9084 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9085 }
9086 }());
9087 return CreateImplicit(Ctx, I);
9088 }
9089
9090 CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
9091 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9092 switch (S) {
9093 case GNU_device_builtin_texture_type:
9094 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device_builtin_texture_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9095 case Declspec_device_builtin_texture_type:
9096 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device_builtin_texture_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9097 default:
9098 llvm_unreachable("Unknown attribute spelling!");
9099 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9100 }
9101 }());
9102 return Create(Ctx, I);
9103 }
9104
9105 CUDADeviceBuiltinTextureTypeAttr::CUDADeviceBuiltinTextureTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9106 )
9107 : InheritableAttr(Ctx, CommonInfo, attr::CUDADeviceBuiltinTextureType, /*IsLateParsed=*/false, false)
9108 {
9109 }
9110
9111 CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::clone(ASTContext &C) const {
9112 auto *A = new (C) CUDADeviceBuiltinTextureTypeAttr(C, *this);
9113 A->Inherited = Inherited;
9114 A->IsPackExpansion = IsPackExpansion;
9115 A->setImplicit(Implicit);
9116 return A;
9117 }
9118
9119 void CUDADeviceBuiltinTextureTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9120 bool IsFirstArgument = true; (void)IsFirstArgument;
9121 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
9122 switch (getAttributeSpellingListIndex()) {
9123 default:
9124 llvm_unreachable("Unknown attribute spelling!");
9125 break;
9126 case 0 : {
9127 OS << "__attribute__((device_builtin_texture_type";
9128 OS << "))";
9129 break;
9130 }
9131 case 1 : {
9132 OS << "__declspec(__device_builtin_texture_type__";
9133 OS << ")";
9134 break;
9135 }
9136 }
9137 }
9138
9139 const char *CUDADeviceBuiltinTextureTypeAttr::getSpelling() const {
9140 switch (getAttributeSpellingListIndex()) {
9141 default:
9142 llvm_unreachable("Unknown attribute spelling!");
9143 return "(No spelling)";
9144 case 0:
9145 return "device_builtin_texture_type";
9146 case 1:
9147 return "__device_builtin_texture_type__";
9148 }
9149 }
9150
9151
9152 // CUDAGlobalAttr implementation
9153
9154 CUDAGlobalAttr *CUDAGlobalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9155 auto *A = new (Ctx) CUDAGlobalAttr(Ctx, CommonInfo);
9156 A->setImplicit(true);
9157 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9158 A->setAttributeSpellingListIndex(0);
9159 return A;
9160 }
9161
9162 CUDAGlobalAttr *CUDAGlobalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9163 auto *A = new (Ctx) CUDAGlobalAttr(Ctx, CommonInfo);
9164 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9165 A->setAttributeSpellingListIndex(0);
9166 return A;
9167 }
9168
9169 CUDAGlobalAttr *CUDAGlobalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
9170 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9171 switch (S) {
9172 case GNU_global:
9173 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9174 case Declspec_global:
9175 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9176 default:
9177 llvm_unreachable("Unknown attribute spelling!");
9178 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9179 }
9180 }());
9181 return CreateImplicit(Ctx, I);
9182 }
9183
9184 CUDAGlobalAttr *CUDAGlobalAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
9185 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9186 switch (S) {
9187 case GNU_global:
9188 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9189 case Declspec_global:
9190 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9191 default:
9192 llvm_unreachable("Unknown attribute spelling!");
9193 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9194 }
9195 }());
9196 return Create(Ctx, I);
9197 }
9198
9199 CUDAGlobalAttr::CUDAGlobalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9200 )
9201 : InheritableAttr(Ctx, CommonInfo, attr::CUDAGlobal, /*IsLateParsed=*/false, false)
9202 {
9203 }
9204
9205 CUDAGlobalAttr *CUDAGlobalAttr::clone(ASTContext &C) const {
9206 auto *A = new (C) CUDAGlobalAttr(C, *this);
9207 A->Inherited = Inherited;
9208 A->IsPackExpansion = IsPackExpansion;
9209 A->setImplicit(Implicit);
9210 return A;
9211 }
9212
9213 void CUDAGlobalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9214 bool IsFirstArgument = true; (void)IsFirstArgument;
9215 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
9216 switch (getAttributeSpellingListIndex()) {
9217 default:
9218 llvm_unreachable("Unknown attribute spelling!");
9219 break;
9220 case 0 : {
9221 OS << "__attribute__((global";
9222 OS << "))";
9223 break;
9224 }
9225 case 1 : {
9226 OS << "__declspec(__global__";
9227 OS << ")";
9228 break;
9229 }
9230 }
9231 }
9232
9233 const char *CUDAGlobalAttr::getSpelling() const {
9234 switch (getAttributeSpellingListIndex()) {
9235 default:
9236 llvm_unreachable("Unknown attribute spelling!");
9237 return "(No spelling)";
9238 case 0:
9239 return "global";
9240 case 1:
9241 return "__global__";
9242 }
9243 }
9244
9245
9246 // CUDAGridConstantAttr implementation
9247
9248 CUDAGridConstantAttr *CUDAGridConstantAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9249 auto *A = new (Ctx) CUDAGridConstantAttr(Ctx, CommonInfo);
9250 A->setImplicit(true);
9251 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9252 A->setAttributeSpellingListIndex(0);
9253 return A;
9254 }
9255
9256 CUDAGridConstantAttr *CUDAGridConstantAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9257 auto *A = new (Ctx) CUDAGridConstantAttr(Ctx, CommonInfo);
9258 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9259 A->setAttributeSpellingListIndex(0);
9260 return A;
9261 }
9262
9263 CUDAGridConstantAttr *CUDAGridConstantAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
9264 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9265 switch (S) {
9266 case GNU_grid_constant:
9267 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_grid_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9268 case Declspec_grid_constant:
9269 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_grid_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9270 default:
9271 llvm_unreachable("Unknown attribute spelling!");
9272 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9273 }
9274 }());
9275 return CreateImplicit(Ctx, I);
9276 }
9277
9278 CUDAGridConstantAttr *CUDAGridConstantAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
9279 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9280 switch (S) {
9281 case GNU_grid_constant:
9282 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_grid_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9283 case Declspec_grid_constant:
9284 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_grid_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9285 default:
9286 llvm_unreachable("Unknown attribute spelling!");
9287 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9288 }
9289 }());
9290 return Create(Ctx, I);
9291 }
9292
9293 CUDAGridConstantAttr::CUDAGridConstantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9294 )
9295 : InheritableAttr(Ctx, CommonInfo, attr::CUDAGridConstant, /*IsLateParsed=*/false, false)
9296 {
9297 }
9298
9299 CUDAGridConstantAttr *CUDAGridConstantAttr::clone(ASTContext &C) const {
9300 auto *A = new (C) CUDAGridConstantAttr(C, *this);
9301 A->Inherited = Inherited;
9302 A->IsPackExpansion = IsPackExpansion;
9303 A->setImplicit(Implicit);
9304 return A;
9305 }
9306
9307 void CUDAGridConstantAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9308 bool IsFirstArgument = true; (void)IsFirstArgument;
9309 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
9310 switch (getAttributeSpellingListIndex()) {
9311 default:
9312 llvm_unreachable("Unknown attribute spelling!");
9313 break;
9314 case 0 : {
9315 OS << "__attribute__((grid_constant";
9316 OS << "))";
9317 break;
9318 }
9319 case 1 : {
9320 OS << "__declspec(__grid_constant__";
9321 OS << ")";
9322 break;
9323 }
9324 }
9325 }
9326
9327 const char *CUDAGridConstantAttr::getSpelling() const {
9328 switch (getAttributeSpellingListIndex()) {
9329 default:
9330 llvm_unreachable("Unknown attribute spelling!");
9331 return "(No spelling)";
9332 case 0:
9333 return "grid_constant";
9334 case 1:
9335 return "__grid_constant__";
9336 }
9337 }
9338
9339
9340 // CUDAHostAttr implementation
9341
9342 CUDAHostAttr *CUDAHostAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9343 auto *A = new (Ctx) CUDAHostAttr(Ctx, CommonInfo);
9344 A->setImplicit(true);
9345 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9346 A->setAttributeSpellingListIndex(0);
9347 return A;
9348 }
9349
9350 CUDAHostAttr *CUDAHostAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9351 auto *A = new (Ctx) CUDAHostAttr(Ctx, CommonInfo);
9352 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9353 A->setAttributeSpellingListIndex(0);
9354 return A;
9355 }
9356
9357 CUDAHostAttr *CUDAHostAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
9358 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9359 switch (S) {
9360 case GNU_host:
9361 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9362 case Declspec_host:
9363 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9364 default:
9365 llvm_unreachable("Unknown attribute spelling!");
9366 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9367 }
9368 }());
9369 return CreateImplicit(Ctx, I);
9370 }
9371
9372 CUDAHostAttr *CUDAHostAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
9373 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9374 switch (S) {
9375 case GNU_host:
9376 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9377 case Declspec_host:
9378 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9379 default:
9380 llvm_unreachable("Unknown attribute spelling!");
9381 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9382 }
9383 }());
9384 return Create(Ctx, I);
9385 }
9386
9387 CUDAHostAttr::CUDAHostAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9388 )
9389 : InheritableAttr(Ctx, CommonInfo, attr::CUDAHost, /*IsLateParsed=*/false, false)
9390 {
9391 }
9392
9393 CUDAHostAttr *CUDAHostAttr::clone(ASTContext &C) const {
9394 auto *A = new (C) CUDAHostAttr(C, *this);
9395 A->Inherited = Inherited;
9396 A->IsPackExpansion = IsPackExpansion;
9397 A->setImplicit(Implicit);
9398 return A;
9399 }
9400
9401 void CUDAHostAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9402 bool IsFirstArgument = true; (void)IsFirstArgument;
9403 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
9404 switch (getAttributeSpellingListIndex()) {
9405 default:
9406 llvm_unreachable("Unknown attribute spelling!");
9407 break;
9408 case 0 : {
9409 OS << "__attribute__((host";
9410 OS << "))";
9411 break;
9412 }
9413 case 1 : {
9414 OS << "__declspec(__host__";
9415 OS << ")";
9416 break;
9417 }
9418 }
9419 }
9420
9421 const char *CUDAHostAttr::getSpelling() const {
9422 switch (getAttributeSpellingListIndex()) {
9423 default:
9424 llvm_unreachable("Unknown attribute spelling!");
9425 return "(No spelling)";
9426 case 0:
9427 return "host";
9428 case 1:
9429 return "__host__";
9430 }
9431 }
9432
9433
9434 // CUDAInvalidTargetAttr implementation
9435
9436 CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9437 auto *A = new (Ctx) CUDAInvalidTargetAttr(Ctx, CommonInfo);
9438 A->setImplicit(true);
9439 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9440 A->setAttributeSpellingListIndex(0);
9441 return A;
9442 }
9443
9444 CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9445 auto *A = new (Ctx) CUDAInvalidTargetAttr(Ctx, CommonInfo);
9446 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9447 A->setAttributeSpellingListIndex(0);
9448 return A;
9449 }
9450
9451 CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
9452 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
9453 return CreateImplicit(Ctx, I);
9454 }
9455
9456 CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::Create(ASTContext &Ctx, SourceRange Range) {
9457 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
9458 return Create(Ctx, I);
9459 }
9460
9461 CUDAInvalidTargetAttr::CUDAInvalidTargetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9462 )
9463 : InheritableAttr(Ctx, CommonInfo, attr::CUDAInvalidTarget, /*IsLateParsed=*/false, false)
9464 {
9465 }
9466
9467 CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::clone(ASTContext &C) const {
9468 auto *A = new (C) CUDAInvalidTargetAttr(C, *this);
9469 A->Inherited = Inherited;
9470 A->IsPackExpansion = IsPackExpansion;
9471 A->setImplicit(Implicit);
9472 return A;
9473 }
9474
9475 void CUDAInvalidTargetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9476 }
9477
9478 const char *CUDAInvalidTargetAttr::getSpelling() const {
9479 return "(No spelling)";
9480 }
9481
9482
9483 // CUDALaunchBoundsAttr implementation
9484
9485 CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, Expr * MaxBlocks, const AttributeCommonInfo &CommonInfo) {
9486 auto *A = new (Ctx) CUDALaunchBoundsAttr(Ctx, CommonInfo, MaxThreads, MinBlocks, MaxBlocks);
9487 A->setImplicit(true);
9488 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9489 A->setAttributeSpellingListIndex(0);
9490 return A;
9491 }
9492
9493 CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::Create(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, Expr * MaxBlocks, const AttributeCommonInfo &CommonInfo) {
9494 auto *A = new (Ctx) CUDALaunchBoundsAttr(Ctx, CommonInfo, MaxThreads, MinBlocks, MaxBlocks);
9495 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9496 A->setAttributeSpellingListIndex(0);
9497 return A;
9498 }
9499
9500 CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, Expr * MaxBlocks, SourceRange Range, Spelling S) {
9501 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9502 switch (S) {
9503 case GNU_launch_bounds:
9504 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_launch_bounds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9505 case Declspec_launch_bounds:
9506 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_launch_bounds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9507 default:
9508 llvm_unreachable("Unknown attribute spelling!");
9509 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9510 }
9511 }());
9512 return CreateImplicit(Ctx, MaxThreads, MinBlocks, MaxBlocks, I);
9513 }
9514
9515 CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::Create(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, Expr * MaxBlocks, SourceRange Range, Spelling S) {
9516 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9517 switch (S) {
9518 case GNU_launch_bounds:
9519 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_launch_bounds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9520 case Declspec_launch_bounds:
9521 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_launch_bounds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9522 default:
9523 llvm_unreachable("Unknown attribute spelling!");
9524 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9525 }
9526 }());
9527 return Create(Ctx, MaxThreads, MinBlocks, MaxBlocks, I);
9528 }
9529
9530 CUDALaunchBoundsAttr::CUDALaunchBoundsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9531 , Expr * MaxThreads
9532 , Expr * MinBlocks
9533 , Expr * MaxBlocks
9534 )
9535 : InheritableAttr(Ctx, CommonInfo, attr::CUDALaunchBounds, /*IsLateParsed=*/false, false)
9536 , maxThreads(MaxThreads)
9537 , minBlocks(MinBlocks)
9538 , maxBlocks(MaxBlocks)
9539 {
9540 }
9541
9542 CUDALaunchBoundsAttr::CUDALaunchBoundsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9543 , Expr * MaxThreads
9544 )
9545 : InheritableAttr(Ctx, CommonInfo, attr::CUDALaunchBounds, /*IsLateParsed=*/false, false)
9546 , maxThreads(MaxThreads)
9547 , minBlocks()
9548 , maxBlocks()
9549 {
9550 }
9551
9552
9553
9554
9555
9556
9557
9558 CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::clone(ASTContext &C) const {
9559 auto *A = new (C) CUDALaunchBoundsAttr(C, *this, maxThreads, minBlocks, maxBlocks);
9560 A->Inherited = Inherited;
9561 A->IsPackExpansion = IsPackExpansion;
9562 A->setImplicit(Implicit);
9563 return A;
9564 }
9565
9566 void CUDALaunchBoundsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9567 bool IsFirstArgument = true; (void)IsFirstArgument;
9568 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
9569 switch (getAttributeSpellingListIndex()) {
9570 default:
9571 llvm_unreachable("Unknown attribute spelling!");
9572 break;
9573 case 0 : {
9574 OS << "__attribute__((launch_bounds";
9575 if (!getMaxBlocks())
9576 ++TrailingOmittedArgs;
9577 if (!getMinBlocks())
9578 ++TrailingOmittedArgs;
9579 DelimitAttributeArgument(OS, IsFirstArgument);
9580 OS << "";
9581 getMaxThreads()->printPretty(OS, nullptr, Policy);
9582 OS << "";
9583 if (!(!getMinBlocks())) {
9584 DelimitAttributeArgument(OS, IsFirstArgument);
9585 OS << "";
9586 getMinBlocks()->printPretty(OS, nullptr, Policy);
9587 OS << "";
9588 }
9589 if (!(!getMaxBlocks())) {
9590 DelimitAttributeArgument(OS, IsFirstArgument);
9591 OS << "";
9592 getMaxBlocks()->printPretty(OS, nullptr, Policy);
9593 OS << "";
9594 }
9595 if (!IsFirstArgument)
9596 OS << ")";
9597 OS << "))";
9598 break;
9599 }
9600 case 1 : {
9601 OS << "__declspec(__launch_bounds__";
9602 if (!getMaxBlocks())
9603 ++TrailingOmittedArgs;
9604 if (!getMinBlocks())
9605 ++TrailingOmittedArgs;
9606 DelimitAttributeArgument(OS, IsFirstArgument);
9607 OS << "";
9608 getMaxThreads()->printPretty(OS, nullptr, Policy);
9609 OS << "";
9610 if (!(!getMinBlocks())) {
9611 DelimitAttributeArgument(OS, IsFirstArgument);
9612 OS << "";
9613 getMinBlocks()->printPretty(OS, nullptr, Policy);
9614 OS << "";
9615 }
9616 if (!(!getMaxBlocks())) {
9617 DelimitAttributeArgument(OS, IsFirstArgument);
9618 OS << "";
9619 getMaxBlocks()->printPretty(OS, nullptr, Policy);
9620 OS << "";
9621 }
9622 if (!IsFirstArgument)
9623 OS << ")";
9624 OS << ")";
9625 break;
9626 }
9627 }
9628 }
9629
9630 const char *CUDALaunchBoundsAttr::getSpelling() const {
9631 switch (getAttributeSpellingListIndex()) {
9632 default:
9633 llvm_unreachable("Unknown attribute spelling!");
9634 return "(No spelling)";
9635 case 0:
9636 return "launch_bounds";
9637 case 1:
9638 return "__launch_bounds__";
9639 }
9640 }
9641
9642
9643 // CUDASharedAttr implementation
9644
9645 CUDASharedAttr *CUDASharedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9646 auto *A = new (Ctx) CUDASharedAttr(Ctx, CommonInfo);
9647 A->setImplicit(true);
9648 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9649 A->setAttributeSpellingListIndex(0);
9650 return A;
9651 }
9652
9653 CUDASharedAttr *CUDASharedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9654 auto *A = new (Ctx) CUDASharedAttr(Ctx, CommonInfo);
9655 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9656 A->setAttributeSpellingListIndex(0);
9657 return A;
9658 }
9659
9660 CUDASharedAttr *CUDASharedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
9661 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9662 switch (S) {
9663 case GNU_shared:
9664 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9665 case Declspec_shared:
9666 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_shared, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9667 default:
9668 llvm_unreachable("Unknown attribute spelling!");
9669 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9670 }
9671 }());
9672 return CreateImplicit(Ctx, I);
9673 }
9674
9675 CUDASharedAttr *CUDASharedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
9676 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9677 switch (S) {
9678 case GNU_shared:
9679 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9680 case Declspec_shared:
9681 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_shared, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9682 default:
9683 llvm_unreachable("Unknown attribute spelling!");
9684 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9685 }
9686 }());
9687 return Create(Ctx, I);
9688 }
9689
9690 CUDASharedAttr::CUDASharedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9691 )
9692 : InheritableAttr(Ctx, CommonInfo, attr::CUDAShared, /*IsLateParsed=*/false, false)
9693 {
9694 }
9695
9696 CUDASharedAttr *CUDASharedAttr::clone(ASTContext &C) const {
9697 auto *A = new (C) CUDASharedAttr(C, *this);
9698 A->Inherited = Inherited;
9699 A->IsPackExpansion = IsPackExpansion;
9700 A->setImplicit(Implicit);
9701 return A;
9702 }
9703
9704 void CUDASharedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9705 bool IsFirstArgument = true; (void)IsFirstArgument;
9706 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
9707 switch (getAttributeSpellingListIndex()) {
9708 default:
9709 llvm_unreachable("Unknown attribute spelling!");
9710 break;
9711 case 0 : {
9712 OS << "__attribute__((shared";
9713 OS << "))";
9714 break;
9715 }
9716 case 1 : {
9717 OS << "__declspec(__shared__";
9718 OS << ")";
9719 break;
9720 }
9721 }
9722 }
9723
9724 const char *CUDASharedAttr::getSpelling() const {
9725 switch (getAttributeSpellingListIndex()) {
9726 default:
9727 llvm_unreachable("Unknown attribute spelling!");
9728 return "(No spelling)";
9729 case 0:
9730 return "shared";
9731 case 1:
9732 return "__shared__";
9733 }
9734 }
9735
9736
9737 // CXX11NoReturnAttr implementation
9738
9739 CXX11NoReturnAttr *CXX11NoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9740 auto *A = new (Ctx) CXX11NoReturnAttr(Ctx, CommonInfo);
9741 A->setImplicit(true);
9742 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9743 A->setAttributeSpellingListIndex(0);
9744 return A;
9745 }
9746
9747 CXX11NoReturnAttr *CXX11NoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
9748 auto *A = new (Ctx) CXX11NoReturnAttr(Ctx, CommonInfo);
9749 return A;
9750 }
9751
9752 CXX11NoReturnAttr *CXX11NoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
9753 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9754 switch (S) {
9755 case CXX11_noreturn:
9756 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9757 case C23_noreturn:
9758 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9759 case C23_Noreturn:
9760 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_Noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9761 default:
9762 llvm_unreachable("Unknown attribute spelling!");
9763 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9764 }
9765 }());
9766 return CreateImplicit(Ctx, I);
9767 }
9768
9769 CXX11NoReturnAttr *CXX11NoReturnAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
9770 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9771 switch (S) {
9772 case CXX11_noreturn:
9773 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9774 case C23_noreturn:
9775 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9776 case C23_Noreturn:
9777 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_Noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9778 default:
9779 llvm_unreachable("Unknown attribute spelling!");
9780 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9781 }
9782 }());
9783 return Create(Ctx, I);
9784 }
9785
9786 CXX11NoReturnAttr::CXX11NoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9787 )
9788 : InheritableAttr(Ctx, CommonInfo, attr::CXX11NoReturn, /*IsLateParsed=*/false, false)
9789 {
9790 }
9791
9792 CXX11NoReturnAttr::Spelling CXX11NoReturnAttr::getSemanticSpelling() const {
9793 switch (getAttributeSpellingListIndex()) {
9794 default: llvm_unreachable("Unknown spelling list index");
9795 case 0: return CXX11_noreturn;
9796 case 1: return C23_noreturn;
9797 case 2: return C23_Noreturn;
9798 }
9799 }
9800 CXX11NoReturnAttr *CXX11NoReturnAttr::clone(ASTContext &C) const {
9801 auto *A = new (C) CXX11NoReturnAttr(C, *this);
9802 A->Inherited = Inherited;
9803 A->IsPackExpansion = IsPackExpansion;
9804 A->setImplicit(Implicit);
9805 return A;
9806 }
9807
9808 void CXX11NoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9809 bool IsFirstArgument = true; (void)IsFirstArgument;
9810 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
9811 switch (getAttributeSpellingListIndex()) {
9812 default:
9813 llvm_unreachable("Unknown attribute spelling!");
9814 break;
9815 case 0 : {
9816 OS << "[[noreturn";
9817 OS << "]]";
9818 break;
9819 }
9820 case 1 : {
9821 OS << "[[noreturn";
9822 OS << "]]";
9823 break;
9824 }
9825 case 2 : {
9826 OS << "[[_Noreturn";
9827 OS << "]]";
9828 break;
9829 }
9830 }
9831 }
9832
9833 const char *CXX11NoReturnAttr::getSpelling() const {
9834 switch (getAttributeSpellingListIndex()) {
9835 default:
9836 llvm_unreachable("Unknown attribute spelling!");
9837 return "(No spelling)";
9838 case 0:
9839 return "noreturn";
9840 case 1:
9841 return "noreturn";
9842 case 2:
9843 return "_Noreturn";
9844 }
9845 }
9846
9847
9848 // CXXAssumeAttr implementation
9849
9850 CXXAssumeAttr *CXXAssumeAttr::CreateImplicit(ASTContext &Ctx, Expr * Assumption, const AttributeCommonInfo &CommonInfo) {
9851 auto *A = new (Ctx) CXXAssumeAttr(Ctx, CommonInfo, Assumption);
9852 A->setImplicit(true);
9853 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9854 A->setAttributeSpellingListIndex(0);
9855 return A;
9856 }
9857
9858 CXXAssumeAttr *CXXAssumeAttr::Create(ASTContext &Ctx, Expr * Assumption, const AttributeCommonInfo &CommonInfo) {
9859 auto *A = new (Ctx) CXXAssumeAttr(Ctx, CommonInfo, Assumption);
9860 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9861 A->setAttributeSpellingListIndex(0);
9862 return A;
9863 }
9864
9865 CXXAssumeAttr *CXXAssumeAttr::CreateImplicit(ASTContext &Ctx, Expr * Assumption, SourceRange Range, Spelling S) {
9866 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9867 switch (S) {
9868 case CXX11_assume:
9869 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9870 case GNU_assume:
9871 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9872 case CXX11_clang_assume:
9873 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9874 case C23_clang_assume:
9875 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9876 default:
9877 llvm_unreachable("Unknown attribute spelling!");
9878 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9879 }
9880 }());
9881 return CreateImplicit(Ctx, Assumption, I);
9882 }
9883
9884 CXXAssumeAttr *CXXAssumeAttr::Create(ASTContext &Ctx, Expr * Assumption, SourceRange Range, Spelling S) {
9885 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
9886 switch (S) {
9887 case CXX11_assume:
9888 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9889 case GNU_assume:
9890 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9891 case CXX11_clang_assume:
9892 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9893 case C23_clang_assume:
9894 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9895 default:
9896 llvm_unreachable("Unknown attribute spelling!");
9897 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
9898 }
9899 }());
9900 return Create(Ctx, Assumption, I);
9901 }
9902
9903 CXXAssumeAttr::CXXAssumeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
9904 , Expr * Assumption
9905 )
9906 : StmtAttr(Ctx, CommonInfo, attr::CXXAssume, /*IsLateParsed=*/false)
9907 , assumption(Assumption)
9908 {
9909 }
9910
9911
9912
9913 CXXAssumeAttr *CXXAssumeAttr::clone(ASTContext &C) const {
9914 auto *A = new (C) CXXAssumeAttr(C, *this, assumption);
9915 A->Inherited = Inherited;
9916 A->IsPackExpansion = IsPackExpansion;
9917 A->setImplicit(Implicit);
9918 return A;
9919 }
9920
9921 void CXXAssumeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
9922 bool IsFirstArgument = true; (void)IsFirstArgument;
9923 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
9924 switch (getAttributeSpellingListIndex()) {
9925 default:
9926 llvm_unreachable("Unknown attribute spelling!");
9927 break;
9928 case 0 : {
9929 OS << "[[assume";
9930 DelimitAttributeArgument(OS, IsFirstArgument);
9931 OS << "";
9932 getAssumption()->printPretty(OS, nullptr, Policy);
9933 OS << "";
9934 if (!IsFirstArgument)
9935 OS << ")";
9936 OS << "]]";
9937 break;
9938 }
9939 case 1 : {
9940 OS << "__attribute__((assume";
9941 DelimitAttributeArgument(OS, IsFirstArgument);
9942 OS << "";
9943 getAssumption()->printPretty(OS, nullptr, Policy);
9944 OS << "";
9945 if (!IsFirstArgument)
9946 OS << ")";
9947 OS << "))";
9948 break;
9949 }
9950 case 2 : {
9951 OS << "[[clang::assume";
9952 DelimitAttributeArgument(OS, IsFirstArgument);
9953 OS << "";
9954 getAssumption()->printPretty(OS, nullptr, Policy);
9955 OS << "";
9956 if (!IsFirstArgument)
9957 OS << ")";
9958 OS << "]]";
9959 break;
9960 }
9961 case 3 : {
9962 OS << "[[clang::assume";
9963 DelimitAttributeArgument(OS, IsFirstArgument);
9964 OS << "";
9965 getAssumption()->printPretty(OS, nullptr, Policy);
9966 OS << "";
9967 if (!IsFirstArgument)
9968 OS << ")";
9969 OS << "]]";
9970 break;
9971 }
9972 }
9973 }
9974
9975 const char *CXXAssumeAttr::getSpelling() const {
9976 switch (getAttributeSpellingListIndex()) {
9977 default:
9978 llvm_unreachable("Unknown attribute spelling!");
9979 return "(No spelling)";
9980 case 0:
9981 return "assume";
9982 case 1:
9983 return "assume";
9984 case 2:
9985 return "assume";
9986 case 3:
9987 return "assume";
9988 }
9989 }
9990
9991
9992 // CallableWhenAttr implementation
9993
9994 CallableWhenAttr *CallableWhenAttr::CreateImplicit(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, const AttributeCommonInfo &CommonInfo) {
9995 auto *A = new (Ctx) CallableWhenAttr(Ctx, CommonInfo, CallableStates, CallableStatesSize);
9996 A->setImplicit(true);
9997 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
9998 A->setAttributeSpellingListIndex(0);
9999 return A;
10000 }
10001
10002 CallableWhenAttr *CallableWhenAttr::Create(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, const AttributeCommonInfo &CommonInfo) {
10003 auto *A = new (Ctx) CallableWhenAttr(Ctx, CommonInfo, CallableStates, CallableStatesSize);
10004 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10005 A->setAttributeSpellingListIndex(0);
10006 return A;
10007 }
10008
10009 CallableWhenAttr *CallableWhenAttr::CreateImplicit(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, SourceRange Range, Spelling S) {
10010 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10011 switch (S) {
10012 case GNU_callable_when:
10013 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_callable_when, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10014 case CXX11_clang_callable_when:
10015 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_callable_when, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10016 default:
10017 llvm_unreachable("Unknown attribute spelling!");
10018 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10019 }
10020 }());
10021 return CreateImplicit(Ctx, CallableStates, CallableStatesSize, I);
10022 }
10023
10024 CallableWhenAttr *CallableWhenAttr::Create(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, SourceRange Range, Spelling S) {
10025 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10026 switch (S) {
10027 case GNU_callable_when:
10028 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_callable_when, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10029 case CXX11_clang_callable_when:
10030 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_callable_when, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10031 default:
10032 llvm_unreachable("Unknown attribute spelling!");
10033 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10034 }
10035 }());
10036 return Create(Ctx, CallableStates, CallableStatesSize, I);
10037 }
10038
10039 CallableWhenAttr::CallableWhenAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10040 , ConsumedState *CallableStates, unsigned CallableStatesSize
10041 )
10042 : InheritableAttr(Ctx, CommonInfo, attr::CallableWhen, /*IsLateParsed=*/false, false)
10043 , callableStates_Size(CallableStatesSize), callableStates_(new (Ctx, 16) ConsumedState[callableStates_Size])
10044 {
10045 std::copy(CallableStates, CallableStates + callableStates_Size, callableStates_);
10046 }
10047
10048 CallableWhenAttr::CallableWhenAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10049 )
10050 : InheritableAttr(Ctx, CommonInfo, attr::CallableWhen, /*IsLateParsed=*/false, false)
10051 , callableStates_Size(0), callableStates_(nullptr)
10052 {
10053 }
10054
10055
10056
10057 bool CallableWhenAttr::ConvertStrToConsumedState(StringRef Val, CallableWhenAttr::ConsumedState &Out) {
10058 std::optional<CallableWhenAttr::ConsumedState> R = llvm::StringSwitch<std::optional<CallableWhenAttr::ConsumedState>>(Val)
10059 .Case("unknown", CallableWhenAttr::ConsumedState::Unknown)
10060 .Case("consumed", CallableWhenAttr::ConsumedState::Consumed)
10061 .Case("unconsumed", CallableWhenAttr::ConsumedState::Unconsumed)
10062 .Default(std::optional<CallableWhenAttr::ConsumedState>());
10063 if (R) {
10064 Out = *R;
10065 return true;
10066 }
10067 return false;
10068 }
10069
10070 const char *CallableWhenAttr::ConvertConsumedStateToStr(CallableWhenAttr::ConsumedState Val) {
10071 switch(Val) {
10072 case CallableWhenAttr::ConsumedState::Unknown: return "unknown";
10073 case CallableWhenAttr::ConsumedState::Consumed: return "consumed";
10074 case CallableWhenAttr::ConsumedState::Unconsumed: return "unconsumed";
10075 }
10076 llvm_unreachable("No enumerator with that value");
10077 }
10078 CallableWhenAttr *CallableWhenAttr::clone(ASTContext &C) const {
10079 auto *A = new (C) CallableWhenAttr(C, *this, callableStates_, callableStates_Size);
10080 A->Inherited = Inherited;
10081 A->IsPackExpansion = IsPackExpansion;
10082 A->setImplicit(Implicit);
10083 return A;
10084 }
10085
10086 void CallableWhenAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
10087 bool IsFirstArgument = true; (void)IsFirstArgument;
10088 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
10089 switch (getAttributeSpellingListIndex()) {
10090 default:
10091 llvm_unreachable("Unknown attribute spelling!");
10092 break;
10093 case 0 : {
10094 OS << "__attribute__((callable_when";
10095 OS << "";
10096 for (const auto &Val : callableStates()) {
10097 DelimitAttributeArgument(OS, IsFirstArgument);
10098 OS << "\"" << CallableWhenAttr::ConvertConsumedStateToStr(Val)<< "\"";
10099 }
10100 OS << "";
10101 if (!IsFirstArgument)
10102 OS << ")";
10103 OS << "))";
10104 break;
10105 }
10106 case 1 : {
10107 OS << "[[clang::callable_when";
10108 OS << "";
10109 for (const auto &Val : callableStates()) {
10110 DelimitAttributeArgument(OS, IsFirstArgument);
10111 OS << "\"" << CallableWhenAttr::ConvertConsumedStateToStr(Val)<< "\"";
10112 }
10113 OS << "";
10114 if (!IsFirstArgument)
10115 OS << ")";
10116 OS << "]]";
10117 break;
10118 }
10119 }
10120 }
10121
10122 const char *CallableWhenAttr::getSpelling() const {
10123 switch (getAttributeSpellingListIndex()) {
10124 default:
10125 llvm_unreachable("Unknown attribute spelling!");
10126 return "(No spelling)";
10127 case 0:
10128 return "callable_when";
10129 case 1:
10130 return "callable_when";
10131 }
10132 }
10133
10134
10135 // CallbackAttr implementation
10136
10137 CallbackAttr *CallbackAttr::CreateImplicit(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, const AttributeCommonInfo &CommonInfo) {
10138 auto *A = new (Ctx) CallbackAttr(Ctx, CommonInfo, Encoding, EncodingSize);
10139 A->setImplicit(true);
10140 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10141 A->setAttributeSpellingListIndex(0);
10142 return A;
10143 }
10144
10145 CallbackAttr *CallbackAttr::Create(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, const AttributeCommonInfo &CommonInfo) {
10146 auto *A = new (Ctx) CallbackAttr(Ctx, CommonInfo, Encoding, EncodingSize);
10147 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10148 A->setAttributeSpellingListIndex(0);
10149 return A;
10150 }
10151
10152 CallbackAttr *CallbackAttr::CreateImplicit(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, SourceRange Range, Spelling S) {
10153 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10154 switch (S) {
10155 case GNU_callback:
10156 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10157 case CXX11_clang_callback:
10158 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10159 case C23_clang_callback:
10160 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10161 default:
10162 llvm_unreachable("Unknown attribute spelling!");
10163 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10164 }
10165 }());
10166 return CreateImplicit(Ctx, Encoding, EncodingSize, I);
10167 }
10168
10169 CallbackAttr *CallbackAttr::Create(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, SourceRange Range, Spelling S) {
10170 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10171 switch (S) {
10172 case GNU_callback:
10173 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10174 case CXX11_clang_callback:
10175 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10176 case C23_clang_callback:
10177 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10178 default:
10179 llvm_unreachable("Unknown attribute spelling!");
10180 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10181 }
10182 }());
10183 return Create(Ctx, Encoding, EncodingSize, I);
10184 }
10185
10186 CallbackAttr::CallbackAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10187 , int *Encoding, unsigned EncodingSize
10188 )
10189 : InheritableAttr(Ctx, CommonInfo, attr::Callback, /*IsLateParsed=*/false, false)
10190 , encoding_Size(EncodingSize), encoding_(new (Ctx, 16) int[encoding_Size])
10191 {
10192 std::copy(Encoding, Encoding + encoding_Size, encoding_);
10193 }
10194
10195 CallbackAttr::CallbackAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10196 )
10197 : InheritableAttr(Ctx, CommonInfo, attr::Callback, /*IsLateParsed=*/false, false)
10198 , encoding_Size(0), encoding_(nullptr)
10199 {
10200 }
10201
10202
10203
10204 CallbackAttr *CallbackAttr::clone(ASTContext &C) const {
10205 auto *A = new (C) CallbackAttr(C, *this, encoding_, encoding_Size);
10206 A->Inherited = Inherited;
10207 A->IsPackExpansion = IsPackExpansion;
10208 A->setImplicit(Implicit);
10209 return A;
10210 }
10211
10212 void CallbackAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
10213 bool IsFirstArgument = true; (void)IsFirstArgument;
10214 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
10215 switch (getAttributeSpellingListIndex()) {
10216 default:
10217 llvm_unreachable("Unknown attribute spelling!");
10218 break;
10219 case 0 : {
10220 OS << "__attribute__((callback";
10221 OS << "";
10222 for (const auto &Val : encoding()) {
10223 DelimitAttributeArgument(OS, IsFirstArgument);
10224 OS << Val;
10225 }
10226 OS << "";
10227 if (!IsFirstArgument)
10228 OS << ")";
10229 OS << "))";
10230 break;
10231 }
10232 case 1 : {
10233 OS << "[[clang::callback";
10234 OS << "";
10235 for (const auto &Val : encoding()) {
10236 DelimitAttributeArgument(OS, IsFirstArgument);
10237 OS << Val;
10238 }
10239 OS << "";
10240 if (!IsFirstArgument)
10241 OS << ")";
10242 OS << "]]";
10243 break;
10244 }
10245 case 2 : {
10246 OS << "[[clang::callback";
10247 OS << "";
10248 for (const auto &Val : encoding()) {
10249 DelimitAttributeArgument(OS, IsFirstArgument);
10250 OS << Val;
10251 }
10252 OS << "";
10253 if (!IsFirstArgument)
10254 OS << ")";
10255 OS << "]]";
10256 break;
10257 }
10258 }
10259 }
10260
10261 const char *CallbackAttr::getSpelling() const {
10262 switch (getAttributeSpellingListIndex()) {
10263 default:
10264 llvm_unreachable("Unknown attribute spelling!");
10265 return "(No spelling)";
10266 case 0:
10267 return "callback";
10268 case 1:
10269 return "callback";
10270 case 2:
10271 return "callback";
10272 }
10273 }
10274
10275
10276 // CalledOnceAttr implementation
10277
10278 CalledOnceAttr *CalledOnceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10279 auto *A = new (Ctx) CalledOnceAttr(Ctx, CommonInfo);
10280 A->setImplicit(true);
10281 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10282 A->setAttributeSpellingListIndex(0);
10283 return A;
10284 }
10285
10286 CalledOnceAttr *CalledOnceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10287 auto *A = new (Ctx) CalledOnceAttr(Ctx, CommonInfo);
10288 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10289 A->setAttributeSpellingListIndex(0);
10290 return A;
10291 }
10292
10293 CalledOnceAttr *CalledOnceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
10294 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10295 switch (S) {
10296 case GNU_called_once:
10297 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10298 case CXX11_clang_called_once:
10299 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10300 case C23_clang_called_once:
10301 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10302 default:
10303 llvm_unreachable("Unknown attribute spelling!");
10304 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10305 }
10306 }());
10307 return CreateImplicit(Ctx, I);
10308 }
10309
10310 CalledOnceAttr *CalledOnceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
10311 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10312 switch (S) {
10313 case GNU_called_once:
10314 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10315 case CXX11_clang_called_once:
10316 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10317 case C23_clang_called_once:
10318 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10319 default:
10320 llvm_unreachable("Unknown attribute spelling!");
10321 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10322 }
10323 }());
10324 return Create(Ctx, I);
10325 }
10326
10327 CalledOnceAttr::CalledOnceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10328 )
10329 : Attr(Ctx, CommonInfo, attr::CalledOnce, /*IsLateParsed=*/false)
10330 {
10331 }
10332
10333 CalledOnceAttr *CalledOnceAttr::clone(ASTContext &C) const {
10334 auto *A = new (C) CalledOnceAttr(C, *this);
10335 A->Inherited = Inherited;
10336 A->IsPackExpansion = IsPackExpansion;
10337 A->setImplicit(Implicit);
10338 return A;
10339 }
10340
10341 void CalledOnceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
10342 bool IsFirstArgument = true; (void)IsFirstArgument;
10343 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
10344 switch (getAttributeSpellingListIndex()) {
10345 default:
10346 llvm_unreachable("Unknown attribute spelling!");
10347 break;
10348 case 0 : {
10349 OS << "__attribute__((called_once";
10350 OS << "))";
10351 break;
10352 }
10353 case 1 : {
10354 OS << "[[clang::called_once";
10355 OS << "]]";
10356 break;
10357 }
10358 case 2 : {
10359 OS << "[[clang::called_once";
10360 OS << "]]";
10361 break;
10362 }
10363 }
10364 }
10365
10366 const char *CalledOnceAttr::getSpelling() const {
10367 switch (getAttributeSpellingListIndex()) {
10368 default:
10369 llvm_unreachable("Unknown attribute spelling!");
10370 return "(No spelling)";
10371 case 0:
10372 return "called_once";
10373 case 1:
10374 return "called_once";
10375 case 2:
10376 return "called_once";
10377 }
10378 }
10379
10380
10381 // CapabilityAttr implementation
10382
10383 CapabilityAttr *CapabilityAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
10384 auto *A = new (Ctx) CapabilityAttr(Ctx, CommonInfo, Name);
10385 A->setImplicit(true);
10386 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10387 A->setAttributeSpellingListIndex(0);
10388 return A;
10389 }
10390
10391 CapabilityAttr *CapabilityAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
10392 auto *A = new (Ctx) CapabilityAttr(Ctx, CommonInfo, Name);
10393 return A;
10394 }
10395
10396 CapabilityAttr *CapabilityAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, Spelling S) {
10397 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10398 switch (S) {
10399 case GNU_capability:
10400 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10401 case CXX11_clang_capability:
10402 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10403 case GNU_shared_capability:
10404 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10405 case CXX11_clang_shared_capability:
10406 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10407 default:
10408 llvm_unreachable("Unknown attribute spelling!");
10409 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10410 }
10411 }());
10412 return CreateImplicit(Ctx, Name, I);
10413 }
10414
10415 CapabilityAttr *CapabilityAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, Spelling S) {
10416 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10417 switch (S) {
10418 case GNU_capability:
10419 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10420 case CXX11_clang_capability:
10421 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10422 case GNU_shared_capability:
10423 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10424 case CXX11_clang_shared_capability:
10425 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10426 default:
10427 llvm_unreachable("Unknown attribute spelling!");
10428 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10429 }
10430 }());
10431 return Create(Ctx, Name, I);
10432 }
10433
10434 CapabilityAttr::CapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10435 , llvm::StringRef Name
10436 )
10437 : InheritableAttr(Ctx, CommonInfo, attr::Capability, /*IsLateParsed=*/false, false)
10438 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
10439 {
10440 if (!Name.empty())
10441 std::memcpy(name, Name.data(), nameLength);
10442 }
10443
10444 CapabilityAttr::Spelling CapabilityAttr::getSemanticSpelling() const {
10445 switch (getAttributeSpellingListIndex()) {
10446 default: llvm_unreachable("Unknown spelling list index");
10447 case 0: return GNU_capability;
10448 case 1: return CXX11_clang_capability;
10449 case 2: return GNU_shared_capability;
10450 case 3: return CXX11_clang_shared_capability;
10451 }
10452 }
10453
10454
10455 CapabilityAttr *CapabilityAttr::clone(ASTContext &C) const {
10456 auto *A = new (C) CapabilityAttr(C, *this, getName());
10457 A->Inherited = Inherited;
10458 A->IsPackExpansion = IsPackExpansion;
10459 A->setImplicit(Implicit);
10460 return A;
10461 }
10462
10463 void CapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
10464 bool IsFirstArgument = true; (void)IsFirstArgument;
10465 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
10466 switch (getAttributeSpellingListIndex()) {
10467 default:
10468 llvm_unreachable("Unknown attribute spelling!");
10469 break;
10470 case 0 : {
10471 OS << "__attribute__((capability";
10472 DelimitAttributeArgument(OS, IsFirstArgument);
10473 OS << "\"" << getName() << "\"";
10474 if (!IsFirstArgument)
10475 OS << ")";
10476 OS << "))";
10477 break;
10478 }
10479 case 1 : {
10480 OS << "[[clang::capability";
10481 DelimitAttributeArgument(OS, IsFirstArgument);
10482 OS << "\"" << getName() << "\"";
10483 if (!IsFirstArgument)
10484 OS << ")";
10485 OS << "]]";
10486 break;
10487 }
10488 case 2 : {
10489 OS << "__attribute__((shared_capability";
10490 DelimitAttributeArgument(OS, IsFirstArgument);
10491 OS << "\"" << getName() << "\"";
10492 if (!IsFirstArgument)
10493 OS << ")";
10494 OS << "))";
10495 break;
10496 }
10497 case 3 : {
10498 OS << "[[clang::shared_capability";
10499 DelimitAttributeArgument(OS, IsFirstArgument);
10500 OS << "\"" << getName() << "\"";
10501 if (!IsFirstArgument)
10502 OS << ")";
10503 OS << "]]";
10504 break;
10505 }
10506 }
10507 }
10508
10509 const char *CapabilityAttr::getSpelling() const {
10510 switch (getAttributeSpellingListIndex()) {
10511 default:
10512 llvm_unreachable("Unknown attribute spelling!");
10513 return "(No spelling)";
10514 case 0:
10515 return "capability";
10516 case 1:
10517 return "capability";
10518 case 2:
10519 return "shared_capability";
10520 case 3:
10521 return "shared_capability";
10522 }
10523 }
10524
10525
10526 // CapturedRecordAttr implementation
10527
10528 CapturedRecordAttr *CapturedRecordAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10529 auto *A = new (Ctx) CapturedRecordAttr(Ctx, CommonInfo);
10530 A->setImplicit(true);
10531 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10532 A->setAttributeSpellingListIndex(0);
10533 return A;
10534 }
10535
10536 CapturedRecordAttr *CapturedRecordAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10537 auto *A = new (Ctx) CapturedRecordAttr(Ctx, CommonInfo);
10538 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10539 A->setAttributeSpellingListIndex(0);
10540 return A;
10541 }
10542
10543 CapturedRecordAttr *CapturedRecordAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
10544 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
10545 return CreateImplicit(Ctx, I);
10546 }
10547
10548 CapturedRecordAttr *CapturedRecordAttr::Create(ASTContext &Ctx, SourceRange Range) {
10549 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
10550 return Create(Ctx, I);
10551 }
10552
10553 CapturedRecordAttr::CapturedRecordAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10554 )
10555 : InheritableAttr(Ctx, CommonInfo, attr::CapturedRecord, /*IsLateParsed=*/false, false)
10556 {
10557 }
10558
10559 CapturedRecordAttr *CapturedRecordAttr::clone(ASTContext &C) const {
10560 auto *A = new (C) CapturedRecordAttr(C, *this);
10561 A->Inherited = Inherited;
10562 A->IsPackExpansion = IsPackExpansion;
10563 A->setImplicit(Implicit);
10564 return A;
10565 }
10566
10567 void CapturedRecordAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
10568 }
10569
10570 const char *CapturedRecordAttr::getSpelling() const {
10571 return "(No spelling)";
10572 }
10573
10574
10575 // CarriesDependencyAttr implementation
10576
10577 CarriesDependencyAttr *CarriesDependencyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10578 auto *A = new (Ctx) CarriesDependencyAttr(Ctx, CommonInfo);
10579 A->setImplicit(true);
10580 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10581 A->setAttributeSpellingListIndex(0);
10582 return A;
10583 }
10584
10585 CarriesDependencyAttr *CarriesDependencyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10586 auto *A = new (Ctx) CarriesDependencyAttr(Ctx, CommonInfo);
10587 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10588 A->setAttributeSpellingListIndex(0);
10589 return A;
10590 }
10591
10592 CarriesDependencyAttr *CarriesDependencyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
10593 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10594 switch (S) {
10595 case GNU_carries_dependency:
10596 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_carries_dependency, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10597 case CXX11_carries_dependency:
10598 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_carries_dependency, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10599 default:
10600 llvm_unreachable("Unknown attribute spelling!");
10601 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10602 }
10603 }());
10604 return CreateImplicit(Ctx, I);
10605 }
10606
10607 CarriesDependencyAttr *CarriesDependencyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
10608 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10609 switch (S) {
10610 case GNU_carries_dependency:
10611 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_carries_dependency, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10612 case CXX11_carries_dependency:
10613 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_carries_dependency, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10614 default:
10615 llvm_unreachable("Unknown attribute spelling!");
10616 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10617 }
10618 }());
10619 return Create(Ctx, I);
10620 }
10621
10622 CarriesDependencyAttr::CarriesDependencyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10623 )
10624 : InheritableParamAttr(Ctx, CommonInfo, attr::CarriesDependency, /*IsLateParsed=*/false, false)
10625 {
10626 }
10627
10628 CarriesDependencyAttr *CarriesDependencyAttr::clone(ASTContext &C) const {
10629 auto *A = new (C) CarriesDependencyAttr(C, *this);
10630 A->Inherited = Inherited;
10631 A->IsPackExpansion = IsPackExpansion;
10632 A->setImplicit(Implicit);
10633 return A;
10634 }
10635
10636 void CarriesDependencyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
10637 bool IsFirstArgument = true; (void)IsFirstArgument;
10638 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
10639 switch (getAttributeSpellingListIndex()) {
10640 default:
10641 llvm_unreachable("Unknown attribute spelling!");
10642 break;
10643 case 0 : {
10644 OS << "__attribute__((carries_dependency";
10645 OS << "))";
10646 break;
10647 }
10648 case 1 : {
10649 OS << "[[carries_dependency";
10650 OS << "]]";
10651 break;
10652 }
10653 }
10654 }
10655
10656 const char *CarriesDependencyAttr::getSpelling() const {
10657 switch (getAttributeSpellingListIndex()) {
10658 default:
10659 llvm_unreachable("Unknown attribute spelling!");
10660 return "(No spelling)";
10661 case 0:
10662 return "carries_dependency";
10663 case 1:
10664 return "carries_dependency";
10665 }
10666 }
10667
10668
10669 // CleanupAttr implementation
10670
10671 CleanupAttr *CleanupAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * FunctionDecl, const AttributeCommonInfo &CommonInfo) {
10672 auto *A = new (Ctx) CleanupAttr(Ctx, CommonInfo, FunctionDecl);
10673 A->setImplicit(true);
10674 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10675 A->setAttributeSpellingListIndex(0);
10676 return A;
10677 }
10678
10679 CleanupAttr *CleanupAttr::Create(ASTContext &Ctx, FunctionDecl * FunctionDecl, const AttributeCommonInfo &CommonInfo) {
10680 auto *A = new (Ctx) CleanupAttr(Ctx, CommonInfo, FunctionDecl);
10681 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10682 A->setAttributeSpellingListIndex(0);
10683 return A;
10684 }
10685
10686 CleanupAttr *CleanupAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * FunctionDecl, SourceRange Range, Spelling S) {
10687 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10688 switch (S) {
10689 case GNU_cleanup:
10690 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10691 case CXX11_gnu_cleanup:
10692 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10693 case C23_gnu_cleanup:
10694 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10695 default:
10696 llvm_unreachable("Unknown attribute spelling!");
10697 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10698 }
10699 }());
10700 return CreateImplicit(Ctx, FunctionDecl, I);
10701 }
10702
10703 CleanupAttr *CleanupAttr::Create(ASTContext &Ctx, FunctionDecl * FunctionDecl, SourceRange Range, Spelling S) {
10704 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10705 switch (S) {
10706 case GNU_cleanup:
10707 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10708 case CXX11_gnu_cleanup:
10709 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10710 case C23_gnu_cleanup:
10711 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10712 default:
10713 llvm_unreachable("Unknown attribute spelling!");
10714 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10715 }
10716 }());
10717 return Create(Ctx, FunctionDecl, I);
10718 }
10719
10720 CleanupAttr::CleanupAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10721 , FunctionDecl * FunctionDecl
10722 )
10723 : InheritableAttr(Ctx, CommonInfo, attr::Cleanup, /*IsLateParsed=*/false, false)
10724 , functionDecl(FunctionDecl)
10725 {
10726 }
10727
10728
10729
10730 CleanupAttr *CleanupAttr::clone(ASTContext &C) const {
10731 auto *A = new (C) CleanupAttr(C, *this, functionDecl);
10732 A->Inherited = Inherited;
10733 A->IsPackExpansion = IsPackExpansion;
10734 A->setImplicit(Implicit);
10735 return A;
10736 }
10737
10738 void CleanupAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
10739 bool IsFirstArgument = true; (void)IsFirstArgument;
10740 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
10741 switch (getAttributeSpellingListIndex()) {
10742 default:
10743 llvm_unreachable("Unknown attribute spelling!");
10744 break;
10745 case 0 : {
10746 OS << "__attribute__((cleanup";
10747 DelimitAttributeArgument(OS, IsFirstArgument);
10748 OS << "" << getFunctionDecl()->getNameInfo().getAsString() << "";
10749 if (!IsFirstArgument)
10750 OS << ")";
10751 OS << "))";
10752 break;
10753 }
10754 case 1 : {
10755 OS << "[[gnu::cleanup";
10756 DelimitAttributeArgument(OS, IsFirstArgument);
10757 OS << "" << getFunctionDecl()->getNameInfo().getAsString() << "";
10758 if (!IsFirstArgument)
10759 OS << ")";
10760 OS << "]]";
10761 break;
10762 }
10763 case 2 : {
10764 OS << "[[gnu::cleanup";
10765 DelimitAttributeArgument(OS, IsFirstArgument);
10766 OS << "" << getFunctionDecl()->getNameInfo().getAsString() << "";
10767 if (!IsFirstArgument)
10768 OS << ")";
10769 OS << "]]";
10770 break;
10771 }
10772 }
10773 }
10774
10775 const char *CleanupAttr::getSpelling() const {
10776 switch (getAttributeSpellingListIndex()) {
10777 default:
10778 llvm_unreachable("Unknown attribute spelling!");
10779 return "(No spelling)";
10780 case 0:
10781 return "cleanup";
10782 case 1:
10783 return "cleanup";
10784 case 2:
10785 return "cleanup";
10786 }
10787 }
10788
10789
10790 // ClspvLibclcBuiltinAttr implementation
10791
10792 ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10793 auto *A = new (Ctx) ClspvLibclcBuiltinAttr(Ctx, CommonInfo);
10794 A->setImplicit(true);
10795 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10796 A->setAttributeSpellingListIndex(0);
10797 return A;
10798 }
10799
10800 ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10801 auto *A = new (Ctx) ClspvLibclcBuiltinAttr(Ctx, CommonInfo);
10802 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10803 A->setAttributeSpellingListIndex(0);
10804 return A;
10805 }
10806
10807 ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
10808 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10809 switch (S) {
10810 case GNU_clspv_libclc_builtin:
10811 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10812 case CXX11_clang_clspv_libclc_builtin:
10813 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10814 case C23_clang_clspv_libclc_builtin:
10815 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10816 default:
10817 llvm_unreachable("Unknown attribute spelling!");
10818 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10819 }
10820 }());
10821 return CreateImplicit(Ctx, I);
10822 }
10823
10824 ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
10825 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
10826 switch (S) {
10827 case GNU_clspv_libclc_builtin:
10828 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10829 case CXX11_clang_clspv_libclc_builtin:
10830 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10831 case C23_clang_clspv_libclc_builtin:
10832 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10833 default:
10834 llvm_unreachable("Unknown attribute spelling!");
10835 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
10836 }
10837 }());
10838 return Create(Ctx, I);
10839 }
10840
10841 ClspvLibclcBuiltinAttr::ClspvLibclcBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10842 )
10843 : InheritableAttr(Ctx, CommonInfo, attr::ClspvLibclcBuiltin, /*IsLateParsed=*/false, false)
10844 {
10845 }
10846
10847 ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::clone(ASTContext &C) const {
10848 auto *A = new (C) ClspvLibclcBuiltinAttr(C, *this);
10849 A->Inherited = Inherited;
10850 A->IsPackExpansion = IsPackExpansion;
10851 A->setImplicit(Implicit);
10852 return A;
10853 }
10854
10855 void ClspvLibclcBuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
10856 bool IsFirstArgument = true; (void)IsFirstArgument;
10857 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
10858 switch (getAttributeSpellingListIndex()) {
10859 default:
10860 llvm_unreachable("Unknown attribute spelling!");
10861 break;
10862 case 0 : {
10863 OS << "__attribute__((clspv_libclc_builtin";
10864 OS << "))";
10865 break;
10866 }
10867 case 1 : {
10868 OS << "[[clang::clspv_libclc_builtin";
10869 OS << "]]";
10870 break;
10871 }
10872 case 2 : {
10873 OS << "[[clang::clspv_libclc_builtin";
10874 OS << "]]";
10875 break;
10876 }
10877 }
10878 }
10879
10880 const char *ClspvLibclcBuiltinAttr::getSpelling() const {
10881 switch (getAttributeSpellingListIndex()) {
10882 default:
10883 llvm_unreachable("Unknown attribute spelling!");
10884 return "(No spelling)";
10885 case 0:
10886 return "clspv_libclc_builtin";
10887 case 1:
10888 return "clspv_libclc_builtin";
10889 case 2:
10890 return "clspv_libclc_builtin";
10891 }
10892 }
10893
10894
10895 // CmseNSCallAttr implementation
10896
10897 CmseNSCallAttr *CmseNSCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10898 auto *A = new (Ctx) CmseNSCallAttr(Ctx, CommonInfo);
10899 A->setImplicit(true);
10900 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10901 A->setAttributeSpellingListIndex(0);
10902 return A;
10903 }
10904
10905 CmseNSCallAttr *CmseNSCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10906 auto *A = new (Ctx) CmseNSCallAttr(Ctx, CommonInfo);
10907 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10908 A->setAttributeSpellingListIndex(0);
10909 return A;
10910 }
10911
10912 CmseNSCallAttr *CmseNSCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
10913 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
10914 return CreateImplicit(Ctx, I);
10915 }
10916
10917 CmseNSCallAttr *CmseNSCallAttr::Create(ASTContext &Ctx, SourceRange Range) {
10918 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
10919 return Create(Ctx, I);
10920 }
10921
10922 CmseNSCallAttr::CmseNSCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10923 )
10924 : TypeAttr(Ctx, CommonInfo, attr::CmseNSCall, /*IsLateParsed=*/false)
10925 {
10926 }
10927
10928 CmseNSCallAttr *CmseNSCallAttr::clone(ASTContext &C) const {
10929 auto *A = new (C) CmseNSCallAttr(C, *this);
10930 A->Inherited = Inherited;
10931 A->IsPackExpansion = IsPackExpansion;
10932 A->setImplicit(Implicit);
10933 return A;
10934 }
10935
10936 void CmseNSCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
10937 bool IsFirstArgument = true; (void)IsFirstArgument;
10938 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
10939 switch (getAttributeSpellingListIndex()) {
10940 default:
10941 llvm_unreachable("Unknown attribute spelling!");
10942 break;
10943 case 0 : {
10944 OS << "__attribute__((cmse_nonsecure_call";
10945 OS << "))";
10946 break;
10947 }
10948 }
10949 }
10950
10951 const char *CmseNSCallAttr::getSpelling() const {
10952 switch (getAttributeSpellingListIndex()) {
10953 default:
10954 llvm_unreachable("Unknown attribute spelling!");
10955 return "(No spelling)";
10956 case 0:
10957 return "cmse_nonsecure_call";
10958 }
10959 }
10960
10961
10962 // CmseNSEntryAttr implementation
10963
10964 CmseNSEntryAttr *CmseNSEntryAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10965 auto *A = new (Ctx) CmseNSEntryAttr(Ctx, CommonInfo);
10966 A->setImplicit(true);
10967 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10968 A->setAttributeSpellingListIndex(0);
10969 return A;
10970 }
10971
10972 CmseNSEntryAttr *CmseNSEntryAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
10973 auto *A = new (Ctx) CmseNSEntryAttr(Ctx, CommonInfo);
10974 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
10975 A->setAttributeSpellingListIndex(0);
10976 return A;
10977 }
10978
10979 CmseNSEntryAttr *CmseNSEntryAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
10980 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
10981 return CreateImplicit(Ctx, I);
10982 }
10983
10984 CmseNSEntryAttr *CmseNSEntryAttr::Create(ASTContext &Ctx, SourceRange Range) {
10985 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
10986 return Create(Ctx, I);
10987 }
10988
10989 CmseNSEntryAttr::CmseNSEntryAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
10990 )
10991 : InheritableAttr(Ctx, CommonInfo, attr::CmseNSEntry, /*IsLateParsed=*/false, false)
10992 {
10993 }
10994
10995 CmseNSEntryAttr *CmseNSEntryAttr::clone(ASTContext &C) const {
10996 auto *A = new (C) CmseNSEntryAttr(C, *this);
10997 A->Inherited = Inherited;
10998 A->IsPackExpansion = IsPackExpansion;
10999 A->setImplicit(Implicit);
11000 return A;
11001 }
11002
11003 void CmseNSEntryAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
11004 bool IsFirstArgument = true; (void)IsFirstArgument;
11005 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
11006 switch (getAttributeSpellingListIndex()) {
11007 default:
11008 llvm_unreachable("Unknown attribute spelling!");
11009 break;
11010 case 0 : {
11011 OS << "__attribute__((cmse_nonsecure_entry";
11012 OS << "))";
11013 break;
11014 }
11015 }
11016 }
11017
11018 const char *CmseNSEntryAttr::getSpelling() const {
11019 switch (getAttributeSpellingListIndex()) {
11020 default:
11021 llvm_unreachable("Unknown attribute spelling!");
11022 return "(No spelling)";
11023 case 0:
11024 return "cmse_nonsecure_entry";
11025 }
11026 }
11027
11028
11029 // CodeAlignAttr implementation
11030
11031 CodeAlignAttr *CodeAlignAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) {
11032 auto *A = new (Ctx) CodeAlignAttr(Ctx, CommonInfo, Alignment);
11033 A->setImplicit(true);
11034 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11035 A->setAttributeSpellingListIndex(0);
11036 return A;
11037 }
11038
11039 CodeAlignAttr *CodeAlignAttr::Create(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) {
11040 auto *A = new (Ctx) CodeAlignAttr(Ctx, CommonInfo, Alignment);
11041 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11042 A->setAttributeSpellingListIndex(0);
11043 return A;
11044 }
11045
11046 CodeAlignAttr *CodeAlignAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, SourceRange Range, Spelling S) {
11047 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11048 switch (S) {
11049 case GNU_code_align:
11050 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11051 case CXX11_clang_code_align:
11052 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11053 case C23_clang_code_align:
11054 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11055 default:
11056 llvm_unreachable("Unknown attribute spelling!");
11057 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11058 }
11059 }());
11060 return CreateImplicit(Ctx, Alignment, I);
11061 }
11062
11063 CodeAlignAttr *CodeAlignAttr::Create(ASTContext &Ctx, Expr * Alignment, SourceRange Range, Spelling S) {
11064 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11065 switch (S) {
11066 case GNU_code_align:
11067 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11068 case CXX11_clang_code_align:
11069 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11070 case C23_clang_code_align:
11071 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11072 default:
11073 llvm_unreachable("Unknown attribute spelling!");
11074 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11075 }
11076 }());
11077 return Create(Ctx, Alignment, I);
11078 }
11079
11080 CodeAlignAttr::CodeAlignAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11081 , Expr * Alignment
11082 )
11083 : StmtAttr(Ctx, CommonInfo, attr::CodeAlign, /*IsLateParsed=*/false)
11084 , alignment(Alignment)
11085 {
11086 }
11087
11088
11089
11090 CodeAlignAttr *CodeAlignAttr::clone(ASTContext &C) const {
11091 auto *A = new (C) CodeAlignAttr(C, *this, alignment);
11092 A->Inherited = Inherited;
11093 A->IsPackExpansion = IsPackExpansion;
11094 A->setImplicit(Implicit);
11095 return A;
11096 }
11097
11098 void CodeAlignAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
11099 bool IsFirstArgument = true; (void)IsFirstArgument;
11100 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
11101 switch (getAttributeSpellingListIndex()) {
11102 default:
11103 llvm_unreachable("Unknown attribute spelling!");
11104 break;
11105 case 0 : {
11106 OS << "__attribute__((code_align";
11107 DelimitAttributeArgument(OS, IsFirstArgument);
11108 OS << "";
11109 getAlignment()->printPretty(OS, nullptr, Policy);
11110 OS << "";
11111 if (!IsFirstArgument)
11112 OS << ")";
11113 OS << "))";
11114 break;
11115 }
11116 case 1 : {
11117 OS << "[[clang::code_align";
11118 DelimitAttributeArgument(OS, IsFirstArgument);
11119 OS << "";
11120 getAlignment()->printPretty(OS, nullptr, Policy);
11121 OS << "";
11122 if (!IsFirstArgument)
11123 OS << ")";
11124 OS << "]]";
11125 break;
11126 }
11127 case 2 : {
11128 OS << "[[clang::code_align";
11129 DelimitAttributeArgument(OS, IsFirstArgument);
11130 OS << "";
11131 getAlignment()->printPretty(OS, nullptr, Policy);
11132 OS << "";
11133 if (!IsFirstArgument)
11134 OS << ")";
11135 OS << "]]";
11136 break;
11137 }
11138 }
11139 }
11140
11141 const char *CodeAlignAttr::getSpelling() const {
11142 switch (getAttributeSpellingListIndex()) {
11143 default:
11144 llvm_unreachable("Unknown attribute spelling!");
11145 return "(No spelling)";
11146 case 0:
11147 return "code_align";
11148 case 1:
11149 return "code_align";
11150 case 2:
11151 return "code_align";
11152 }
11153 }
11154
11155
11156 // CodeModelAttr implementation
11157
11158 CodeModelAttr *CodeModelAttr::CreateImplicit(ASTContext &Ctx, llvm::CodeModel::Model Model, const AttributeCommonInfo &CommonInfo) {
11159 auto *A = new (Ctx) CodeModelAttr(Ctx, CommonInfo, Model);
11160 A->setImplicit(true);
11161 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11162 A->setAttributeSpellingListIndex(0);
11163 return A;
11164 }
11165
11166 CodeModelAttr *CodeModelAttr::Create(ASTContext &Ctx, llvm::CodeModel::Model Model, const AttributeCommonInfo &CommonInfo) {
11167 auto *A = new (Ctx) CodeModelAttr(Ctx, CommonInfo, Model);
11168 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11169 A->setAttributeSpellingListIndex(0);
11170 return A;
11171 }
11172
11173 CodeModelAttr *CodeModelAttr::CreateImplicit(ASTContext &Ctx, llvm::CodeModel::Model Model, SourceRange Range, Spelling S) {
11174 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11175 switch (S) {
11176 case GNU_model:
11177 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11178 case CXX11_gnu_model:
11179 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11180 case C23_gnu_model:
11181 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11182 default:
11183 llvm_unreachable("Unknown attribute spelling!");
11184 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11185 }
11186 }());
11187 return CreateImplicit(Ctx, Model, I);
11188 }
11189
11190 CodeModelAttr *CodeModelAttr::Create(ASTContext &Ctx, llvm::CodeModel::Model Model, SourceRange Range, Spelling S) {
11191 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11192 switch (S) {
11193 case GNU_model:
11194 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11195 case CXX11_gnu_model:
11196 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11197 case C23_gnu_model:
11198 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11199 default:
11200 llvm_unreachable("Unknown attribute spelling!");
11201 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11202 }
11203 }());
11204 return Create(Ctx, Model, I);
11205 }
11206
11207 CodeModelAttr::CodeModelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11208 , llvm::CodeModel::Model Model
11209 )
11210 : InheritableAttr(Ctx, CommonInfo, attr::CodeModel, /*IsLateParsed=*/false, false)
11211 , model(Model)
11212 {
11213 }
11214
11215
11216
11217 bool CodeModelAttr::ConvertStrToModel(StringRef Val, llvm::CodeModel::Model &Out) {
11218 std::optional<llvm::CodeModel::Model> R = llvm::StringSwitch<std::optional<llvm::CodeModel::Model>>(Val)
11219 .Case("normal", llvm::CodeModel::Model::Small)
11220 .Case("medium", llvm::CodeModel::Model::Medium)
11221 .Case("extreme", llvm::CodeModel::Model::Large)
11222 .Default(std::optional<llvm::CodeModel::Model>());
11223 if (R) {
11224 Out = *R;
11225 return true;
11226 }
11227 return false;
11228 }
11229
11230 const char *CodeModelAttr::ConvertModelToStr(llvm::CodeModel::Model Val) {
11231 switch(Val) {
11232 case llvm::CodeModel::Model::Small: return "normal";
11233 case llvm::CodeModel::Model::Medium: return "medium";
11234 case llvm::CodeModel::Model::Large: return "extreme";
11235 default: llvm_unreachable("Invalid attribute value");
11236 }
11237 llvm_unreachable("No enumerator with that value");
11238 }
11239 CodeModelAttr *CodeModelAttr::clone(ASTContext &C) const {
11240 auto *A = new (C) CodeModelAttr(C, *this, model);
11241 A->Inherited = Inherited;
11242 A->IsPackExpansion = IsPackExpansion;
11243 A->setImplicit(Implicit);
11244 return A;
11245 }
11246
11247 void CodeModelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
11248 bool IsFirstArgument = true; (void)IsFirstArgument;
11249 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
11250 switch (getAttributeSpellingListIndex()) {
11251 default:
11252 llvm_unreachable("Unknown attribute spelling!");
11253 break;
11254 case 0 : {
11255 OS << "__attribute__((model";
11256 DelimitAttributeArgument(OS, IsFirstArgument);
11257 OS << "\"" << CodeModelAttr::ConvertModelToStr(getModel()) << "\"";
11258 if (!IsFirstArgument)
11259 OS << ")";
11260 OS << "))";
11261 break;
11262 }
11263 case 1 : {
11264 OS << "[[gnu::model";
11265 DelimitAttributeArgument(OS, IsFirstArgument);
11266 OS << "\"" << CodeModelAttr::ConvertModelToStr(getModel()) << "\"";
11267 if (!IsFirstArgument)
11268 OS << ")";
11269 OS << "]]";
11270 break;
11271 }
11272 case 2 : {
11273 OS << "[[gnu::model";
11274 DelimitAttributeArgument(OS, IsFirstArgument);
11275 OS << "\"" << CodeModelAttr::ConvertModelToStr(getModel()) << "\"";
11276 if (!IsFirstArgument)
11277 OS << ")";
11278 OS << "]]";
11279 break;
11280 }
11281 }
11282 }
11283
11284 const char *CodeModelAttr::getSpelling() const {
11285 switch (getAttributeSpellingListIndex()) {
11286 default:
11287 llvm_unreachable("Unknown attribute spelling!");
11288 return "(No spelling)";
11289 case 0:
11290 return "model";
11291 case 1:
11292 return "model";
11293 case 2:
11294 return "model";
11295 }
11296 }
11297
11298
11299 // CodeSegAttr implementation
11300
11301 CodeSegAttr *CodeSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
11302 auto *A = new (Ctx) CodeSegAttr(Ctx, CommonInfo, Name);
11303 A->setImplicit(true);
11304 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11305 A->setAttributeSpellingListIndex(0);
11306 return A;
11307 }
11308
11309 CodeSegAttr *CodeSegAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
11310 auto *A = new (Ctx) CodeSegAttr(Ctx, CommonInfo, Name);
11311 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11312 A->setAttributeSpellingListIndex(0);
11313 return A;
11314 }
11315
11316 CodeSegAttr *CodeSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
11317 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
11318 return CreateImplicit(Ctx, Name, I);
11319 }
11320
11321 CodeSegAttr *CodeSegAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
11322 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
11323 return Create(Ctx, Name, I);
11324 }
11325
11326 CodeSegAttr::CodeSegAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11327 , llvm::StringRef Name
11328 )
11329 : InheritableAttr(Ctx, CommonInfo, attr::CodeSeg, /*IsLateParsed=*/false, false)
11330 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
11331 {
11332 if (!Name.empty())
11333 std::memcpy(name, Name.data(), nameLength);
11334 }
11335
11336
11337
11338 CodeSegAttr *CodeSegAttr::clone(ASTContext &C) const {
11339 auto *A = new (C) CodeSegAttr(C, *this, getName());
11340 A->Inherited = Inherited;
11341 A->IsPackExpansion = IsPackExpansion;
11342 A->setImplicit(Implicit);
11343 return A;
11344 }
11345
11346 void CodeSegAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
11347 bool IsFirstArgument = true; (void)IsFirstArgument;
11348 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
11349 switch (getAttributeSpellingListIndex()) {
11350 default:
11351 llvm_unreachable("Unknown attribute spelling!");
11352 break;
11353 case 0 : {
11354 OS << "__declspec(code_seg";
11355 DelimitAttributeArgument(OS, IsFirstArgument);
11356 OS << "\"" << getName() << "\"";
11357 if (!IsFirstArgument)
11358 OS << ")";
11359 OS << ")";
11360 break;
11361 }
11362 }
11363 }
11364
11365 const char *CodeSegAttr::getSpelling() const {
11366 switch (getAttributeSpellingListIndex()) {
11367 default:
11368 llvm_unreachable("Unknown attribute spelling!");
11369 return "(No spelling)";
11370 case 0:
11371 return "code_seg";
11372 }
11373 }
11374
11375
11376 // ColdAttr implementation
11377
11378 ColdAttr *ColdAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
11379 auto *A = new (Ctx) ColdAttr(Ctx, CommonInfo);
11380 A->setImplicit(true);
11381 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11382 A->setAttributeSpellingListIndex(0);
11383 return A;
11384 }
11385
11386 ColdAttr *ColdAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
11387 auto *A = new (Ctx) ColdAttr(Ctx, CommonInfo);
11388 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11389 A->setAttributeSpellingListIndex(0);
11390 return A;
11391 }
11392
11393 ColdAttr *ColdAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
11394 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11395 switch (S) {
11396 case GNU_cold:
11397 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11398 case CXX11_gnu_cold:
11399 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11400 case C23_gnu_cold:
11401 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11402 default:
11403 llvm_unreachable("Unknown attribute spelling!");
11404 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11405 }
11406 }());
11407 return CreateImplicit(Ctx, I);
11408 }
11409
11410 ColdAttr *ColdAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
11411 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11412 switch (S) {
11413 case GNU_cold:
11414 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11415 case CXX11_gnu_cold:
11416 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11417 case C23_gnu_cold:
11418 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11419 default:
11420 llvm_unreachable("Unknown attribute spelling!");
11421 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11422 }
11423 }());
11424 return Create(Ctx, I);
11425 }
11426
11427 ColdAttr::ColdAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11428 )
11429 : InheritableAttr(Ctx, CommonInfo, attr::Cold, /*IsLateParsed=*/false, false)
11430 {
11431 }
11432
11433 ColdAttr *ColdAttr::clone(ASTContext &C) const {
11434 auto *A = new (C) ColdAttr(C, *this);
11435 A->Inherited = Inherited;
11436 A->IsPackExpansion = IsPackExpansion;
11437 A->setImplicit(Implicit);
11438 return A;
11439 }
11440
11441 void ColdAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
11442 bool IsFirstArgument = true; (void)IsFirstArgument;
11443 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
11444 switch (getAttributeSpellingListIndex()) {
11445 default:
11446 llvm_unreachable("Unknown attribute spelling!");
11447 break;
11448 case 0 : {
11449 OS << "__attribute__((cold";
11450 OS << "))";
11451 break;
11452 }
11453 case 1 : {
11454 OS << "[[gnu::cold";
11455 OS << "]]";
11456 break;
11457 }
11458 case 2 : {
11459 OS << "[[gnu::cold";
11460 OS << "]]";
11461 break;
11462 }
11463 }
11464 }
11465
11466 const char *ColdAttr::getSpelling() const {
11467 switch (getAttributeSpellingListIndex()) {
11468 default:
11469 llvm_unreachable("Unknown attribute spelling!");
11470 return "(No spelling)";
11471 case 0:
11472 return "cold";
11473 case 1:
11474 return "cold";
11475 case 2:
11476 return "cold";
11477 }
11478 }
11479
11480
11481 // CommonAttr implementation
11482
11483 CommonAttr *CommonAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
11484 auto *A = new (Ctx) CommonAttr(Ctx, CommonInfo);
11485 A->setImplicit(true);
11486 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11487 A->setAttributeSpellingListIndex(0);
11488 return A;
11489 }
11490
11491 CommonAttr *CommonAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
11492 auto *A = new (Ctx) CommonAttr(Ctx, CommonInfo);
11493 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11494 A->setAttributeSpellingListIndex(0);
11495 return A;
11496 }
11497
11498 CommonAttr *CommonAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
11499 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11500 switch (S) {
11501 case GNU_common:
11502 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11503 case CXX11_gnu_common:
11504 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11505 case C23_gnu_common:
11506 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11507 default:
11508 llvm_unreachable("Unknown attribute spelling!");
11509 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11510 }
11511 }());
11512 return CreateImplicit(Ctx, I);
11513 }
11514
11515 CommonAttr *CommonAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
11516 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11517 switch (S) {
11518 case GNU_common:
11519 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11520 case CXX11_gnu_common:
11521 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11522 case C23_gnu_common:
11523 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11524 default:
11525 llvm_unreachable("Unknown attribute spelling!");
11526 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11527 }
11528 }());
11529 return Create(Ctx, I);
11530 }
11531
11532 CommonAttr::CommonAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11533 )
11534 : InheritableAttr(Ctx, CommonInfo, attr::Common, /*IsLateParsed=*/false, false)
11535 {
11536 }
11537
11538 CommonAttr *CommonAttr::clone(ASTContext &C) const {
11539 auto *A = new (C) CommonAttr(C, *this);
11540 A->Inherited = Inherited;
11541 A->IsPackExpansion = IsPackExpansion;
11542 A->setImplicit(Implicit);
11543 return A;
11544 }
11545
11546 void CommonAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
11547 bool IsFirstArgument = true; (void)IsFirstArgument;
11548 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
11549 switch (getAttributeSpellingListIndex()) {
11550 default:
11551 llvm_unreachable("Unknown attribute spelling!");
11552 break;
11553 case 0 : {
11554 OS << "__attribute__((common";
11555 OS << "))";
11556 break;
11557 }
11558 case 1 : {
11559 OS << "[[gnu::common";
11560 OS << "]]";
11561 break;
11562 }
11563 case 2 : {
11564 OS << "[[gnu::common";
11565 OS << "]]";
11566 break;
11567 }
11568 }
11569 }
11570
11571 const char *CommonAttr::getSpelling() const {
11572 switch (getAttributeSpellingListIndex()) {
11573 default:
11574 llvm_unreachable("Unknown attribute spelling!");
11575 return "(No spelling)";
11576 case 0:
11577 return "common";
11578 case 1:
11579 return "common";
11580 case 2:
11581 return "common";
11582 }
11583 }
11584
11585
11586 // ConstAttr implementation
11587
11588 ConstAttr *ConstAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
11589 auto *A = new (Ctx) ConstAttr(Ctx, CommonInfo);
11590 A->setImplicit(true);
11591 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11592 A->setAttributeSpellingListIndex(0);
11593 return A;
11594 }
11595
11596 ConstAttr *ConstAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
11597 auto *A = new (Ctx) ConstAttr(Ctx, CommonInfo);
11598 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11599 A->setAttributeSpellingListIndex(0);
11600 return A;
11601 }
11602
11603 ConstAttr *ConstAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
11604 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11605 switch (S) {
11606 case GNU_const:
11607 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11608 case CXX11_gnu_const:
11609 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11610 case C23_gnu_const:
11611 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11612 default:
11613 llvm_unreachable("Unknown attribute spelling!");
11614 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11615 }
11616 }());
11617 return CreateImplicit(Ctx, I);
11618 }
11619
11620 ConstAttr *ConstAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
11621 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11622 switch (S) {
11623 case GNU_const:
11624 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11625 case CXX11_gnu_const:
11626 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11627 case C23_gnu_const:
11628 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11629 default:
11630 llvm_unreachable("Unknown attribute spelling!");
11631 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11632 }
11633 }());
11634 return Create(Ctx, I);
11635 }
11636
11637 ConstAttr::ConstAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11638 )
11639 : InheritableAttr(Ctx, CommonInfo, attr::Const, /*IsLateParsed=*/false, false)
11640 {
11641 }
11642
11643 ConstAttr *ConstAttr::clone(ASTContext &C) const {
11644 auto *A = new (C) ConstAttr(C, *this);
11645 A->Inherited = Inherited;
11646 A->IsPackExpansion = IsPackExpansion;
11647 A->setImplicit(Implicit);
11648 return A;
11649 }
11650
11651 void ConstAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
11652 bool IsFirstArgument = true; (void)IsFirstArgument;
11653 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
11654 switch (getAttributeSpellingListIndex()) {
11655 default:
11656 llvm_unreachable("Unknown attribute spelling!");
11657 break;
11658 case 0 : {
11659 OS << "__attribute__((const";
11660 OS << "))";
11661 break;
11662 }
11663 case 1 : {
11664 OS << "[[gnu::const";
11665 OS << "]]";
11666 break;
11667 }
11668 case 2 : {
11669 OS << "[[gnu::const";
11670 OS << "]]";
11671 break;
11672 }
11673 case 3 : {
11674 OS << "__attribute__((__const";
11675 OS << "))";
11676 break;
11677 }
11678 case 4 : {
11679 OS << "[[gnu::__const";
11680 OS << "]]";
11681 break;
11682 }
11683 case 5 : {
11684 OS << "[[gnu::__const";
11685 OS << "]]";
11686 break;
11687 }
11688 }
11689 }
11690
11691 const char *ConstAttr::getSpelling() const {
11692 switch (getAttributeSpellingListIndex()) {
11693 default:
11694 llvm_unreachable("Unknown attribute spelling!");
11695 return "(No spelling)";
11696 case 0:
11697 return "const";
11698 case 1:
11699 return "const";
11700 case 2:
11701 return "const";
11702 case 3:
11703 return "__const";
11704 case 4:
11705 return "__const";
11706 case 5:
11707 return "__const";
11708 }
11709 }
11710
11711
11712 // ConstInitAttr implementation
11713
11714 ConstInitAttr *ConstInitAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
11715 auto *A = new (Ctx) ConstInitAttr(Ctx, CommonInfo);
11716 A->setImplicit(true);
11717 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11718 A->setAttributeSpellingListIndex(0);
11719 return A;
11720 }
11721
11722 ConstInitAttr *ConstInitAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
11723 auto *A = new (Ctx) ConstInitAttr(Ctx, CommonInfo);
11724 return A;
11725 }
11726
11727 ConstInitAttr *ConstInitAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
11728 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11729 switch (S) {
11730 case Keyword_constinit:
11731 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_constinit, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11732 case GNU_require_constant_initialization:
11733 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_require_constant_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11734 case CXX11_clang_require_constant_initialization:
11735 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_require_constant_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11736 default:
11737 llvm_unreachable("Unknown attribute spelling!");
11738 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11739 }
11740 }());
11741 return CreateImplicit(Ctx, I);
11742 }
11743
11744 ConstInitAttr *ConstInitAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
11745 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11746 switch (S) {
11747 case Keyword_constinit:
11748 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_constinit, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11749 case GNU_require_constant_initialization:
11750 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_require_constant_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11751 case CXX11_clang_require_constant_initialization:
11752 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_require_constant_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11753 default:
11754 llvm_unreachable("Unknown attribute spelling!");
11755 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11756 }
11757 }());
11758 return Create(Ctx, I);
11759 }
11760
11761 ConstInitAttr::ConstInitAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11762 )
11763 : InheritableAttr(Ctx, CommonInfo, attr::ConstInit, /*IsLateParsed=*/false, false)
11764 {
11765 }
11766
11767 ConstInitAttr::Spelling ConstInitAttr::getSemanticSpelling() const {
11768 switch (getAttributeSpellingListIndex()) {
11769 default: llvm_unreachable("Unknown spelling list index");
11770 case 0: return Keyword_constinit;
11771 case 1: return GNU_require_constant_initialization;
11772 case 2: return CXX11_clang_require_constant_initialization;
11773 }
11774 }
11775 ConstInitAttr *ConstInitAttr::clone(ASTContext &C) const {
11776 auto *A = new (C) ConstInitAttr(C, *this);
11777 A->Inherited = Inherited;
11778 A->IsPackExpansion = IsPackExpansion;
11779 A->setImplicit(Implicit);
11780 return A;
11781 }
11782
11783 void ConstInitAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
11784 bool IsFirstArgument = true; (void)IsFirstArgument;
11785 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
11786 switch (getAttributeSpellingListIndex()) {
11787 default:
11788 llvm_unreachable("Unknown attribute spelling!");
11789 break;
11790 case 0 : {
11791 OS << "constinit";
11792 OS << "";
11793 break;
11794 }
11795 case 1 : {
11796 OS << "__attribute__((require_constant_initialization";
11797 OS << "))";
11798 break;
11799 }
11800 case 2 : {
11801 OS << "[[clang::require_constant_initialization";
11802 OS << "]]";
11803 break;
11804 }
11805 }
11806 }
11807
11808 const char *ConstInitAttr::getSpelling() const {
11809 switch (getAttributeSpellingListIndex()) {
11810 default:
11811 llvm_unreachable("Unknown attribute spelling!");
11812 return "(No spelling)";
11813 case 0:
11814 return "constinit";
11815 case 1:
11816 return "require_constant_initialization";
11817 case 2:
11818 return "require_constant_initialization";
11819 }
11820 }
11821
11822
11823 // ConstructorAttr implementation
11824
11825 ConstructorAttr *ConstructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) {
11826 auto *A = new (Ctx) ConstructorAttr(Ctx, CommonInfo, Priority);
11827 A->setImplicit(true);
11828 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11829 A->setAttributeSpellingListIndex(0);
11830 return A;
11831 }
11832
11833 ConstructorAttr *ConstructorAttr::Create(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) {
11834 auto *A = new (Ctx) ConstructorAttr(Ctx, CommonInfo, Priority);
11835 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11836 A->setAttributeSpellingListIndex(0);
11837 return A;
11838 }
11839
11840 ConstructorAttr *ConstructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Range, Spelling S) {
11841 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11842 switch (S) {
11843 case GNU_constructor:
11844 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11845 case CXX11_gnu_constructor:
11846 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11847 case C23_gnu_constructor:
11848 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11849 default:
11850 llvm_unreachable("Unknown attribute spelling!");
11851 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11852 }
11853 }());
11854 return CreateImplicit(Ctx, Priority, I);
11855 }
11856
11857 ConstructorAttr *ConstructorAttr::Create(ASTContext &Ctx, int Priority, SourceRange Range, Spelling S) {
11858 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11859 switch (S) {
11860 case GNU_constructor:
11861 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11862 case CXX11_gnu_constructor:
11863 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11864 case C23_gnu_constructor:
11865 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11866 default:
11867 llvm_unreachable("Unknown attribute spelling!");
11868 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11869 }
11870 }());
11871 return Create(Ctx, Priority, I);
11872 }
11873
11874 ConstructorAttr::ConstructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11875 , int Priority
11876 )
11877 : InheritableAttr(Ctx, CommonInfo, attr::Constructor, /*IsLateParsed=*/false, false)
11878 , priority(Priority)
11879 {
11880 }
11881
11882 ConstructorAttr::ConstructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11883 )
11884 : InheritableAttr(Ctx, CommonInfo, attr::Constructor, /*IsLateParsed=*/false, false)
11885 , priority()
11886 {
11887 }
11888
11889
11890
11891 ConstructorAttr *ConstructorAttr::clone(ASTContext &C) const {
11892 auto *A = new (C) ConstructorAttr(C, *this, priority);
11893 A->Inherited = Inherited;
11894 A->IsPackExpansion = IsPackExpansion;
11895 A->setImplicit(Implicit);
11896 return A;
11897 }
11898
11899 void ConstructorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
11900 bool IsFirstArgument = true; (void)IsFirstArgument;
11901 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
11902 switch (getAttributeSpellingListIndex()) {
11903 default:
11904 llvm_unreachable("Unknown attribute spelling!");
11905 break;
11906 case 0 : {
11907 OS << "__attribute__((constructor";
11908 DelimitAttributeArgument(OS, IsFirstArgument);
11909 OS << "" << getPriority() << "";
11910 if (!IsFirstArgument)
11911 OS << ")";
11912 OS << "))";
11913 break;
11914 }
11915 case 1 : {
11916 OS << "[[gnu::constructor";
11917 DelimitAttributeArgument(OS, IsFirstArgument);
11918 OS << "" << getPriority() << "";
11919 if (!IsFirstArgument)
11920 OS << ")";
11921 OS << "]]";
11922 break;
11923 }
11924 case 2 : {
11925 OS << "[[gnu::constructor";
11926 DelimitAttributeArgument(OS, IsFirstArgument);
11927 OS << "" << getPriority() << "";
11928 if (!IsFirstArgument)
11929 OS << ")";
11930 OS << "]]";
11931 break;
11932 }
11933 }
11934 }
11935
11936 const char *ConstructorAttr::getSpelling() const {
11937 switch (getAttributeSpellingListIndex()) {
11938 default:
11939 llvm_unreachable("Unknown attribute spelling!");
11940 return "(No spelling)";
11941 case 0:
11942 return "constructor";
11943 case 1:
11944 return "constructor";
11945 case 2:
11946 return "constructor";
11947 }
11948 }
11949
11950
11951 // ConsumableAttr implementation
11952
11953 ConsumableAttr *ConsumableAttr::CreateImplicit(ASTContext &Ctx, ConsumableAttr::ConsumedState DefaultState, const AttributeCommonInfo &CommonInfo) {
11954 auto *A = new (Ctx) ConsumableAttr(Ctx, CommonInfo, DefaultState);
11955 A->setImplicit(true);
11956 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11957 A->setAttributeSpellingListIndex(0);
11958 return A;
11959 }
11960
11961 ConsumableAttr *ConsumableAttr::Create(ASTContext &Ctx, ConsumableAttr::ConsumedState DefaultState, const AttributeCommonInfo &CommonInfo) {
11962 auto *A = new (Ctx) ConsumableAttr(Ctx, CommonInfo, DefaultState);
11963 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
11964 A->setAttributeSpellingListIndex(0);
11965 return A;
11966 }
11967
11968 ConsumableAttr *ConsumableAttr::CreateImplicit(ASTContext &Ctx, ConsumableAttr::ConsumedState DefaultState, SourceRange Range, Spelling S) {
11969 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11970 switch (S) {
11971 case GNU_consumable:
11972 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11973 case CXX11_clang_consumable:
11974 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11975 default:
11976 llvm_unreachable("Unknown attribute spelling!");
11977 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11978 }
11979 }());
11980 return CreateImplicit(Ctx, DefaultState, I);
11981 }
11982
11983 ConsumableAttr *ConsumableAttr::Create(ASTContext &Ctx, ConsumableAttr::ConsumedState DefaultState, SourceRange Range, Spelling S) {
11984 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
11985 switch (S) {
11986 case GNU_consumable:
11987 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11988 case CXX11_clang_consumable:
11989 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11990 default:
11991 llvm_unreachable("Unknown attribute spelling!");
11992 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
11993 }
11994 }());
11995 return Create(Ctx, DefaultState, I);
11996 }
11997
11998 ConsumableAttr::ConsumableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
11999 , ConsumableAttr::ConsumedState DefaultState
12000 )
12001 : InheritableAttr(Ctx, CommonInfo, attr::Consumable, /*IsLateParsed=*/false, false)
12002 , defaultState(DefaultState)
12003 {
12004 }
12005
12006
12007
12008 bool ConsumableAttr::ConvertStrToConsumedState(StringRef Val, ConsumableAttr::ConsumedState &Out) {
12009 std::optional<ConsumableAttr::ConsumedState> R = llvm::StringSwitch<std::optional<ConsumableAttr::ConsumedState>>(Val)
12010 .Case("unknown", ConsumableAttr::ConsumedState::Unknown)
12011 .Case("consumed", ConsumableAttr::ConsumedState::Consumed)
12012 .Case("unconsumed", ConsumableAttr::ConsumedState::Unconsumed)
12013 .Default(std::optional<ConsumableAttr::ConsumedState>());
12014 if (R) {
12015 Out = *R;
12016 return true;
12017 }
12018 return false;
12019 }
12020
12021 const char *ConsumableAttr::ConvertConsumedStateToStr(ConsumableAttr::ConsumedState Val) {
12022 switch(Val) {
12023 case ConsumableAttr::ConsumedState::Unknown: return "unknown";
12024 case ConsumableAttr::ConsumedState::Consumed: return "consumed";
12025 case ConsumableAttr::ConsumedState::Unconsumed: return "unconsumed";
12026 }
12027 llvm_unreachable("No enumerator with that value");
12028 }
12029 ConsumableAttr *ConsumableAttr::clone(ASTContext &C) const {
12030 auto *A = new (C) ConsumableAttr(C, *this, defaultState);
12031 A->Inherited = Inherited;
12032 A->IsPackExpansion = IsPackExpansion;
12033 A->setImplicit(Implicit);
12034 return A;
12035 }
12036
12037 void ConsumableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12038 bool IsFirstArgument = true; (void)IsFirstArgument;
12039 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12040 switch (getAttributeSpellingListIndex()) {
12041 default:
12042 llvm_unreachable("Unknown attribute spelling!");
12043 break;
12044 case 0 : {
12045 OS << "__attribute__((consumable";
12046 DelimitAttributeArgument(OS, IsFirstArgument);
12047 OS << "\"" << ConsumableAttr::ConvertConsumedStateToStr(getDefaultState()) << "\"";
12048 if (!IsFirstArgument)
12049 OS << ")";
12050 OS << "))";
12051 break;
12052 }
12053 case 1 : {
12054 OS << "[[clang::consumable";
12055 DelimitAttributeArgument(OS, IsFirstArgument);
12056 OS << "\"" << ConsumableAttr::ConvertConsumedStateToStr(getDefaultState()) << "\"";
12057 if (!IsFirstArgument)
12058 OS << ")";
12059 OS << "]]";
12060 break;
12061 }
12062 }
12063 }
12064
12065 const char *ConsumableAttr::getSpelling() const {
12066 switch (getAttributeSpellingListIndex()) {
12067 default:
12068 llvm_unreachable("Unknown attribute spelling!");
12069 return "(No spelling)";
12070 case 0:
12071 return "consumable";
12072 case 1:
12073 return "consumable";
12074 }
12075 }
12076
12077
12078 // ConsumableAutoCastAttr implementation
12079
12080 ConsumableAutoCastAttr *ConsumableAutoCastAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12081 auto *A = new (Ctx) ConsumableAutoCastAttr(Ctx, CommonInfo);
12082 A->setImplicit(true);
12083 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12084 A->setAttributeSpellingListIndex(0);
12085 return A;
12086 }
12087
12088 ConsumableAutoCastAttr *ConsumableAutoCastAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12089 auto *A = new (Ctx) ConsumableAutoCastAttr(Ctx, CommonInfo);
12090 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12091 A->setAttributeSpellingListIndex(0);
12092 return A;
12093 }
12094
12095 ConsumableAutoCastAttr *ConsumableAutoCastAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
12096 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12097 switch (S) {
12098 case GNU_consumable_auto_cast_state:
12099 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable_auto_cast_state, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12100 case CXX11_clang_consumable_auto_cast_state:
12101 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable_auto_cast_state, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12102 default:
12103 llvm_unreachable("Unknown attribute spelling!");
12104 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12105 }
12106 }());
12107 return CreateImplicit(Ctx, I);
12108 }
12109
12110 ConsumableAutoCastAttr *ConsumableAutoCastAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
12111 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12112 switch (S) {
12113 case GNU_consumable_auto_cast_state:
12114 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable_auto_cast_state, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12115 case CXX11_clang_consumable_auto_cast_state:
12116 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable_auto_cast_state, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12117 default:
12118 llvm_unreachable("Unknown attribute spelling!");
12119 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12120 }
12121 }());
12122 return Create(Ctx, I);
12123 }
12124
12125 ConsumableAutoCastAttr::ConsumableAutoCastAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
12126 )
12127 : InheritableAttr(Ctx, CommonInfo, attr::ConsumableAutoCast, /*IsLateParsed=*/false, false)
12128 {
12129 }
12130
12131 ConsumableAutoCastAttr *ConsumableAutoCastAttr::clone(ASTContext &C) const {
12132 auto *A = new (C) ConsumableAutoCastAttr(C, *this);
12133 A->Inherited = Inherited;
12134 A->IsPackExpansion = IsPackExpansion;
12135 A->setImplicit(Implicit);
12136 return A;
12137 }
12138
12139 void ConsumableAutoCastAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12140 bool IsFirstArgument = true; (void)IsFirstArgument;
12141 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12142 switch (getAttributeSpellingListIndex()) {
12143 default:
12144 llvm_unreachable("Unknown attribute spelling!");
12145 break;
12146 case 0 : {
12147 OS << "__attribute__((consumable_auto_cast_state";
12148 OS << "))";
12149 break;
12150 }
12151 case 1 : {
12152 OS << "[[clang::consumable_auto_cast_state";
12153 OS << "]]";
12154 break;
12155 }
12156 }
12157 }
12158
12159 const char *ConsumableAutoCastAttr::getSpelling() const {
12160 switch (getAttributeSpellingListIndex()) {
12161 default:
12162 llvm_unreachable("Unknown attribute spelling!");
12163 return "(No spelling)";
12164 case 0:
12165 return "consumable_auto_cast_state";
12166 case 1:
12167 return "consumable_auto_cast_state";
12168 }
12169 }
12170
12171
12172 // ConsumableSetOnReadAttr implementation
12173
12174 ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12175 auto *A = new (Ctx) ConsumableSetOnReadAttr(Ctx, CommonInfo);
12176 A->setImplicit(true);
12177 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12178 A->setAttributeSpellingListIndex(0);
12179 return A;
12180 }
12181
12182 ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12183 auto *A = new (Ctx) ConsumableSetOnReadAttr(Ctx, CommonInfo);
12184 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12185 A->setAttributeSpellingListIndex(0);
12186 return A;
12187 }
12188
12189 ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
12190 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12191 switch (S) {
12192 case GNU_consumable_set_state_on_read:
12193 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable_set_state_on_read, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12194 case CXX11_clang_consumable_set_state_on_read:
12195 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable_set_state_on_read, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12196 default:
12197 llvm_unreachable("Unknown attribute spelling!");
12198 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12199 }
12200 }());
12201 return CreateImplicit(Ctx, I);
12202 }
12203
12204 ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
12205 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12206 switch (S) {
12207 case GNU_consumable_set_state_on_read:
12208 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable_set_state_on_read, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12209 case CXX11_clang_consumable_set_state_on_read:
12210 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable_set_state_on_read, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12211 default:
12212 llvm_unreachable("Unknown attribute spelling!");
12213 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12214 }
12215 }());
12216 return Create(Ctx, I);
12217 }
12218
12219 ConsumableSetOnReadAttr::ConsumableSetOnReadAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
12220 )
12221 : InheritableAttr(Ctx, CommonInfo, attr::ConsumableSetOnRead, /*IsLateParsed=*/false, false)
12222 {
12223 }
12224
12225 ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::clone(ASTContext &C) const {
12226 auto *A = new (C) ConsumableSetOnReadAttr(C, *this);
12227 A->Inherited = Inherited;
12228 A->IsPackExpansion = IsPackExpansion;
12229 A->setImplicit(Implicit);
12230 return A;
12231 }
12232
12233 void ConsumableSetOnReadAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12234 bool IsFirstArgument = true; (void)IsFirstArgument;
12235 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12236 switch (getAttributeSpellingListIndex()) {
12237 default:
12238 llvm_unreachable("Unknown attribute spelling!");
12239 break;
12240 case 0 : {
12241 OS << "__attribute__((consumable_set_state_on_read";
12242 OS << "))";
12243 break;
12244 }
12245 case 1 : {
12246 OS << "[[clang::consumable_set_state_on_read";
12247 OS << "]]";
12248 break;
12249 }
12250 }
12251 }
12252
12253 const char *ConsumableSetOnReadAttr::getSpelling() const {
12254 switch (getAttributeSpellingListIndex()) {
12255 default:
12256 llvm_unreachable("Unknown attribute spelling!");
12257 return "(No spelling)";
12258 case 0:
12259 return "consumable_set_state_on_read";
12260 case 1:
12261 return "consumable_set_state_on_read";
12262 }
12263 }
12264
12265
12266 // ConvergentAttr implementation
12267
12268 ConvergentAttr *ConvergentAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12269 auto *A = new (Ctx) ConvergentAttr(Ctx, CommonInfo);
12270 A->setImplicit(true);
12271 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12272 A->setAttributeSpellingListIndex(0);
12273 return A;
12274 }
12275
12276 ConvergentAttr *ConvergentAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12277 auto *A = new (Ctx) ConvergentAttr(Ctx, CommonInfo);
12278 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12279 A->setAttributeSpellingListIndex(0);
12280 return A;
12281 }
12282
12283 ConvergentAttr *ConvergentAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
12284 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12285 switch (S) {
12286 case GNU_convergent:
12287 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12288 case CXX11_clang_convergent:
12289 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12290 case C23_clang_convergent:
12291 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12292 default:
12293 llvm_unreachable("Unknown attribute spelling!");
12294 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12295 }
12296 }());
12297 return CreateImplicit(Ctx, I);
12298 }
12299
12300 ConvergentAttr *ConvergentAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
12301 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12302 switch (S) {
12303 case GNU_convergent:
12304 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12305 case CXX11_clang_convergent:
12306 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12307 case C23_clang_convergent:
12308 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12309 default:
12310 llvm_unreachable("Unknown attribute spelling!");
12311 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12312 }
12313 }());
12314 return Create(Ctx, I);
12315 }
12316
12317 ConvergentAttr::ConvergentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
12318 )
12319 : InheritableAttr(Ctx, CommonInfo, attr::Convergent, /*IsLateParsed=*/false, false)
12320 {
12321 }
12322
12323 ConvergentAttr *ConvergentAttr::clone(ASTContext &C) const {
12324 auto *A = new (C) ConvergentAttr(C, *this);
12325 A->Inherited = Inherited;
12326 A->IsPackExpansion = IsPackExpansion;
12327 A->setImplicit(Implicit);
12328 return A;
12329 }
12330
12331 void ConvergentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12332 bool IsFirstArgument = true; (void)IsFirstArgument;
12333 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12334 switch (getAttributeSpellingListIndex()) {
12335 default:
12336 llvm_unreachable("Unknown attribute spelling!");
12337 break;
12338 case 0 : {
12339 OS << "__attribute__((convergent";
12340 OS << "))";
12341 break;
12342 }
12343 case 1 : {
12344 OS << "[[clang::convergent";
12345 OS << "]]";
12346 break;
12347 }
12348 case 2 : {
12349 OS << "[[clang::convergent";
12350 OS << "]]";
12351 break;
12352 }
12353 }
12354 }
12355
12356 const char *ConvergentAttr::getSpelling() const {
12357 switch (getAttributeSpellingListIndex()) {
12358 default:
12359 llvm_unreachable("Unknown attribute spelling!");
12360 return "(No spelling)";
12361 case 0:
12362 return "convergent";
12363 case 1:
12364 return "convergent";
12365 case 2:
12366 return "convergent";
12367 }
12368 }
12369
12370
12371 // CoroAwaitElidableAttr implementation
12372
12373 CoroAwaitElidableAttr *CoroAwaitElidableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12374 auto *A = new (Ctx) CoroAwaitElidableAttr(Ctx, CommonInfo);
12375 A->setImplicit(true);
12376 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12377 A->setAttributeSpellingListIndex(0);
12378 return A;
12379 }
12380
12381 CoroAwaitElidableAttr *CoroAwaitElidableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12382 auto *A = new (Ctx) CoroAwaitElidableAttr(Ctx, CommonInfo);
12383 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12384 A->setAttributeSpellingListIndex(0);
12385 return A;
12386 }
12387
12388 CoroAwaitElidableAttr *CoroAwaitElidableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
12389 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12390 switch (S) {
12391 case GNU_coro_await_elidable:
12392 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_await_elidable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12393 case CXX11_clang_coro_await_elidable:
12394 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_await_elidable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12395 case C23_clang_coro_await_elidable:
12396 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_await_elidable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12397 default:
12398 llvm_unreachable("Unknown attribute spelling!");
12399 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12400 }
12401 }());
12402 return CreateImplicit(Ctx, I);
12403 }
12404
12405 CoroAwaitElidableAttr *CoroAwaitElidableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
12406 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12407 switch (S) {
12408 case GNU_coro_await_elidable:
12409 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_await_elidable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12410 case CXX11_clang_coro_await_elidable:
12411 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_await_elidable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12412 case C23_clang_coro_await_elidable:
12413 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_await_elidable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12414 default:
12415 llvm_unreachable("Unknown attribute spelling!");
12416 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12417 }
12418 }());
12419 return Create(Ctx, I);
12420 }
12421
12422 CoroAwaitElidableAttr::CoroAwaitElidableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
12423 )
12424 : InheritableAttr(Ctx, CommonInfo, attr::CoroAwaitElidable, /*IsLateParsed=*/false, false)
12425 {
12426 }
12427
12428 CoroAwaitElidableAttr *CoroAwaitElidableAttr::clone(ASTContext &C) const {
12429 auto *A = new (C) CoroAwaitElidableAttr(C, *this);
12430 A->Inherited = Inherited;
12431 A->IsPackExpansion = IsPackExpansion;
12432 A->setImplicit(Implicit);
12433 return A;
12434 }
12435
12436 void CoroAwaitElidableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12437 bool IsFirstArgument = true; (void)IsFirstArgument;
12438 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12439 switch (getAttributeSpellingListIndex()) {
12440 default:
12441 llvm_unreachable("Unknown attribute spelling!");
12442 break;
12443 case 0 : {
12444 OS << "__attribute__((coro_await_elidable";
12445 OS << "))";
12446 break;
12447 }
12448 case 1 : {
12449 OS << "[[clang::coro_await_elidable";
12450 OS << "]]";
12451 break;
12452 }
12453 case 2 : {
12454 OS << "[[clang::coro_await_elidable";
12455 OS << "]]";
12456 break;
12457 }
12458 }
12459 }
12460
12461 const char *CoroAwaitElidableAttr::getSpelling() const {
12462 switch (getAttributeSpellingListIndex()) {
12463 default:
12464 llvm_unreachable("Unknown attribute spelling!");
12465 return "(No spelling)";
12466 case 0:
12467 return "coro_await_elidable";
12468 case 1:
12469 return "coro_await_elidable";
12470 case 2:
12471 return "coro_await_elidable";
12472 }
12473 }
12474
12475
12476 // CoroAwaitElidableArgumentAttr implementation
12477
12478 CoroAwaitElidableArgumentAttr *CoroAwaitElidableArgumentAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12479 auto *A = new (Ctx) CoroAwaitElidableArgumentAttr(Ctx, CommonInfo);
12480 A->setImplicit(true);
12481 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12482 A->setAttributeSpellingListIndex(0);
12483 return A;
12484 }
12485
12486 CoroAwaitElidableArgumentAttr *CoroAwaitElidableArgumentAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12487 auto *A = new (Ctx) CoroAwaitElidableArgumentAttr(Ctx, CommonInfo);
12488 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12489 A->setAttributeSpellingListIndex(0);
12490 return A;
12491 }
12492
12493 CoroAwaitElidableArgumentAttr *CoroAwaitElidableArgumentAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
12494 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12495 switch (S) {
12496 case GNU_coro_await_elidable_argument:
12497 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_await_elidable_argument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12498 case CXX11_clang_coro_await_elidable_argument:
12499 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_await_elidable_argument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12500 case C23_clang_coro_await_elidable_argument:
12501 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_await_elidable_argument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12502 default:
12503 llvm_unreachable("Unknown attribute spelling!");
12504 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12505 }
12506 }());
12507 return CreateImplicit(Ctx, I);
12508 }
12509
12510 CoroAwaitElidableArgumentAttr *CoroAwaitElidableArgumentAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
12511 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12512 switch (S) {
12513 case GNU_coro_await_elidable_argument:
12514 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_await_elidable_argument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12515 case CXX11_clang_coro_await_elidable_argument:
12516 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_await_elidable_argument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12517 case C23_clang_coro_await_elidable_argument:
12518 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_await_elidable_argument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12519 default:
12520 llvm_unreachable("Unknown attribute spelling!");
12521 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12522 }
12523 }());
12524 return Create(Ctx, I);
12525 }
12526
12527 CoroAwaitElidableArgumentAttr::CoroAwaitElidableArgumentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
12528 )
12529 : InheritableAttr(Ctx, CommonInfo, attr::CoroAwaitElidableArgument, /*IsLateParsed=*/false, false)
12530 {
12531 }
12532
12533 CoroAwaitElidableArgumentAttr *CoroAwaitElidableArgumentAttr::clone(ASTContext &C) const {
12534 auto *A = new (C) CoroAwaitElidableArgumentAttr(C, *this);
12535 A->Inherited = Inherited;
12536 A->IsPackExpansion = IsPackExpansion;
12537 A->setImplicit(Implicit);
12538 return A;
12539 }
12540
12541 void CoroAwaitElidableArgumentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12542 bool IsFirstArgument = true; (void)IsFirstArgument;
12543 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12544 switch (getAttributeSpellingListIndex()) {
12545 default:
12546 llvm_unreachable("Unknown attribute spelling!");
12547 break;
12548 case 0 : {
12549 OS << "__attribute__((coro_await_elidable_argument";
12550 OS << "))";
12551 break;
12552 }
12553 case 1 : {
12554 OS << "[[clang::coro_await_elidable_argument";
12555 OS << "]]";
12556 break;
12557 }
12558 case 2 : {
12559 OS << "[[clang::coro_await_elidable_argument";
12560 OS << "]]";
12561 break;
12562 }
12563 }
12564 }
12565
12566 const char *CoroAwaitElidableArgumentAttr::getSpelling() const {
12567 switch (getAttributeSpellingListIndex()) {
12568 default:
12569 llvm_unreachable("Unknown attribute spelling!");
12570 return "(No spelling)";
12571 case 0:
12572 return "coro_await_elidable_argument";
12573 case 1:
12574 return "coro_await_elidable_argument";
12575 case 2:
12576 return "coro_await_elidable_argument";
12577 }
12578 }
12579
12580
12581 // CoroDisableLifetimeBoundAttr implementation
12582
12583 CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12584 auto *A = new (Ctx) CoroDisableLifetimeBoundAttr(Ctx, CommonInfo);
12585 A->setImplicit(true);
12586 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12587 A->setAttributeSpellingListIndex(0);
12588 return A;
12589 }
12590
12591 CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12592 auto *A = new (Ctx) CoroDisableLifetimeBoundAttr(Ctx, CommonInfo);
12593 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12594 A->setAttributeSpellingListIndex(0);
12595 return A;
12596 }
12597
12598 CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
12599 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12600 switch (S) {
12601 case GNU_coro_disable_lifetimebound:
12602 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12603 case CXX11_clang_coro_disable_lifetimebound:
12604 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12605 case C23_clang_coro_disable_lifetimebound:
12606 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12607 default:
12608 llvm_unreachable("Unknown attribute spelling!");
12609 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12610 }
12611 }());
12612 return CreateImplicit(Ctx, I);
12613 }
12614
12615 CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
12616 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12617 switch (S) {
12618 case GNU_coro_disable_lifetimebound:
12619 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12620 case CXX11_clang_coro_disable_lifetimebound:
12621 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12622 case C23_clang_coro_disable_lifetimebound:
12623 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12624 default:
12625 llvm_unreachable("Unknown attribute spelling!");
12626 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12627 }
12628 }());
12629 return Create(Ctx, I);
12630 }
12631
12632 CoroDisableLifetimeBoundAttr::CoroDisableLifetimeBoundAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
12633 )
12634 : InheritableAttr(Ctx, CommonInfo, attr::CoroDisableLifetimeBound, /*IsLateParsed=*/false, false)
12635 {
12636 }
12637
12638 CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::clone(ASTContext &C) const {
12639 auto *A = new (C) CoroDisableLifetimeBoundAttr(C, *this);
12640 A->Inherited = Inherited;
12641 A->IsPackExpansion = IsPackExpansion;
12642 A->setImplicit(Implicit);
12643 return A;
12644 }
12645
12646 void CoroDisableLifetimeBoundAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12647 bool IsFirstArgument = true; (void)IsFirstArgument;
12648 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12649 switch (getAttributeSpellingListIndex()) {
12650 default:
12651 llvm_unreachable("Unknown attribute spelling!");
12652 break;
12653 case 0 : {
12654 OS << "__attribute__((coro_disable_lifetimebound";
12655 OS << "))";
12656 break;
12657 }
12658 case 1 : {
12659 OS << "[[clang::coro_disable_lifetimebound";
12660 OS << "]]";
12661 break;
12662 }
12663 case 2 : {
12664 OS << "[[clang::coro_disable_lifetimebound";
12665 OS << "]]";
12666 break;
12667 }
12668 }
12669 }
12670
12671 const char *CoroDisableLifetimeBoundAttr::getSpelling() const {
12672 switch (getAttributeSpellingListIndex()) {
12673 default:
12674 llvm_unreachable("Unknown attribute spelling!");
12675 return "(No spelling)";
12676 case 0:
12677 return "coro_disable_lifetimebound";
12678 case 1:
12679 return "coro_disable_lifetimebound";
12680 case 2:
12681 return "coro_disable_lifetimebound";
12682 }
12683 }
12684
12685
12686 // CoroLifetimeBoundAttr implementation
12687
12688 CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12689 auto *A = new (Ctx) CoroLifetimeBoundAttr(Ctx, CommonInfo);
12690 A->setImplicit(true);
12691 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12692 A->setAttributeSpellingListIndex(0);
12693 return A;
12694 }
12695
12696 CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12697 auto *A = new (Ctx) CoroLifetimeBoundAttr(Ctx, CommonInfo);
12698 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12699 A->setAttributeSpellingListIndex(0);
12700 return A;
12701 }
12702
12703 CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
12704 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12705 switch (S) {
12706 case GNU_coro_lifetimebound:
12707 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12708 case CXX11_clang_coro_lifetimebound:
12709 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12710 case C23_clang_coro_lifetimebound:
12711 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12712 default:
12713 llvm_unreachable("Unknown attribute spelling!");
12714 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12715 }
12716 }());
12717 return CreateImplicit(Ctx, I);
12718 }
12719
12720 CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
12721 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12722 switch (S) {
12723 case GNU_coro_lifetimebound:
12724 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12725 case CXX11_clang_coro_lifetimebound:
12726 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12727 case C23_clang_coro_lifetimebound:
12728 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12729 default:
12730 llvm_unreachable("Unknown attribute spelling!");
12731 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12732 }
12733 }());
12734 return Create(Ctx, I);
12735 }
12736
12737 CoroLifetimeBoundAttr::CoroLifetimeBoundAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
12738 )
12739 : InheritableAttr(Ctx, CommonInfo, attr::CoroLifetimeBound, /*IsLateParsed=*/false, false)
12740 {
12741 }
12742
12743 CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::clone(ASTContext &C) const {
12744 auto *A = new (C) CoroLifetimeBoundAttr(C, *this);
12745 A->Inherited = Inherited;
12746 A->IsPackExpansion = IsPackExpansion;
12747 A->setImplicit(Implicit);
12748 return A;
12749 }
12750
12751 void CoroLifetimeBoundAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12752 bool IsFirstArgument = true; (void)IsFirstArgument;
12753 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12754 switch (getAttributeSpellingListIndex()) {
12755 default:
12756 llvm_unreachable("Unknown attribute spelling!");
12757 break;
12758 case 0 : {
12759 OS << "__attribute__((coro_lifetimebound";
12760 OS << "))";
12761 break;
12762 }
12763 case 1 : {
12764 OS << "[[clang::coro_lifetimebound";
12765 OS << "]]";
12766 break;
12767 }
12768 case 2 : {
12769 OS << "[[clang::coro_lifetimebound";
12770 OS << "]]";
12771 break;
12772 }
12773 }
12774 }
12775
12776 const char *CoroLifetimeBoundAttr::getSpelling() const {
12777 switch (getAttributeSpellingListIndex()) {
12778 default:
12779 llvm_unreachable("Unknown attribute spelling!");
12780 return "(No spelling)";
12781 case 0:
12782 return "coro_lifetimebound";
12783 case 1:
12784 return "coro_lifetimebound";
12785 case 2:
12786 return "coro_lifetimebound";
12787 }
12788 }
12789
12790
12791 // CoroOnlyDestroyWhenCompleteAttr implementation
12792
12793 CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12794 auto *A = new (Ctx) CoroOnlyDestroyWhenCompleteAttr(Ctx, CommonInfo);
12795 A->setImplicit(true);
12796 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12797 A->setAttributeSpellingListIndex(0);
12798 return A;
12799 }
12800
12801 CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12802 auto *A = new (Ctx) CoroOnlyDestroyWhenCompleteAttr(Ctx, CommonInfo);
12803 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12804 A->setAttributeSpellingListIndex(0);
12805 return A;
12806 }
12807
12808 CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
12809 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12810 switch (S) {
12811 case GNU_coro_only_destroy_when_complete:
12812 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12813 case CXX11_clang_coro_only_destroy_when_complete:
12814 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12815 case C23_clang_coro_only_destroy_when_complete:
12816 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12817 default:
12818 llvm_unreachable("Unknown attribute spelling!");
12819 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12820 }
12821 }());
12822 return CreateImplicit(Ctx, I);
12823 }
12824
12825 CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
12826 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12827 switch (S) {
12828 case GNU_coro_only_destroy_when_complete:
12829 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12830 case CXX11_clang_coro_only_destroy_when_complete:
12831 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12832 case C23_clang_coro_only_destroy_when_complete:
12833 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12834 default:
12835 llvm_unreachable("Unknown attribute spelling!");
12836 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12837 }
12838 }());
12839 return Create(Ctx, I);
12840 }
12841
12842 CoroOnlyDestroyWhenCompleteAttr::CoroOnlyDestroyWhenCompleteAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
12843 )
12844 : InheritableAttr(Ctx, CommonInfo, attr::CoroOnlyDestroyWhenComplete, /*IsLateParsed=*/false, false)
12845 {
12846 }
12847
12848 CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::clone(ASTContext &C) const {
12849 auto *A = new (C) CoroOnlyDestroyWhenCompleteAttr(C, *this);
12850 A->Inherited = Inherited;
12851 A->IsPackExpansion = IsPackExpansion;
12852 A->setImplicit(Implicit);
12853 return A;
12854 }
12855
12856 void CoroOnlyDestroyWhenCompleteAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12857 bool IsFirstArgument = true; (void)IsFirstArgument;
12858 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12859 switch (getAttributeSpellingListIndex()) {
12860 default:
12861 llvm_unreachable("Unknown attribute spelling!");
12862 break;
12863 case 0 : {
12864 OS << "__attribute__((coro_only_destroy_when_complete";
12865 OS << "))";
12866 break;
12867 }
12868 case 1 : {
12869 OS << "[[clang::coro_only_destroy_when_complete";
12870 OS << "]]";
12871 break;
12872 }
12873 case 2 : {
12874 OS << "[[clang::coro_only_destroy_when_complete";
12875 OS << "]]";
12876 break;
12877 }
12878 }
12879 }
12880
12881 const char *CoroOnlyDestroyWhenCompleteAttr::getSpelling() const {
12882 switch (getAttributeSpellingListIndex()) {
12883 default:
12884 llvm_unreachable("Unknown attribute spelling!");
12885 return "(No spelling)";
12886 case 0:
12887 return "coro_only_destroy_when_complete";
12888 case 1:
12889 return "coro_only_destroy_when_complete";
12890 case 2:
12891 return "coro_only_destroy_when_complete";
12892 }
12893 }
12894
12895
12896 // CoroReturnTypeAttr implementation
12897
12898 CoroReturnTypeAttr *CoroReturnTypeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12899 auto *A = new (Ctx) CoroReturnTypeAttr(Ctx, CommonInfo);
12900 A->setImplicit(true);
12901 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12902 A->setAttributeSpellingListIndex(0);
12903 return A;
12904 }
12905
12906 CoroReturnTypeAttr *CoroReturnTypeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
12907 auto *A = new (Ctx) CoroReturnTypeAttr(Ctx, CommonInfo);
12908 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
12909 A->setAttributeSpellingListIndex(0);
12910 return A;
12911 }
12912
12913 CoroReturnTypeAttr *CoroReturnTypeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
12914 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12915 switch (S) {
12916 case GNU_coro_return_type:
12917 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12918 case CXX11_clang_coro_return_type:
12919 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12920 case C23_clang_coro_return_type:
12921 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12922 default:
12923 llvm_unreachable("Unknown attribute spelling!");
12924 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12925 }
12926 }());
12927 return CreateImplicit(Ctx, I);
12928 }
12929
12930 CoroReturnTypeAttr *CoroReturnTypeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
12931 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
12932 switch (S) {
12933 case GNU_coro_return_type:
12934 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12935 case CXX11_clang_coro_return_type:
12936 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12937 case C23_clang_coro_return_type:
12938 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12939 default:
12940 llvm_unreachable("Unknown attribute spelling!");
12941 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
12942 }
12943 }());
12944 return Create(Ctx, I);
12945 }
12946
12947 CoroReturnTypeAttr::CoroReturnTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
12948 )
12949 : InheritableAttr(Ctx, CommonInfo, attr::CoroReturnType, /*IsLateParsed=*/false, false)
12950 {
12951 }
12952
12953 CoroReturnTypeAttr *CoroReturnTypeAttr::clone(ASTContext &C) const {
12954 auto *A = new (C) CoroReturnTypeAttr(C, *this);
12955 A->Inherited = Inherited;
12956 A->IsPackExpansion = IsPackExpansion;
12957 A->setImplicit(Implicit);
12958 return A;
12959 }
12960
12961 void CoroReturnTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
12962 bool IsFirstArgument = true; (void)IsFirstArgument;
12963 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
12964 switch (getAttributeSpellingListIndex()) {
12965 default:
12966 llvm_unreachable("Unknown attribute spelling!");
12967 break;
12968 case 0 : {
12969 OS << "__attribute__((coro_return_type";
12970 OS << "))";
12971 break;
12972 }
12973 case 1 : {
12974 OS << "[[clang::coro_return_type";
12975 OS << "]]";
12976 break;
12977 }
12978 case 2 : {
12979 OS << "[[clang::coro_return_type";
12980 OS << "]]";
12981 break;
12982 }
12983 }
12984 }
12985
12986 const char *CoroReturnTypeAttr::getSpelling() const {
12987 switch (getAttributeSpellingListIndex()) {
12988 default:
12989 llvm_unreachable("Unknown attribute spelling!");
12990 return "(No spelling)";
12991 case 0:
12992 return "coro_return_type";
12993 case 1:
12994 return "coro_return_type";
12995 case 2:
12996 return "coro_return_type";
12997 }
12998 }
12999
13000
13001 // CoroWrapperAttr implementation
13002
13003 CoroWrapperAttr *CoroWrapperAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13004 auto *A = new (Ctx) CoroWrapperAttr(Ctx, CommonInfo);
13005 A->setImplicit(true);
13006 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13007 A->setAttributeSpellingListIndex(0);
13008 return A;
13009 }
13010
13011 CoroWrapperAttr *CoroWrapperAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13012 auto *A = new (Ctx) CoroWrapperAttr(Ctx, CommonInfo);
13013 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13014 A->setAttributeSpellingListIndex(0);
13015 return A;
13016 }
13017
13018 CoroWrapperAttr *CoroWrapperAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
13019 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13020 switch (S) {
13021 case GNU_coro_wrapper:
13022 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13023 case CXX11_clang_coro_wrapper:
13024 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13025 case C23_clang_coro_wrapper:
13026 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13027 default:
13028 llvm_unreachable("Unknown attribute spelling!");
13029 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13030 }
13031 }());
13032 return CreateImplicit(Ctx, I);
13033 }
13034
13035 CoroWrapperAttr *CoroWrapperAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
13036 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13037 switch (S) {
13038 case GNU_coro_wrapper:
13039 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13040 case CXX11_clang_coro_wrapper:
13041 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13042 case C23_clang_coro_wrapper:
13043 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13044 default:
13045 llvm_unreachable("Unknown attribute spelling!");
13046 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13047 }
13048 }());
13049 return Create(Ctx, I);
13050 }
13051
13052 CoroWrapperAttr::CoroWrapperAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13053 )
13054 : InheritableAttr(Ctx, CommonInfo, attr::CoroWrapper, /*IsLateParsed=*/false, false)
13055 {
13056 }
13057
13058 CoroWrapperAttr *CoroWrapperAttr::clone(ASTContext &C) const {
13059 auto *A = new (C) CoroWrapperAttr(C, *this);
13060 A->Inherited = Inherited;
13061 A->IsPackExpansion = IsPackExpansion;
13062 A->setImplicit(Implicit);
13063 return A;
13064 }
13065
13066 void CoroWrapperAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
13067 bool IsFirstArgument = true; (void)IsFirstArgument;
13068 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
13069 switch (getAttributeSpellingListIndex()) {
13070 default:
13071 llvm_unreachable("Unknown attribute spelling!");
13072 break;
13073 case 0 : {
13074 OS << "__attribute__((coro_wrapper";
13075 OS << "))";
13076 break;
13077 }
13078 case 1 : {
13079 OS << "[[clang::coro_wrapper";
13080 OS << "]]";
13081 break;
13082 }
13083 case 2 : {
13084 OS << "[[clang::coro_wrapper";
13085 OS << "]]";
13086 break;
13087 }
13088 }
13089 }
13090
13091 const char *CoroWrapperAttr::getSpelling() const {
13092 switch (getAttributeSpellingListIndex()) {
13093 default:
13094 llvm_unreachable("Unknown attribute spelling!");
13095 return "(No spelling)";
13096 case 0:
13097 return "coro_wrapper";
13098 case 1:
13099 return "coro_wrapper";
13100 case 2:
13101 return "coro_wrapper";
13102 }
13103 }
13104
13105
13106 // CountedByAttr implementation
13107
13108 CountedByAttr *CountedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Count, int NestedLevel, const AttributeCommonInfo &CommonInfo) {
13109 auto *A = new (Ctx) CountedByAttr(Ctx, CommonInfo, Count, NestedLevel);
13110 A->setImplicit(true);
13111 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13112 A->setAttributeSpellingListIndex(0);
13113 return A;
13114 }
13115
13116 CountedByAttr *CountedByAttr::Create(ASTContext &Ctx, Expr * Count, int NestedLevel, const AttributeCommonInfo &CommonInfo) {
13117 auto *A = new (Ctx) CountedByAttr(Ctx, CommonInfo, Count, NestedLevel);
13118 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13119 A->setAttributeSpellingListIndex(0);
13120 return A;
13121 }
13122
13123 CountedByAttr *CountedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Count, int NestedLevel, SourceRange Range, Spelling S) {
13124 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13125 switch (S) {
13126 case GNU_counted_by:
13127 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13128 case CXX11_clang_counted_by:
13129 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13130 case C23_clang_counted_by:
13131 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13132 default:
13133 llvm_unreachable("Unknown attribute spelling!");
13134 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13135 }
13136 }());
13137 return CreateImplicit(Ctx, Count, NestedLevel, I);
13138 }
13139
13140 CountedByAttr *CountedByAttr::Create(ASTContext &Ctx, Expr * Count, int NestedLevel, SourceRange Range, Spelling S) {
13141 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13142 switch (S) {
13143 case GNU_counted_by:
13144 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13145 case CXX11_clang_counted_by:
13146 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13147 case C23_clang_counted_by:
13148 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13149 default:
13150 llvm_unreachable("Unknown attribute spelling!");
13151 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13152 }
13153 }());
13154 return Create(Ctx, Count, NestedLevel, I);
13155 }
13156
13157 CountedByAttr::CountedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13158 , Expr * Count
13159 , int NestedLevel
13160 )
13161 : InheritableAttr(Ctx, CommonInfo, attr::CountedBy, /*IsLateParsed=*/true, false)
13162 , count(Count)
13163 , nestedLevel(NestedLevel)
13164 {
13165 }
13166
13167 CountedByAttr::CountedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13168 , Expr * Count
13169 )
13170 : InheritableAttr(Ctx, CommonInfo, attr::CountedBy, /*IsLateParsed=*/true, false)
13171 , count(Count)
13172 , nestedLevel()
13173 {
13174 }
13175
13176
13177
13178
13179
13180 CountedByAttr *CountedByAttr::clone(ASTContext &C) const {
13181 auto *A = new (C) CountedByAttr(C, *this, count, nestedLevel);
13182 A->Inherited = Inherited;
13183 A->IsPackExpansion = IsPackExpansion;
13184 A->setImplicit(Implicit);
13185 return A;
13186 }
13187
13188 void CountedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
13189 bool IsFirstArgument = true; (void)IsFirstArgument;
13190 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
13191 switch (getAttributeSpellingListIndex()) {
13192 default:
13193 llvm_unreachable("Unknown attribute spelling!");
13194 break;
13195 case 0 : {
13196 OS << "__attribute__((counted_by";
13197 DelimitAttributeArgument(OS, IsFirstArgument);
13198 OS << "";
13199 getCount()->printPretty(OS, nullptr, Policy);
13200 OS << "";
13201 DelimitAttributeArgument(OS, IsFirstArgument);
13202 OS << "" << getNestedLevel() << "";
13203 if (!IsFirstArgument)
13204 OS << ")";
13205 OS << "))";
13206 break;
13207 }
13208 case 1 : {
13209 OS << "[[clang::counted_by";
13210 DelimitAttributeArgument(OS, IsFirstArgument);
13211 OS << "";
13212 getCount()->printPretty(OS, nullptr, Policy);
13213 OS << "";
13214 DelimitAttributeArgument(OS, IsFirstArgument);
13215 OS << "" << getNestedLevel() << "";
13216 if (!IsFirstArgument)
13217 OS << ")";
13218 OS << "]]";
13219 break;
13220 }
13221 case 2 : {
13222 OS << "[[clang::counted_by";
13223 DelimitAttributeArgument(OS, IsFirstArgument);
13224 OS << "";
13225 getCount()->printPretty(OS, nullptr, Policy);
13226 OS << "";
13227 DelimitAttributeArgument(OS, IsFirstArgument);
13228 OS << "" << getNestedLevel() << "";
13229 if (!IsFirstArgument)
13230 OS << ")";
13231 OS << "]]";
13232 break;
13233 }
13234 }
13235 }
13236
13237 const char *CountedByAttr::getSpelling() const {
13238 switch (getAttributeSpellingListIndex()) {
13239 default:
13240 llvm_unreachable("Unknown attribute spelling!");
13241 return "(No spelling)";
13242 case 0:
13243 return "counted_by";
13244 case 1:
13245 return "counted_by";
13246 case 2:
13247 return "counted_by";
13248 }
13249 }
13250
13251
13252 // CountedByOrNullAttr implementation
13253
13254 CountedByOrNullAttr *CountedByOrNullAttr::CreateImplicit(ASTContext &Ctx, Expr * Count, int NestedLevel, const AttributeCommonInfo &CommonInfo) {
13255 auto *A = new (Ctx) CountedByOrNullAttr(Ctx, CommonInfo, Count, NestedLevel);
13256 A->setImplicit(true);
13257 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13258 A->setAttributeSpellingListIndex(0);
13259 return A;
13260 }
13261
13262 CountedByOrNullAttr *CountedByOrNullAttr::Create(ASTContext &Ctx, Expr * Count, int NestedLevel, const AttributeCommonInfo &CommonInfo) {
13263 auto *A = new (Ctx) CountedByOrNullAttr(Ctx, CommonInfo, Count, NestedLevel);
13264 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13265 A->setAttributeSpellingListIndex(0);
13266 return A;
13267 }
13268
13269 CountedByOrNullAttr *CountedByOrNullAttr::CreateImplicit(ASTContext &Ctx, Expr * Count, int NestedLevel, SourceRange Range, Spelling S) {
13270 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13271 switch (S) {
13272 case GNU_counted_by_or_null:
13273 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13274 case CXX11_clang_counted_by_or_null:
13275 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13276 case C23_clang_counted_by_or_null:
13277 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13278 default:
13279 llvm_unreachable("Unknown attribute spelling!");
13280 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13281 }
13282 }());
13283 return CreateImplicit(Ctx, Count, NestedLevel, I);
13284 }
13285
13286 CountedByOrNullAttr *CountedByOrNullAttr::Create(ASTContext &Ctx, Expr * Count, int NestedLevel, SourceRange Range, Spelling S) {
13287 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13288 switch (S) {
13289 case GNU_counted_by_or_null:
13290 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13291 case CXX11_clang_counted_by_or_null:
13292 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13293 case C23_clang_counted_by_or_null:
13294 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13295 default:
13296 llvm_unreachable("Unknown attribute spelling!");
13297 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13298 }
13299 }());
13300 return Create(Ctx, Count, NestedLevel, I);
13301 }
13302
13303 CountedByOrNullAttr::CountedByOrNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13304 , Expr * Count
13305 , int NestedLevel
13306 )
13307 : InheritableAttr(Ctx, CommonInfo, attr::CountedByOrNull, /*IsLateParsed=*/true, false)
13308 , count(Count)
13309 , nestedLevel(NestedLevel)
13310 {
13311 }
13312
13313 CountedByOrNullAttr::CountedByOrNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13314 , Expr * Count
13315 )
13316 : InheritableAttr(Ctx, CommonInfo, attr::CountedByOrNull, /*IsLateParsed=*/true, false)
13317 , count(Count)
13318 , nestedLevel()
13319 {
13320 }
13321
13322
13323
13324
13325
13326 CountedByOrNullAttr *CountedByOrNullAttr::clone(ASTContext &C) const {
13327 auto *A = new (C) CountedByOrNullAttr(C, *this, count, nestedLevel);
13328 A->Inherited = Inherited;
13329 A->IsPackExpansion = IsPackExpansion;
13330 A->setImplicit(Implicit);
13331 return A;
13332 }
13333
13334 void CountedByOrNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
13335 bool IsFirstArgument = true; (void)IsFirstArgument;
13336 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
13337 switch (getAttributeSpellingListIndex()) {
13338 default:
13339 llvm_unreachable("Unknown attribute spelling!");
13340 break;
13341 case 0 : {
13342 OS << "__attribute__((counted_by_or_null";
13343 DelimitAttributeArgument(OS, IsFirstArgument);
13344 OS << "";
13345 getCount()->printPretty(OS, nullptr, Policy);
13346 OS << "";
13347 DelimitAttributeArgument(OS, IsFirstArgument);
13348 OS << "" << getNestedLevel() << "";
13349 if (!IsFirstArgument)
13350 OS << ")";
13351 OS << "))";
13352 break;
13353 }
13354 case 1 : {
13355 OS << "[[clang::counted_by_or_null";
13356 DelimitAttributeArgument(OS, IsFirstArgument);
13357 OS << "";
13358 getCount()->printPretty(OS, nullptr, Policy);
13359 OS << "";
13360 DelimitAttributeArgument(OS, IsFirstArgument);
13361 OS << "" << getNestedLevel() << "";
13362 if (!IsFirstArgument)
13363 OS << ")";
13364 OS << "]]";
13365 break;
13366 }
13367 case 2 : {
13368 OS << "[[clang::counted_by_or_null";
13369 DelimitAttributeArgument(OS, IsFirstArgument);
13370 OS << "";
13371 getCount()->printPretty(OS, nullptr, Policy);
13372 OS << "";
13373 DelimitAttributeArgument(OS, IsFirstArgument);
13374 OS << "" << getNestedLevel() << "";
13375 if (!IsFirstArgument)
13376 OS << ")";
13377 OS << "]]";
13378 break;
13379 }
13380 }
13381 }
13382
13383 const char *CountedByOrNullAttr::getSpelling() const {
13384 switch (getAttributeSpellingListIndex()) {
13385 default:
13386 llvm_unreachable("Unknown attribute spelling!");
13387 return "(No spelling)";
13388 case 0:
13389 return "counted_by_or_null";
13390 case 1:
13391 return "counted_by_or_null";
13392 case 2:
13393 return "counted_by_or_null";
13394 }
13395 }
13396
13397
13398 // DLLExportAttr implementation
13399
13400 DLLExportAttr *DLLExportAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13401 auto *A = new (Ctx) DLLExportAttr(Ctx, CommonInfo);
13402 A->setImplicit(true);
13403 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13404 A->setAttributeSpellingListIndex(0);
13405 return A;
13406 }
13407
13408 DLLExportAttr *DLLExportAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13409 auto *A = new (Ctx) DLLExportAttr(Ctx, CommonInfo);
13410 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13411 A->setAttributeSpellingListIndex(0);
13412 return A;
13413 }
13414
13415 DLLExportAttr *DLLExportAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
13416 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13417 switch (S) {
13418 case Declspec_dllexport:
13419 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13420 case GNU_dllexport:
13421 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13422 case CXX11_gnu_dllexport:
13423 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13424 case C23_gnu_dllexport:
13425 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13426 default:
13427 llvm_unreachable("Unknown attribute spelling!");
13428 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13429 }
13430 }());
13431 return CreateImplicit(Ctx, I);
13432 }
13433
13434 DLLExportAttr *DLLExportAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
13435 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13436 switch (S) {
13437 case Declspec_dllexport:
13438 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13439 case GNU_dllexport:
13440 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13441 case CXX11_gnu_dllexport:
13442 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13443 case C23_gnu_dllexport:
13444 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13445 default:
13446 llvm_unreachable("Unknown attribute spelling!");
13447 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13448 }
13449 }());
13450 return Create(Ctx, I);
13451 }
13452
13453 DLLExportAttr::DLLExportAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13454 )
13455 : InheritableAttr(Ctx, CommonInfo, attr::DLLExport, /*IsLateParsed=*/false, false)
13456 {
13457 }
13458
13459 DLLExportAttr *DLLExportAttr::clone(ASTContext &C) const {
13460 auto *A = new (C) DLLExportAttr(C, *this);
13461 A->Inherited = Inherited;
13462 A->IsPackExpansion = IsPackExpansion;
13463 A->setImplicit(Implicit);
13464 return A;
13465 }
13466
13467 void DLLExportAttr::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 << "__declspec(dllexport";
13476 OS << ")";
13477 break;
13478 }
13479 case 1 : {
13480 OS << "__attribute__((dllexport";
13481 OS << "))";
13482 break;
13483 }
13484 case 2 : {
13485 OS << "[[gnu::dllexport";
13486 OS << "]]";
13487 break;
13488 }
13489 case 3 : {
13490 OS << "[[gnu::dllexport";
13491 OS << "]]";
13492 break;
13493 }
13494 }
13495 }
13496
13497 const char *DLLExportAttr::getSpelling() const {
13498 switch (getAttributeSpellingListIndex()) {
13499 default:
13500 llvm_unreachable("Unknown attribute spelling!");
13501 return "(No spelling)";
13502 case 0:
13503 return "dllexport";
13504 case 1:
13505 return "dllexport";
13506 case 2:
13507 return "dllexport";
13508 case 3:
13509 return "dllexport";
13510 }
13511 }
13512
13513
13514 // DLLExportStaticLocalAttr implementation
13515
13516 DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13517 auto *A = new (Ctx) DLLExportStaticLocalAttr(Ctx, CommonInfo);
13518 A->setImplicit(true);
13519 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13520 A->setAttributeSpellingListIndex(0);
13521 return A;
13522 }
13523
13524 DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13525 auto *A = new (Ctx) DLLExportStaticLocalAttr(Ctx, CommonInfo);
13526 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13527 A->setAttributeSpellingListIndex(0);
13528 return A;
13529 }
13530
13531 DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
13532 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
13533 return CreateImplicit(Ctx, I);
13534 }
13535
13536 DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::Create(ASTContext &Ctx, SourceRange Range) {
13537 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
13538 return Create(Ctx, I);
13539 }
13540
13541 DLLExportStaticLocalAttr::DLLExportStaticLocalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13542 )
13543 : InheritableAttr(Ctx, CommonInfo, attr::DLLExportStaticLocal, /*IsLateParsed=*/false, false)
13544 {
13545 }
13546
13547 DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::clone(ASTContext &C) const {
13548 auto *A = new (C) DLLExportStaticLocalAttr(C, *this);
13549 A->Inherited = Inherited;
13550 A->IsPackExpansion = IsPackExpansion;
13551 A->setImplicit(Implicit);
13552 return A;
13553 }
13554
13555 void DLLExportStaticLocalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
13556 }
13557
13558 const char *DLLExportStaticLocalAttr::getSpelling() const {
13559 return "(No spelling)";
13560 }
13561
13562
13563 // DLLImportAttr implementation
13564
13565 DLLImportAttr *DLLImportAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13566 auto *A = new (Ctx) DLLImportAttr(Ctx, CommonInfo);
13567 A->setImplicit(true);
13568 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13569 A->setAttributeSpellingListIndex(0);
13570 return A;
13571 }
13572
13573 DLLImportAttr *DLLImportAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13574 auto *A = new (Ctx) DLLImportAttr(Ctx, CommonInfo);
13575 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13576 A->setAttributeSpellingListIndex(0);
13577 return A;
13578 }
13579
13580 DLLImportAttr *DLLImportAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
13581 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13582 switch (S) {
13583 case Declspec_dllimport:
13584 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13585 case GNU_dllimport:
13586 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13587 case CXX11_gnu_dllimport:
13588 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13589 case C23_gnu_dllimport:
13590 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13591 default:
13592 llvm_unreachable("Unknown attribute spelling!");
13593 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13594 }
13595 }());
13596 return CreateImplicit(Ctx, I);
13597 }
13598
13599 DLLImportAttr *DLLImportAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
13600 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13601 switch (S) {
13602 case Declspec_dllimport:
13603 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13604 case GNU_dllimport:
13605 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13606 case CXX11_gnu_dllimport:
13607 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13608 case C23_gnu_dllimport:
13609 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13610 default:
13611 llvm_unreachable("Unknown attribute spelling!");
13612 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13613 }
13614 }());
13615 return Create(Ctx, I);
13616 }
13617
13618 DLLImportAttr::DLLImportAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13619 )
13620 : InheritableAttr(Ctx, CommonInfo, attr::DLLImport, /*IsLateParsed=*/false, false)
13621 {
13622 }
13623
13624 DLLImportAttr *DLLImportAttr::clone(ASTContext &C) const {
13625 auto *A = new (C) DLLImportAttr(C, *this);
13626 A->Inherited = Inherited;
13627 A->IsPackExpansion = IsPackExpansion;
13628 A->setImplicit(Implicit);
13629 return A;
13630 }
13631
13632 void DLLImportAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
13633 bool IsFirstArgument = true; (void)IsFirstArgument;
13634 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
13635 switch (getAttributeSpellingListIndex()) {
13636 default:
13637 llvm_unreachable("Unknown attribute spelling!");
13638 break;
13639 case 0 : {
13640 OS << "__declspec(dllimport";
13641 OS << ")";
13642 break;
13643 }
13644 case 1 : {
13645 OS << "__attribute__((dllimport";
13646 OS << "))";
13647 break;
13648 }
13649 case 2 : {
13650 OS << "[[gnu::dllimport";
13651 OS << "]]";
13652 break;
13653 }
13654 case 3 : {
13655 OS << "[[gnu::dllimport";
13656 OS << "]]";
13657 break;
13658 }
13659 }
13660 }
13661
13662 const char *DLLImportAttr::getSpelling() const {
13663 switch (getAttributeSpellingListIndex()) {
13664 default:
13665 llvm_unreachable("Unknown attribute spelling!");
13666 return "(No spelling)";
13667 case 0:
13668 return "dllimport";
13669 case 1:
13670 return "dllimport";
13671 case 2:
13672 return "dllimport";
13673 case 3:
13674 return "dllimport";
13675 }
13676 }
13677
13678
13679 // DLLImportStaticLocalAttr implementation
13680
13681 DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13682 auto *A = new (Ctx) DLLImportStaticLocalAttr(Ctx, CommonInfo);
13683 A->setImplicit(true);
13684 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13685 A->setAttributeSpellingListIndex(0);
13686 return A;
13687 }
13688
13689 DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
13690 auto *A = new (Ctx) DLLImportStaticLocalAttr(Ctx, CommonInfo);
13691 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13692 A->setAttributeSpellingListIndex(0);
13693 return A;
13694 }
13695
13696 DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
13697 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
13698 return CreateImplicit(Ctx, I);
13699 }
13700
13701 DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::Create(ASTContext &Ctx, SourceRange Range) {
13702 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
13703 return Create(Ctx, I);
13704 }
13705
13706 DLLImportStaticLocalAttr::DLLImportStaticLocalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13707 )
13708 : InheritableAttr(Ctx, CommonInfo, attr::DLLImportStaticLocal, /*IsLateParsed=*/false, false)
13709 {
13710 }
13711
13712 DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::clone(ASTContext &C) const {
13713 auto *A = new (C) DLLImportStaticLocalAttr(C, *this);
13714 A->Inherited = Inherited;
13715 A->IsPackExpansion = IsPackExpansion;
13716 A->setImplicit(Implicit);
13717 return A;
13718 }
13719
13720 void DLLImportStaticLocalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
13721 }
13722
13723 const char *DLLImportStaticLocalAttr::getSpelling() const {
13724 return "(No spelling)";
13725 }
13726
13727
13728 // DeprecatedAttr implementation
13729
13730 DeprecatedAttr *DeprecatedAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, const AttributeCommonInfo &CommonInfo) {
13731 auto *A = new (Ctx) DeprecatedAttr(Ctx, CommonInfo, Message, Replacement);
13732 A->setImplicit(true);
13733 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13734 A->setAttributeSpellingListIndex(0);
13735 return A;
13736 }
13737
13738 DeprecatedAttr *DeprecatedAttr::Create(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, const AttributeCommonInfo &CommonInfo) {
13739 auto *A = new (Ctx) DeprecatedAttr(Ctx, CommonInfo, Message, Replacement);
13740 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13741 A->setAttributeSpellingListIndex(0);
13742 return A;
13743 }
13744
13745 DeprecatedAttr *DeprecatedAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, SourceRange Range, Spelling S) {
13746 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13747 switch (S) {
13748 case GNU_deprecated:
13749 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13750 case CXX11_gnu_deprecated:
13751 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13752 case C23_gnu_deprecated:
13753 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13754 case Declspec_deprecated:
13755 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13756 case CXX11_deprecated:
13757 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13758 case C23_deprecated:
13759 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13760 default:
13761 llvm_unreachable("Unknown attribute spelling!");
13762 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13763 }
13764 }());
13765 return CreateImplicit(Ctx, Message, Replacement, I);
13766 }
13767
13768 DeprecatedAttr *DeprecatedAttr::Create(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, SourceRange Range, Spelling S) {
13769 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13770 switch (S) {
13771 case GNU_deprecated:
13772 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13773 case CXX11_gnu_deprecated:
13774 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13775 case C23_gnu_deprecated:
13776 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13777 case Declspec_deprecated:
13778 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13779 case CXX11_deprecated:
13780 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13781 case C23_deprecated:
13782 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13783 default:
13784 llvm_unreachable("Unknown attribute spelling!");
13785 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13786 }
13787 }());
13788 return Create(Ctx, Message, Replacement, I);
13789 }
13790
13791 DeprecatedAttr::DeprecatedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13792 , llvm::StringRef Message
13793 , llvm::StringRef Replacement
13794 )
13795 : InheritableAttr(Ctx, CommonInfo, attr::Deprecated, /*IsLateParsed=*/false, false)
13796 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
13797 , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength])
13798 {
13799 if (!Message.empty())
13800 std::memcpy(message, Message.data(), messageLength);
13801 if (!Replacement.empty())
13802 std::memcpy(replacement, Replacement.data(), replacementLength);
13803 }
13804
13805 DeprecatedAttr::DeprecatedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13806 )
13807 : InheritableAttr(Ctx, CommonInfo, attr::Deprecated, /*IsLateParsed=*/false, false)
13808 , messageLength(0),message(nullptr)
13809 , replacementLength(0),replacement(nullptr)
13810 {
13811 }
13812
13813
13814
13815
13816
13817 DeprecatedAttr *DeprecatedAttr::clone(ASTContext &C) const {
13818 auto *A = new (C) DeprecatedAttr(C, *this, getMessage(), getReplacement());
13819 A->Inherited = Inherited;
13820 A->IsPackExpansion = IsPackExpansion;
13821 A->setImplicit(Implicit);
13822 return A;
13823 }
13824
13825 void DeprecatedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
13826 bool IsFirstArgument = true; (void)IsFirstArgument;
13827 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
13828 switch (getAttributeSpellingListIndex()) {
13829 default:
13830 llvm_unreachable("Unknown attribute spelling!");
13831 break;
13832 case 0 : {
13833 OS << "__attribute__((deprecated";
13834 OS << "(\"" << getMessage() << "\"";
13835 if (!getReplacement().empty()) OS << ", \"" << getReplacement() << "\"";
13836 OS << ")";
13837 OS << "))";
13838 break;
13839 }
13840 case 1 : {
13841 OS << "[[gnu::deprecated";
13842 OS << "(\"" << getMessage() << "\"";
13843 OS << ")";
13844 OS << "]]";
13845 break;
13846 }
13847 case 2 : {
13848 OS << "[[gnu::deprecated";
13849 OS << "(\"" << getMessage() << "\"";
13850 OS << ")";
13851 OS << "]]";
13852 break;
13853 }
13854 case 3 : {
13855 OS << "__declspec(deprecated";
13856 OS << "(\"" << getMessage() << "\"";
13857 OS << ")";
13858 OS << ")";
13859 break;
13860 }
13861 case 4 : {
13862 OS << "[[deprecated";
13863 OS << "(\"" << getMessage() << "\"";
13864 OS << ")";
13865 OS << "]]";
13866 break;
13867 }
13868 case 5 : {
13869 OS << "[[deprecated";
13870 OS << "(\"" << getMessage() << "\"";
13871 OS << ")";
13872 OS << "]]";
13873 break;
13874 }
13875 }
13876 }
13877
13878 const char *DeprecatedAttr::getSpelling() const {
13879 switch (getAttributeSpellingListIndex()) {
13880 default:
13881 llvm_unreachable("Unknown attribute spelling!");
13882 return "(No spelling)";
13883 case 0:
13884 return "deprecated";
13885 case 1:
13886 return "deprecated";
13887 case 2:
13888 return "deprecated";
13889 case 3:
13890 return "deprecated";
13891 case 4:
13892 return "deprecated";
13893 case 5:
13894 return "deprecated";
13895 }
13896 }
13897
13898
13899 // DestructorAttr implementation
13900
13901 DestructorAttr *DestructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) {
13902 auto *A = new (Ctx) DestructorAttr(Ctx, CommonInfo, Priority);
13903 A->setImplicit(true);
13904 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13905 A->setAttributeSpellingListIndex(0);
13906 return A;
13907 }
13908
13909 DestructorAttr *DestructorAttr::Create(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) {
13910 auto *A = new (Ctx) DestructorAttr(Ctx, CommonInfo, Priority);
13911 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
13912 A->setAttributeSpellingListIndex(0);
13913 return A;
13914 }
13915
13916 DestructorAttr *DestructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Range, Spelling S) {
13917 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13918 switch (S) {
13919 case GNU_destructor:
13920 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13921 case CXX11_gnu_destructor:
13922 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13923 case C23_gnu_destructor:
13924 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13925 default:
13926 llvm_unreachable("Unknown attribute spelling!");
13927 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13928 }
13929 }());
13930 return CreateImplicit(Ctx, Priority, I);
13931 }
13932
13933 DestructorAttr *DestructorAttr::Create(ASTContext &Ctx, int Priority, SourceRange Range, Spelling S) {
13934 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
13935 switch (S) {
13936 case GNU_destructor:
13937 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13938 case CXX11_gnu_destructor:
13939 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13940 case C23_gnu_destructor:
13941 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13942 default:
13943 llvm_unreachable("Unknown attribute spelling!");
13944 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
13945 }
13946 }());
13947 return Create(Ctx, Priority, I);
13948 }
13949
13950 DestructorAttr::DestructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13951 , int Priority
13952 )
13953 : InheritableAttr(Ctx, CommonInfo, attr::Destructor, /*IsLateParsed=*/false, false)
13954 , priority(Priority)
13955 {
13956 }
13957
13958 DestructorAttr::DestructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
13959 )
13960 : InheritableAttr(Ctx, CommonInfo, attr::Destructor, /*IsLateParsed=*/false, false)
13961 , priority()
13962 {
13963 }
13964
13965
13966
13967 DestructorAttr *DestructorAttr::clone(ASTContext &C) const {
13968 auto *A = new (C) DestructorAttr(C, *this, priority);
13969 A->Inherited = Inherited;
13970 A->IsPackExpansion = IsPackExpansion;
13971 A->setImplicit(Implicit);
13972 return A;
13973 }
13974
13975 void DestructorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
13976 bool IsFirstArgument = true; (void)IsFirstArgument;
13977 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
13978 switch (getAttributeSpellingListIndex()) {
13979 default:
13980 llvm_unreachable("Unknown attribute spelling!");
13981 break;
13982 case 0 : {
13983 OS << "__attribute__((destructor";
13984 DelimitAttributeArgument(OS, IsFirstArgument);
13985 OS << "" << getPriority() << "";
13986 if (!IsFirstArgument)
13987 OS << ")";
13988 OS << "))";
13989 break;
13990 }
13991 case 1 : {
13992 OS << "[[gnu::destructor";
13993 DelimitAttributeArgument(OS, IsFirstArgument);
13994 OS << "" << getPriority() << "";
13995 if (!IsFirstArgument)
13996 OS << ")";
13997 OS << "]]";
13998 break;
13999 }
14000 case 2 : {
14001 OS << "[[gnu::destructor";
14002 DelimitAttributeArgument(OS, IsFirstArgument);
14003 OS << "" << getPriority() << "";
14004 if (!IsFirstArgument)
14005 OS << ")";
14006 OS << "]]";
14007 break;
14008 }
14009 }
14010 }
14011
14012 const char *DestructorAttr::getSpelling() const {
14013 switch (getAttributeSpellingListIndex()) {
14014 default:
14015 llvm_unreachable("Unknown attribute spelling!");
14016 return "(No spelling)";
14017 case 0:
14018 return "destructor";
14019 case 1:
14020 return "destructor";
14021 case 2:
14022 return "destructor";
14023 }
14024 }
14025
14026
14027 // DiagnoseAsBuiltinAttr implementation
14028
14029 DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, const AttributeCommonInfo &CommonInfo) {
14030 auto *A = new (Ctx) DiagnoseAsBuiltinAttr(Ctx, CommonInfo, Function, ArgIndices, ArgIndicesSize);
14031 A->setImplicit(true);
14032 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14033 A->setAttributeSpellingListIndex(0);
14034 return A;
14035 }
14036
14037 DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::Create(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, const AttributeCommonInfo &CommonInfo) {
14038 auto *A = new (Ctx) DiagnoseAsBuiltinAttr(Ctx, CommonInfo, Function, ArgIndices, ArgIndicesSize);
14039 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14040 A->setAttributeSpellingListIndex(0);
14041 return A;
14042 }
14043
14044 DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, SourceRange Range, Spelling S) {
14045 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14046 switch (S) {
14047 case GNU_diagnose_as_builtin:
14048 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14049 case CXX11_clang_diagnose_as_builtin:
14050 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14051 case C23_clang_diagnose_as_builtin:
14052 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14053 default:
14054 llvm_unreachable("Unknown attribute spelling!");
14055 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14056 }
14057 }());
14058 return CreateImplicit(Ctx, Function, ArgIndices, ArgIndicesSize, I);
14059 }
14060
14061 DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::Create(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, SourceRange Range, Spelling S) {
14062 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14063 switch (S) {
14064 case GNU_diagnose_as_builtin:
14065 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14066 case CXX11_clang_diagnose_as_builtin:
14067 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14068 case C23_clang_diagnose_as_builtin:
14069 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14070 default:
14071 llvm_unreachable("Unknown attribute spelling!");
14072 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14073 }
14074 }());
14075 return Create(Ctx, Function, ArgIndices, ArgIndicesSize, I);
14076 }
14077
14078 DiagnoseAsBuiltinAttr::DiagnoseAsBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14079 , FunctionDecl * Function
14080 , unsigned *ArgIndices, unsigned ArgIndicesSize
14081 )
14082 : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseAsBuiltin, /*IsLateParsed=*/false, false)
14083 , function(Function)
14084 , argIndices_Size(ArgIndicesSize), argIndices_(new (Ctx, 16) unsigned[argIndices_Size])
14085 {
14086 std::copy(ArgIndices, ArgIndices + argIndices_Size, argIndices_);
14087 }
14088
14089 DiagnoseAsBuiltinAttr::DiagnoseAsBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14090 , FunctionDecl * Function
14091 )
14092 : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseAsBuiltin, /*IsLateParsed=*/false, false)
14093 , function(Function)
14094 , argIndices_Size(0), argIndices_(nullptr)
14095 {
14096 }
14097
14098
14099
14100
14101
14102 DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::clone(ASTContext &C) const {
14103 auto *A = new (C) DiagnoseAsBuiltinAttr(C, *this, function, argIndices_, argIndices_Size);
14104 A->Inherited = Inherited;
14105 A->IsPackExpansion = IsPackExpansion;
14106 A->setImplicit(Implicit);
14107 return A;
14108 }
14109
14110 void DiagnoseAsBuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
14111 bool IsFirstArgument = true; (void)IsFirstArgument;
14112 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
14113 switch (getAttributeSpellingListIndex()) {
14114 default:
14115 llvm_unreachable("Unknown attribute spelling!");
14116 break;
14117 case 0 : {
14118 OS << "__attribute__((diagnose_as_builtin";
14119 DelimitAttributeArgument(OS, IsFirstArgument);
14120 OS << "" << getFunction()->getNameInfo().getAsString() << "";
14121 OS << "";
14122 for (const auto &Val : argIndices()) {
14123 DelimitAttributeArgument(OS, IsFirstArgument);
14124 OS << Val;
14125 }
14126 OS << "";
14127 if (!IsFirstArgument)
14128 OS << ")";
14129 OS << "))";
14130 break;
14131 }
14132 case 1 : {
14133 OS << "[[clang::diagnose_as_builtin";
14134 DelimitAttributeArgument(OS, IsFirstArgument);
14135 OS << "" << getFunction()->getNameInfo().getAsString() << "";
14136 OS << "";
14137 for (const auto &Val : argIndices()) {
14138 DelimitAttributeArgument(OS, IsFirstArgument);
14139 OS << Val;
14140 }
14141 OS << "";
14142 if (!IsFirstArgument)
14143 OS << ")";
14144 OS << "]]";
14145 break;
14146 }
14147 case 2 : {
14148 OS << "[[clang::diagnose_as_builtin";
14149 DelimitAttributeArgument(OS, IsFirstArgument);
14150 OS << "" << getFunction()->getNameInfo().getAsString() << "";
14151 OS << "";
14152 for (const auto &Val : argIndices()) {
14153 DelimitAttributeArgument(OS, IsFirstArgument);
14154 OS << Val;
14155 }
14156 OS << "";
14157 if (!IsFirstArgument)
14158 OS << ")";
14159 OS << "]]";
14160 break;
14161 }
14162 }
14163 }
14164
14165 const char *DiagnoseAsBuiltinAttr::getSpelling() const {
14166 switch (getAttributeSpellingListIndex()) {
14167 default:
14168 llvm_unreachable("Unknown attribute spelling!");
14169 return "(No spelling)";
14170 case 0:
14171 return "diagnose_as_builtin";
14172 case 1:
14173 return "diagnose_as_builtin";
14174 case 2:
14175 return "diagnose_as_builtin";
14176 }
14177 }
14178
14179
14180 // DiagnoseIfAttr implementation
14181
14182 DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DefaultSeverity DefaultSeverity, llvm::StringRef WarningGroup, bool ArgDependent, NamedDecl * Parent, const AttributeCommonInfo &CommonInfo) {
14183 auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DefaultSeverity, WarningGroup, ArgDependent, Parent);
14184 A->setImplicit(true);
14185 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14186 A->setAttributeSpellingListIndex(0);
14187 return A;
14188 }
14189
14190 DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DefaultSeverity DefaultSeverity, llvm::StringRef WarningGroup, bool ArgDependent, NamedDecl * Parent, const AttributeCommonInfo &CommonInfo) {
14191 auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DefaultSeverity, WarningGroup, ArgDependent, Parent);
14192 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14193 A->setAttributeSpellingListIndex(0);
14194 return A;
14195 }
14196
14197 DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DefaultSeverity DefaultSeverity, llvm::StringRef WarningGroup, bool ArgDependent, NamedDecl * Parent, SourceRange Range) {
14198 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
14199 return CreateImplicit(Ctx, Cond, Message, DefaultSeverity, WarningGroup, ArgDependent, Parent, I);
14200 }
14201
14202 DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DefaultSeverity DefaultSeverity, llvm::StringRef WarningGroup, bool ArgDependent, NamedDecl * Parent, SourceRange Range) {
14203 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
14204 return Create(Ctx, Cond, Message, DefaultSeverity, WarningGroup, ArgDependent, Parent, I);
14205 }
14206
14207 DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DefaultSeverity DefaultSeverity, llvm::StringRef WarningGroup, const AttributeCommonInfo &CommonInfo) {
14208 auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DefaultSeverity, WarningGroup);
14209 A->setImplicit(true);
14210 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14211 A->setAttributeSpellingListIndex(0);
14212 return A;
14213 }
14214
14215 DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DefaultSeverity DefaultSeverity, llvm::StringRef WarningGroup, const AttributeCommonInfo &CommonInfo) {
14216 auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DefaultSeverity, WarningGroup);
14217 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14218 A->setAttributeSpellingListIndex(0);
14219 return A;
14220 }
14221
14222 DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DefaultSeverity DefaultSeverity, llvm::StringRef WarningGroup, SourceRange Range) {
14223 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
14224 return CreateImplicit(Ctx, Cond, Message, DefaultSeverity, WarningGroup, I);
14225 }
14226
14227 DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DefaultSeverity DefaultSeverity, llvm::StringRef WarningGroup, SourceRange Range) {
14228 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
14229 return Create(Ctx, Cond, Message, DefaultSeverity, WarningGroup, I);
14230 }
14231
14232 DiagnoseIfAttr::DiagnoseIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14233 , Expr * Cond
14234 , llvm::StringRef Message
14235 , DiagnoseIfAttr::DefaultSeverity DefaultSeverity
14236 , llvm::StringRef WarningGroup
14237 , bool ArgDependent
14238 , NamedDecl * Parent
14239 )
14240 : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseIf, /*IsLateParsed=*/true, true)
14241 , cond(Cond)
14242 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
14243 , defaultSeverity(DefaultSeverity)
14244 , warningGroupLength(WarningGroup.size()),warningGroup(new (Ctx, 1) char[warningGroupLength])
14245 , argDependent(ArgDependent)
14246 , parent(Parent)
14247 {
14248 if (!Message.empty())
14249 std::memcpy(message, Message.data(), messageLength);
14250 if (!WarningGroup.empty())
14251 std::memcpy(warningGroup, WarningGroup.data(), warningGroupLength);
14252 }
14253
14254 DiagnoseIfAttr::DiagnoseIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14255 , Expr * Cond
14256 , llvm::StringRef Message
14257 , DiagnoseIfAttr::DefaultSeverity DefaultSeverity
14258 , llvm::StringRef WarningGroup
14259 )
14260 : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseIf, /*IsLateParsed=*/true, true)
14261 , cond(Cond)
14262 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
14263 , defaultSeverity(DefaultSeverity)
14264 , warningGroupLength(WarningGroup.size()),warningGroup(new (Ctx, 1) char[warningGroupLength])
14265 , argDependent()
14266 , parent()
14267 {
14268 if (!Message.empty())
14269 std::memcpy(message, Message.data(), messageLength);
14270 if (!WarningGroup.empty())
14271 std::memcpy(warningGroup, WarningGroup.data(), warningGroupLength);
14272 }
14273
14274 DiagnoseIfAttr::DiagnoseIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14275 , Expr * Cond
14276 , llvm::StringRef Message
14277 , DiagnoseIfAttr::DefaultSeverity DefaultSeverity
14278 )
14279 : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseIf, /*IsLateParsed=*/true, true)
14280 , cond(Cond)
14281 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
14282 , defaultSeverity(DefaultSeverity)
14283 , warningGroupLength(0),warningGroup(nullptr)
14284 , argDependent()
14285 , parent()
14286 {
14287 if (!Message.empty())
14288 std::memcpy(message, Message.data(), messageLength);
14289 }
14290
14291
14292
14293
14294
14295
14296
14297 bool DiagnoseIfAttr::ConvertStrToDefaultSeverity(StringRef Val, DiagnoseIfAttr::DefaultSeverity &Out) {
14298 std::optional<DiagnoseIfAttr::DefaultSeverity> R = llvm::StringSwitch<std::optional<DiagnoseIfAttr::DefaultSeverity>>(Val)
14299 .Case("error", DiagnoseIfAttr::DefaultSeverity::DS_error)
14300 .Case("warning", DiagnoseIfAttr::DefaultSeverity::DS_warning)
14301 .Default(std::optional<DiagnoseIfAttr::DefaultSeverity>());
14302 if (R) {
14303 Out = *R;
14304 return true;
14305 }
14306 return false;
14307 }
14308
14309 const char *DiagnoseIfAttr::ConvertDefaultSeverityToStr(DiagnoseIfAttr::DefaultSeverity Val) {
14310 switch(Val) {
14311 case DiagnoseIfAttr::DefaultSeverity::DS_error: return "error";
14312 case DiagnoseIfAttr::DefaultSeverity::DS_warning: return "warning";
14313 }
14314 llvm_unreachable("No enumerator with that value");
14315 }
14316
14317
14318
14319
14320
14321
14322 DiagnoseIfAttr *DiagnoseIfAttr::clone(ASTContext &C) const {
14323 auto *A = new (C) DiagnoseIfAttr(C, *this, cond, getMessage(), defaultSeverity, getWarningGroup(), argDependent, parent);
14324 A->Inherited = Inherited;
14325 A->IsPackExpansion = IsPackExpansion;
14326 A->setImplicit(Implicit);
14327 return A;
14328 }
14329
14330 void DiagnoseIfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
14331 bool IsFirstArgument = true; (void)IsFirstArgument;
14332 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
14333 switch (getAttributeSpellingListIndex()) {
14334 default:
14335 llvm_unreachable("Unknown attribute spelling!");
14336 break;
14337 case 0 : {
14338 OS << "__attribute__((diagnose_if";
14339 DelimitAttributeArgument(OS, IsFirstArgument);
14340 OS << "";
14341 getCond()->printPretty(OS, nullptr, Policy);
14342 OS << "";
14343 DelimitAttributeArgument(OS, IsFirstArgument);
14344 OS << "\"" << getMessage() << "\"";
14345 DelimitAttributeArgument(OS, IsFirstArgument);
14346 OS << "\"" << DiagnoseIfAttr::ConvertDefaultSeverityToStr(getDefaultSeverity()) << "\"";
14347 DelimitAttributeArgument(OS, IsFirstArgument);
14348 OS << "\"" << getWarningGroup() << "\"";
14349 if (!IsFirstArgument)
14350 OS << ")";
14351 OS << "))";
14352 break;
14353 }
14354 }
14355 }
14356
14357 const char *DiagnoseIfAttr::getSpelling() const {
14358 switch (getAttributeSpellingListIndex()) {
14359 default:
14360 llvm_unreachable("Unknown attribute spelling!");
14361 return "(No spelling)";
14362 case 0:
14363 return "diagnose_if";
14364 }
14365 }
14366
14367
14368 // DisableSanitizerInstrumentationAttr implementation
14369
14370 DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
14371 auto *A = new (Ctx) DisableSanitizerInstrumentationAttr(Ctx, CommonInfo);
14372 A->setImplicit(true);
14373 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14374 A->setAttributeSpellingListIndex(0);
14375 return A;
14376 }
14377
14378 DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
14379 auto *A = new (Ctx) DisableSanitizerInstrumentationAttr(Ctx, CommonInfo);
14380 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14381 A->setAttributeSpellingListIndex(0);
14382 return A;
14383 }
14384
14385 DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
14386 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14387 switch (S) {
14388 case GNU_disable_sanitizer_instrumentation:
14389 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14390 case CXX11_clang_disable_sanitizer_instrumentation:
14391 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14392 case C23_clang_disable_sanitizer_instrumentation:
14393 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14394 default:
14395 llvm_unreachable("Unknown attribute spelling!");
14396 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14397 }
14398 }());
14399 return CreateImplicit(Ctx, I);
14400 }
14401
14402 DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
14403 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14404 switch (S) {
14405 case GNU_disable_sanitizer_instrumentation:
14406 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14407 case CXX11_clang_disable_sanitizer_instrumentation:
14408 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14409 case C23_clang_disable_sanitizer_instrumentation:
14410 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14411 default:
14412 llvm_unreachable("Unknown attribute spelling!");
14413 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14414 }
14415 }());
14416 return Create(Ctx, I);
14417 }
14418
14419 DisableSanitizerInstrumentationAttr::DisableSanitizerInstrumentationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14420 )
14421 : InheritableAttr(Ctx, CommonInfo, attr::DisableSanitizerInstrumentation, /*IsLateParsed=*/false, false)
14422 {
14423 }
14424
14425 DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::clone(ASTContext &C) const {
14426 auto *A = new (C) DisableSanitizerInstrumentationAttr(C, *this);
14427 A->Inherited = Inherited;
14428 A->IsPackExpansion = IsPackExpansion;
14429 A->setImplicit(Implicit);
14430 return A;
14431 }
14432
14433 void DisableSanitizerInstrumentationAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
14434 bool IsFirstArgument = true; (void)IsFirstArgument;
14435 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
14436 switch (getAttributeSpellingListIndex()) {
14437 default:
14438 llvm_unreachable("Unknown attribute spelling!");
14439 break;
14440 case 0 : {
14441 OS << "__attribute__((disable_sanitizer_instrumentation";
14442 OS << "))";
14443 break;
14444 }
14445 case 1 : {
14446 OS << "[[clang::disable_sanitizer_instrumentation";
14447 OS << "]]";
14448 break;
14449 }
14450 case 2 : {
14451 OS << "[[clang::disable_sanitizer_instrumentation";
14452 OS << "]]";
14453 break;
14454 }
14455 }
14456 }
14457
14458 const char *DisableSanitizerInstrumentationAttr::getSpelling() const {
14459 switch (getAttributeSpellingListIndex()) {
14460 default:
14461 llvm_unreachable("Unknown attribute spelling!");
14462 return "(No spelling)";
14463 case 0:
14464 return "disable_sanitizer_instrumentation";
14465 case 1:
14466 return "disable_sanitizer_instrumentation";
14467 case 2:
14468 return "disable_sanitizer_instrumentation";
14469 }
14470 }
14471
14472
14473 // DisableTailCallsAttr implementation
14474
14475 DisableTailCallsAttr *DisableTailCallsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
14476 auto *A = new (Ctx) DisableTailCallsAttr(Ctx, CommonInfo);
14477 A->setImplicit(true);
14478 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14479 A->setAttributeSpellingListIndex(0);
14480 return A;
14481 }
14482
14483 DisableTailCallsAttr *DisableTailCallsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
14484 auto *A = new (Ctx) DisableTailCallsAttr(Ctx, CommonInfo);
14485 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14486 A->setAttributeSpellingListIndex(0);
14487 return A;
14488 }
14489
14490 DisableTailCallsAttr *DisableTailCallsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
14491 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14492 switch (S) {
14493 case GNU_disable_tail_calls:
14494 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14495 case CXX11_clang_disable_tail_calls:
14496 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14497 case C23_clang_disable_tail_calls:
14498 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14499 default:
14500 llvm_unreachable("Unknown attribute spelling!");
14501 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14502 }
14503 }());
14504 return CreateImplicit(Ctx, I);
14505 }
14506
14507 DisableTailCallsAttr *DisableTailCallsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
14508 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14509 switch (S) {
14510 case GNU_disable_tail_calls:
14511 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14512 case CXX11_clang_disable_tail_calls:
14513 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14514 case C23_clang_disable_tail_calls:
14515 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14516 default:
14517 llvm_unreachable("Unknown attribute spelling!");
14518 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14519 }
14520 }());
14521 return Create(Ctx, I);
14522 }
14523
14524 DisableTailCallsAttr::DisableTailCallsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14525 )
14526 : InheritableAttr(Ctx, CommonInfo, attr::DisableTailCalls, /*IsLateParsed=*/false, false)
14527 {
14528 }
14529
14530 DisableTailCallsAttr *DisableTailCallsAttr::clone(ASTContext &C) const {
14531 auto *A = new (C) DisableTailCallsAttr(C, *this);
14532 A->Inherited = Inherited;
14533 A->IsPackExpansion = IsPackExpansion;
14534 A->setImplicit(Implicit);
14535 return A;
14536 }
14537
14538 void DisableTailCallsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
14539 bool IsFirstArgument = true; (void)IsFirstArgument;
14540 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
14541 switch (getAttributeSpellingListIndex()) {
14542 default:
14543 llvm_unreachable("Unknown attribute spelling!");
14544 break;
14545 case 0 : {
14546 OS << "__attribute__((disable_tail_calls";
14547 OS << "))";
14548 break;
14549 }
14550 case 1 : {
14551 OS << "[[clang::disable_tail_calls";
14552 OS << "]]";
14553 break;
14554 }
14555 case 2 : {
14556 OS << "[[clang::disable_tail_calls";
14557 OS << "]]";
14558 break;
14559 }
14560 }
14561 }
14562
14563 const char *DisableTailCallsAttr::getSpelling() const {
14564 switch (getAttributeSpellingListIndex()) {
14565 default:
14566 llvm_unreachable("Unknown attribute spelling!");
14567 return "(No spelling)";
14568 case 0:
14569 return "disable_tail_calls";
14570 case 1:
14571 return "disable_tail_calls";
14572 case 2:
14573 return "disable_tail_calls";
14574 }
14575 }
14576
14577
14578 // EmptyBasesAttr implementation
14579
14580 EmptyBasesAttr *EmptyBasesAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
14581 auto *A = new (Ctx) EmptyBasesAttr(Ctx, CommonInfo);
14582 A->setImplicit(true);
14583 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14584 A->setAttributeSpellingListIndex(0);
14585 return A;
14586 }
14587
14588 EmptyBasesAttr *EmptyBasesAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
14589 auto *A = new (Ctx) EmptyBasesAttr(Ctx, CommonInfo);
14590 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14591 A->setAttributeSpellingListIndex(0);
14592 return A;
14593 }
14594
14595 EmptyBasesAttr *EmptyBasesAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
14596 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
14597 return CreateImplicit(Ctx, I);
14598 }
14599
14600 EmptyBasesAttr *EmptyBasesAttr::Create(ASTContext &Ctx, SourceRange Range) {
14601 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
14602 return Create(Ctx, I);
14603 }
14604
14605 EmptyBasesAttr::EmptyBasesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14606 )
14607 : InheritableAttr(Ctx, CommonInfo, attr::EmptyBases, /*IsLateParsed=*/false, false)
14608 {
14609 }
14610
14611 EmptyBasesAttr *EmptyBasesAttr::clone(ASTContext &C) const {
14612 auto *A = new (C) EmptyBasesAttr(C, *this);
14613 A->Inherited = Inherited;
14614 A->IsPackExpansion = IsPackExpansion;
14615 A->setImplicit(Implicit);
14616 return A;
14617 }
14618
14619 void EmptyBasesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
14620 bool IsFirstArgument = true; (void)IsFirstArgument;
14621 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
14622 switch (getAttributeSpellingListIndex()) {
14623 default:
14624 llvm_unreachable("Unknown attribute spelling!");
14625 break;
14626 case 0 : {
14627 OS << "__declspec(empty_bases";
14628 OS << ")";
14629 break;
14630 }
14631 }
14632 }
14633
14634 const char *EmptyBasesAttr::getSpelling() const {
14635 switch (getAttributeSpellingListIndex()) {
14636 default:
14637 llvm_unreachable("Unknown attribute spelling!");
14638 return "(No spelling)";
14639 case 0:
14640 return "empty_bases";
14641 }
14642 }
14643
14644
14645 // EnableIfAttr implementation
14646
14647 EnableIfAttr *EnableIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) {
14648 auto *A = new (Ctx) EnableIfAttr(Ctx, CommonInfo, Cond, Message);
14649 A->setImplicit(true);
14650 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14651 A->setAttributeSpellingListIndex(0);
14652 return A;
14653 }
14654
14655 EnableIfAttr *EnableIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) {
14656 auto *A = new (Ctx) EnableIfAttr(Ctx, CommonInfo, Cond, Message);
14657 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14658 A->setAttributeSpellingListIndex(0);
14659 return A;
14660 }
14661
14662 EnableIfAttr *EnableIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, SourceRange Range) {
14663 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
14664 return CreateImplicit(Ctx, Cond, Message, I);
14665 }
14666
14667 EnableIfAttr *EnableIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, SourceRange Range) {
14668 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
14669 return Create(Ctx, Cond, Message, I);
14670 }
14671
14672 EnableIfAttr::EnableIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14673 , Expr * Cond
14674 , llvm::StringRef Message
14675 )
14676 : InheritableAttr(Ctx, CommonInfo, attr::EnableIf, /*IsLateParsed=*/false, false)
14677 , cond(Cond)
14678 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
14679 {
14680 if (!Message.empty())
14681 std::memcpy(message, Message.data(), messageLength);
14682 }
14683
14684
14685
14686
14687
14688 EnableIfAttr *EnableIfAttr::clone(ASTContext &C) const {
14689 auto *A = new (C) EnableIfAttr(C, *this, cond, getMessage());
14690 A->Inherited = Inherited;
14691 A->IsPackExpansion = IsPackExpansion;
14692 A->setImplicit(Implicit);
14693 return A;
14694 }
14695
14696 void EnableIfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
14697 bool IsFirstArgument = true; (void)IsFirstArgument;
14698 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
14699 switch (getAttributeSpellingListIndex()) {
14700 default:
14701 llvm_unreachable("Unknown attribute spelling!");
14702 break;
14703 case 0 : {
14704 OS << "__attribute__((enable_if";
14705 DelimitAttributeArgument(OS, IsFirstArgument);
14706 OS << "";
14707 getCond()->printPretty(OS, nullptr, Policy);
14708 OS << "";
14709 DelimitAttributeArgument(OS, IsFirstArgument);
14710 OS << "\"" << getMessage() << "\"";
14711 if (!IsFirstArgument)
14712 OS << ")";
14713 OS << "))";
14714 break;
14715 }
14716 }
14717 }
14718
14719 const char *EnableIfAttr::getSpelling() const {
14720 switch (getAttributeSpellingListIndex()) {
14721 default:
14722 llvm_unreachable("Unknown attribute spelling!");
14723 return "(No spelling)";
14724 case 0:
14725 return "enable_if";
14726 }
14727 }
14728
14729
14730 // EnforceTCBAttr implementation
14731
14732 EnforceTCBAttr *EnforceTCBAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) {
14733 auto *A = new (Ctx) EnforceTCBAttr(Ctx, CommonInfo, TCBName);
14734 A->setImplicit(true);
14735 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14736 A->setAttributeSpellingListIndex(0);
14737 return A;
14738 }
14739
14740 EnforceTCBAttr *EnforceTCBAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) {
14741 auto *A = new (Ctx) EnforceTCBAttr(Ctx, CommonInfo, TCBName);
14742 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14743 A->setAttributeSpellingListIndex(0);
14744 return A;
14745 }
14746
14747 EnforceTCBAttr *EnforceTCBAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, Spelling S) {
14748 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14749 switch (S) {
14750 case GNU_enforce_tcb:
14751 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14752 case CXX11_clang_enforce_tcb:
14753 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14754 case C23_clang_enforce_tcb:
14755 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14756 default:
14757 llvm_unreachable("Unknown attribute spelling!");
14758 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14759 }
14760 }());
14761 return CreateImplicit(Ctx, TCBName, I);
14762 }
14763
14764 EnforceTCBAttr *EnforceTCBAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, Spelling S) {
14765 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14766 switch (S) {
14767 case GNU_enforce_tcb:
14768 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14769 case CXX11_clang_enforce_tcb:
14770 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14771 case C23_clang_enforce_tcb:
14772 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14773 default:
14774 llvm_unreachable("Unknown attribute spelling!");
14775 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14776 }
14777 }());
14778 return Create(Ctx, TCBName, I);
14779 }
14780
14781 EnforceTCBAttr::EnforceTCBAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14782 , llvm::StringRef TCBName
14783 )
14784 : InheritableAttr(Ctx, CommonInfo, attr::EnforceTCB, /*IsLateParsed=*/false, true)
14785 , tCBNameLength(TCBName.size()),tCBName(new (Ctx, 1) char[tCBNameLength])
14786 {
14787 if (!TCBName.empty())
14788 std::memcpy(tCBName, TCBName.data(), tCBNameLength);
14789 }
14790
14791
14792
14793 EnforceTCBAttr *EnforceTCBAttr::clone(ASTContext &C) const {
14794 auto *A = new (C) EnforceTCBAttr(C, *this, getTCBName());
14795 A->Inherited = Inherited;
14796 A->IsPackExpansion = IsPackExpansion;
14797 A->setImplicit(Implicit);
14798 return A;
14799 }
14800
14801 void EnforceTCBAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
14802 bool IsFirstArgument = true; (void)IsFirstArgument;
14803 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
14804 switch (getAttributeSpellingListIndex()) {
14805 default:
14806 llvm_unreachable("Unknown attribute spelling!");
14807 break;
14808 case 0 : {
14809 OS << "__attribute__((enforce_tcb";
14810 DelimitAttributeArgument(OS, IsFirstArgument);
14811 OS << "\"" << getTCBName() << "\"";
14812 if (!IsFirstArgument)
14813 OS << ")";
14814 OS << "))";
14815 break;
14816 }
14817 case 1 : {
14818 OS << "[[clang::enforce_tcb";
14819 DelimitAttributeArgument(OS, IsFirstArgument);
14820 OS << "\"" << getTCBName() << "\"";
14821 if (!IsFirstArgument)
14822 OS << ")";
14823 OS << "]]";
14824 break;
14825 }
14826 case 2 : {
14827 OS << "[[clang::enforce_tcb";
14828 DelimitAttributeArgument(OS, IsFirstArgument);
14829 OS << "\"" << getTCBName() << "\"";
14830 if (!IsFirstArgument)
14831 OS << ")";
14832 OS << "]]";
14833 break;
14834 }
14835 }
14836 }
14837
14838 const char *EnforceTCBAttr::getSpelling() const {
14839 switch (getAttributeSpellingListIndex()) {
14840 default:
14841 llvm_unreachable("Unknown attribute spelling!");
14842 return "(No spelling)";
14843 case 0:
14844 return "enforce_tcb";
14845 case 1:
14846 return "enforce_tcb";
14847 case 2:
14848 return "enforce_tcb";
14849 }
14850 }
14851
14852
14853 // EnforceTCBLeafAttr implementation
14854
14855 EnforceTCBLeafAttr *EnforceTCBLeafAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) {
14856 auto *A = new (Ctx) EnforceTCBLeafAttr(Ctx, CommonInfo, TCBName);
14857 A->setImplicit(true);
14858 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14859 A->setAttributeSpellingListIndex(0);
14860 return A;
14861 }
14862
14863 EnforceTCBLeafAttr *EnforceTCBLeafAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) {
14864 auto *A = new (Ctx) EnforceTCBLeafAttr(Ctx, CommonInfo, TCBName);
14865 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14866 A->setAttributeSpellingListIndex(0);
14867 return A;
14868 }
14869
14870 EnforceTCBLeafAttr *EnforceTCBLeafAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, Spelling S) {
14871 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14872 switch (S) {
14873 case GNU_enforce_tcb_leaf:
14874 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14875 case CXX11_clang_enforce_tcb_leaf:
14876 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14877 case C23_clang_enforce_tcb_leaf:
14878 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14879 default:
14880 llvm_unreachable("Unknown attribute spelling!");
14881 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14882 }
14883 }());
14884 return CreateImplicit(Ctx, TCBName, I);
14885 }
14886
14887 EnforceTCBLeafAttr *EnforceTCBLeafAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, Spelling S) {
14888 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14889 switch (S) {
14890 case GNU_enforce_tcb_leaf:
14891 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14892 case CXX11_clang_enforce_tcb_leaf:
14893 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14894 case C23_clang_enforce_tcb_leaf:
14895 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14896 default:
14897 llvm_unreachable("Unknown attribute spelling!");
14898 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14899 }
14900 }());
14901 return Create(Ctx, TCBName, I);
14902 }
14903
14904 EnforceTCBLeafAttr::EnforceTCBLeafAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
14905 , llvm::StringRef TCBName
14906 )
14907 : InheritableAttr(Ctx, CommonInfo, attr::EnforceTCBLeaf, /*IsLateParsed=*/false, true)
14908 , tCBNameLength(TCBName.size()),tCBName(new (Ctx, 1) char[tCBNameLength])
14909 {
14910 if (!TCBName.empty())
14911 std::memcpy(tCBName, TCBName.data(), tCBNameLength);
14912 }
14913
14914
14915
14916 EnforceTCBLeafAttr *EnforceTCBLeafAttr::clone(ASTContext &C) const {
14917 auto *A = new (C) EnforceTCBLeafAttr(C, *this, getTCBName());
14918 A->Inherited = Inherited;
14919 A->IsPackExpansion = IsPackExpansion;
14920 A->setImplicit(Implicit);
14921 return A;
14922 }
14923
14924 void EnforceTCBLeafAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
14925 bool IsFirstArgument = true; (void)IsFirstArgument;
14926 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
14927 switch (getAttributeSpellingListIndex()) {
14928 default:
14929 llvm_unreachable("Unknown attribute spelling!");
14930 break;
14931 case 0 : {
14932 OS << "__attribute__((enforce_tcb_leaf";
14933 DelimitAttributeArgument(OS, IsFirstArgument);
14934 OS << "\"" << getTCBName() << "\"";
14935 if (!IsFirstArgument)
14936 OS << ")";
14937 OS << "))";
14938 break;
14939 }
14940 case 1 : {
14941 OS << "[[clang::enforce_tcb_leaf";
14942 DelimitAttributeArgument(OS, IsFirstArgument);
14943 OS << "\"" << getTCBName() << "\"";
14944 if (!IsFirstArgument)
14945 OS << ")";
14946 OS << "]]";
14947 break;
14948 }
14949 case 2 : {
14950 OS << "[[clang::enforce_tcb_leaf";
14951 DelimitAttributeArgument(OS, IsFirstArgument);
14952 OS << "\"" << getTCBName() << "\"";
14953 if (!IsFirstArgument)
14954 OS << ")";
14955 OS << "]]";
14956 break;
14957 }
14958 }
14959 }
14960
14961 const char *EnforceTCBLeafAttr::getSpelling() const {
14962 switch (getAttributeSpellingListIndex()) {
14963 default:
14964 llvm_unreachable("Unknown attribute spelling!");
14965 return "(No spelling)";
14966 case 0:
14967 return "enforce_tcb_leaf";
14968 case 1:
14969 return "enforce_tcb_leaf";
14970 case 2:
14971 return "enforce_tcb_leaf";
14972 }
14973 }
14974
14975
14976 // EnumExtensibilityAttr implementation
14977
14978 EnumExtensibilityAttr *EnumExtensibilityAttr::CreateImplicit(ASTContext &Ctx, EnumExtensibilityAttr::Kind Extensibility, const AttributeCommonInfo &CommonInfo) {
14979 auto *A = new (Ctx) EnumExtensibilityAttr(Ctx, CommonInfo, Extensibility);
14980 A->setImplicit(true);
14981 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14982 A->setAttributeSpellingListIndex(0);
14983 return A;
14984 }
14985
14986 EnumExtensibilityAttr *EnumExtensibilityAttr::Create(ASTContext &Ctx, EnumExtensibilityAttr::Kind Extensibility, const AttributeCommonInfo &CommonInfo) {
14987 auto *A = new (Ctx) EnumExtensibilityAttr(Ctx, CommonInfo, Extensibility);
14988 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
14989 A->setAttributeSpellingListIndex(0);
14990 return A;
14991 }
14992
14993 EnumExtensibilityAttr *EnumExtensibilityAttr::CreateImplicit(ASTContext &Ctx, EnumExtensibilityAttr::Kind Extensibility, SourceRange Range, Spelling S) {
14994 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
14995 switch (S) {
14996 case GNU_enum_extensibility:
14997 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
14998 case CXX11_clang_enum_extensibility:
14999 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15000 case C23_clang_enum_extensibility:
15001 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15002 default:
15003 llvm_unreachable("Unknown attribute spelling!");
15004 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15005 }
15006 }());
15007 return CreateImplicit(Ctx, Extensibility, I);
15008 }
15009
15010 EnumExtensibilityAttr *EnumExtensibilityAttr::Create(ASTContext &Ctx, EnumExtensibilityAttr::Kind Extensibility, SourceRange Range, Spelling S) {
15011 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15012 switch (S) {
15013 case GNU_enum_extensibility:
15014 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15015 case CXX11_clang_enum_extensibility:
15016 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15017 case C23_clang_enum_extensibility:
15018 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15019 default:
15020 llvm_unreachable("Unknown attribute spelling!");
15021 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15022 }
15023 }());
15024 return Create(Ctx, Extensibility, I);
15025 }
15026
15027 EnumExtensibilityAttr::EnumExtensibilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15028 , EnumExtensibilityAttr::Kind Extensibility
15029 )
15030 : InheritableAttr(Ctx, CommonInfo, attr::EnumExtensibility, /*IsLateParsed=*/false, false)
15031 , extensibility(Extensibility)
15032 {
15033 }
15034
15035
15036
15037 bool EnumExtensibilityAttr::ConvertStrToKind(StringRef Val, EnumExtensibilityAttr::Kind &Out) {
15038 std::optional<EnumExtensibilityAttr::Kind> R = llvm::StringSwitch<std::optional<EnumExtensibilityAttr::Kind>>(Val)
15039 .Case("closed", EnumExtensibilityAttr::Kind::Closed)
15040 .Case("open", EnumExtensibilityAttr::Kind::Open)
15041 .Default(std::optional<EnumExtensibilityAttr::Kind>());
15042 if (R) {
15043 Out = *R;
15044 return true;
15045 }
15046 return false;
15047 }
15048
15049 const char *EnumExtensibilityAttr::ConvertKindToStr(EnumExtensibilityAttr::Kind Val) {
15050 switch(Val) {
15051 case EnumExtensibilityAttr::Kind::Closed: return "closed";
15052 case EnumExtensibilityAttr::Kind::Open: return "open";
15053 }
15054 llvm_unreachable("No enumerator with that value");
15055 }
15056 EnumExtensibilityAttr *EnumExtensibilityAttr::clone(ASTContext &C) const {
15057 auto *A = new (C) EnumExtensibilityAttr(C, *this, extensibility);
15058 A->Inherited = Inherited;
15059 A->IsPackExpansion = IsPackExpansion;
15060 A->setImplicit(Implicit);
15061 return A;
15062 }
15063
15064 void EnumExtensibilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
15065 bool IsFirstArgument = true; (void)IsFirstArgument;
15066 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
15067 switch (getAttributeSpellingListIndex()) {
15068 default:
15069 llvm_unreachable("Unknown attribute spelling!");
15070 break;
15071 case 0 : {
15072 OS << "__attribute__((enum_extensibility";
15073 DelimitAttributeArgument(OS, IsFirstArgument);
15074 OS << "\"" << EnumExtensibilityAttr::ConvertKindToStr(getExtensibility()) << "\"";
15075 if (!IsFirstArgument)
15076 OS << ")";
15077 OS << "))";
15078 break;
15079 }
15080 case 1 : {
15081 OS << "[[clang::enum_extensibility";
15082 DelimitAttributeArgument(OS, IsFirstArgument);
15083 OS << "\"" << EnumExtensibilityAttr::ConvertKindToStr(getExtensibility()) << "\"";
15084 if (!IsFirstArgument)
15085 OS << ")";
15086 OS << "]]";
15087 break;
15088 }
15089 case 2 : {
15090 OS << "[[clang::enum_extensibility";
15091 DelimitAttributeArgument(OS, IsFirstArgument);
15092 OS << "\"" << EnumExtensibilityAttr::ConvertKindToStr(getExtensibility()) << "\"";
15093 if (!IsFirstArgument)
15094 OS << ")";
15095 OS << "]]";
15096 break;
15097 }
15098 }
15099 }
15100
15101 const char *EnumExtensibilityAttr::getSpelling() const {
15102 switch (getAttributeSpellingListIndex()) {
15103 default:
15104 llvm_unreachable("Unknown attribute spelling!");
15105 return "(No spelling)";
15106 case 0:
15107 return "enum_extensibility";
15108 case 1:
15109 return "enum_extensibility";
15110 case 2:
15111 return "enum_extensibility";
15112 }
15113 }
15114
15115
15116 // ErrorAttr implementation
15117
15118 ErrorAttr *ErrorAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef UserDiagnostic, const AttributeCommonInfo &CommonInfo) {
15119 auto *A = new (Ctx) ErrorAttr(Ctx, CommonInfo, UserDiagnostic);
15120 A->setImplicit(true);
15121 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15122 A->setAttributeSpellingListIndex(0);
15123 return A;
15124 }
15125
15126 ErrorAttr *ErrorAttr::Create(ASTContext &Ctx, llvm::StringRef UserDiagnostic, const AttributeCommonInfo &CommonInfo) {
15127 auto *A = new (Ctx) ErrorAttr(Ctx, CommonInfo, UserDiagnostic);
15128 return A;
15129 }
15130
15131 ErrorAttr *ErrorAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef UserDiagnostic, SourceRange Range, Spelling S) {
15132 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15133 switch (S) {
15134 case GNU_error:
15135 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15136 case CXX11_gnu_error:
15137 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15138 case C23_gnu_error:
15139 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15140 case GNU_warning:
15141 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15142 case CXX11_gnu_warning:
15143 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15144 case C23_gnu_warning:
15145 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15146 default:
15147 llvm_unreachable("Unknown attribute spelling!");
15148 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15149 }
15150 }());
15151 return CreateImplicit(Ctx, UserDiagnostic, I);
15152 }
15153
15154 ErrorAttr *ErrorAttr::Create(ASTContext &Ctx, llvm::StringRef UserDiagnostic, SourceRange Range, Spelling S) {
15155 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15156 switch (S) {
15157 case GNU_error:
15158 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15159 case CXX11_gnu_error:
15160 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15161 case C23_gnu_error:
15162 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15163 case GNU_warning:
15164 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15165 case CXX11_gnu_warning:
15166 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15167 case C23_gnu_warning:
15168 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15169 default:
15170 llvm_unreachable("Unknown attribute spelling!");
15171 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15172 }
15173 }());
15174 return Create(Ctx, UserDiagnostic, I);
15175 }
15176
15177 ErrorAttr::ErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15178 , llvm::StringRef UserDiagnostic
15179 )
15180 : InheritableAttr(Ctx, CommonInfo, attr::Error, /*IsLateParsed=*/false, false)
15181 , userDiagnosticLength(UserDiagnostic.size()),userDiagnostic(new (Ctx, 1) char[userDiagnosticLength])
15182 {
15183 if (!UserDiagnostic.empty())
15184 std::memcpy(userDiagnostic, UserDiagnostic.data(), userDiagnosticLength);
15185 }
15186
15187 ErrorAttr::Spelling ErrorAttr::getSemanticSpelling() const {
15188 switch (getAttributeSpellingListIndex()) {
15189 default: llvm_unreachable("Unknown spelling list index");
15190 case 0: return GNU_error;
15191 case 1: return CXX11_gnu_error;
15192 case 2: return C23_gnu_error;
15193 case 3: return GNU_warning;
15194 case 4: return CXX11_gnu_warning;
15195 case 5: return C23_gnu_warning;
15196 }
15197 }
15198
15199
15200 ErrorAttr *ErrorAttr::clone(ASTContext &C) const {
15201 auto *A = new (C) ErrorAttr(C, *this, getUserDiagnostic());
15202 A->Inherited = Inherited;
15203 A->IsPackExpansion = IsPackExpansion;
15204 A->setImplicit(Implicit);
15205 return A;
15206 }
15207
15208 void ErrorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
15209 bool IsFirstArgument = true; (void)IsFirstArgument;
15210 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
15211 switch (getAttributeSpellingListIndex()) {
15212 default:
15213 llvm_unreachable("Unknown attribute spelling!");
15214 break;
15215 case 0 : {
15216 OS << "__attribute__((error";
15217 DelimitAttributeArgument(OS, IsFirstArgument);
15218 OS << "\"" << getUserDiagnostic() << "\"";
15219 if (!IsFirstArgument)
15220 OS << ")";
15221 OS << "))";
15222 break;
15223 }
15224 case 1 : {
15225 OS << "[[gnu::error";
15226 DelimitAttributeArgument(OS, IsFirstArgument);
15227 OS << "\"" << getUserDiagnostic() << "\"";
15228 if (!IsFirstArgument)
15229 OS << ")";
15230 OS << "]]";
15231 break;
15232 }
15233 case 2 : {
15234 OS << "[[gnu::error";
15235 DelimitAttributeArgument(OS, IsFirstArgument);
15236 OS << "\"" << getUserDiagnostic() << "\"";
15237 if (!IsFirstArgument)
15238 OS << ")";
15239 OS << "]]";
15240 break;
15241 }
15242 case 3 : {
15243 OS << "__attribute__((warning";
15244 DelimitAttributeArgument(OS, IsFirstArgument);
15245 OS << "\"" << getUserDiagnostic() << "\"";
15246 if (!IsFirstArgument)
15247 OS << ")";
15248 OS << "))";
15249 break;
15250 }
15251 case 4 : {
15252 OS << "[[gnu::warning";
15253 DelimitAttributeArgument(OS, IsFirstArgument);
15254 OS << "\"" << getUserDiagnostic() << "\"";
15255 if (!IsFirstArgument)
15256 OS << ")";
15257 OS << "]]";
15258 break;
15259 }
15260 case 5 : {
15261 OS << "[[gnu::warning";
15262 DelimitAttributeArgument(OS, IsFirstArgument);
15263 OS << "\"" << getUserDiagnostic() << "\"";
15264 if (!IsFirstArgument)
15265 OS << ")";
15266 OS << "]]";
15267 break;
15268 }
15269 }
15270 }
15271
15272 const char *ErrorAttr::getSpelling() const {
15273 switch (getAttributeSpellingListIndex()) {
15274 default:
15275 llvm_unreachable("Unknown attribute spelling!");
15276 return "(No spelling)";
15277 case 0:
15278 return "error";
15279 case 1:
15280 return "error";
15281 case 2:
15282 return "error";
15283 case 3:
15284 return "warning";
15285 case 4:
15286 return "warning";
15287 case 5:
15288 return "warning";
15289 }
15290 }
15291
15292
15293 // ExcludeFromExplicitInstantiationAttr implementation
15294
15295 ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
15296 auto *A = new (Ctx) ExcludeFromExplicitInstantiationAttr(Ctx, CommonInfo);
15297 A->setImplicit(true);
15298 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15299 A->setAttributeSpellingListIndex(0);
15300 return A;
15301 }
15302
15303 ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
15304 auto *A = new (Ctx) ExcludeFromExplicitInstantiationAttr(Ctx, CommonInfo);
15305 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15306 A->setAttributeSpellingListIndex(0);
15307 return A;
15308 }
15309
15310 ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
15311 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15312 switch (S) {
15313 case GNU_exclude_from_explicit_instantiation:
15314 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15315 case CXX11_clang_exclude_from_explicit_instantiation:
15316 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15317 case C23_clang_exclude_from_explicit_instantiation:
15318 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15319 default:
15320 llvm_unreachable("Unknown attribute spelling!");
15321 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15322 }
15323 }());
15324 return CreateImplicit(Ctx, I);
15325 }
15326
15327 ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
15328 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15329 switch (S) {
15330 case GNU_exclude_from_explicit_instantiation:
15331 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15332 case CXX11_clang_exclude_from_explicit_instantiation:
15333 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15334 case C23_clang_exclude_from_explicit_instantiation:
15335 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15336 default:
15337 llvm_unreachable("Unknown attribute spelling!");
15338 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15339 }
15340 }());
15341 return Create(Ctx, I);
15342 }
15343
15344 ExcludeFromExplicitInstantiationAttr::ExcludeFromExplicitInstantiationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15345 )
15346 : InheritableAttr(Ctx, CommonInfo, attr::ExcludeFromExplicitInstantiation, /*IsLateParsed=*/false, false)
15347 {
15348 }
15349
15350 ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::clone(ASTContext &C) const {
15351 auto *A = new (C) ExcludeFromExplicitInstantiationAttr(C, *this);
15352 A->Inherited = Inherited;
15353 A->IsPackExpansion = IsPackExpansion;
15354 A->setImplicit(Implicit);
15355 return A;
15356 }
15357
15358 void ExcludeFromExplicitInstantiationAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
15359 bool IsFirstArgument = true; (void)IsFirstArgument;
15360 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
15361 switch (getAttributeSpellingListIndex()) {
15362 default:
15363 llvm_unreachable("Unknown attribute spelling!");
15364 break;
15365 case 0 : {
15366 OS << "__attribute__((exclude_from_explicit_instantiation";
15367 OS << "))";
15368 break;
15369 }
15370 case 1 : {
15371 OS << "[[clang::exclude_from_explicit_instantiation";
15372 OS << "]]";
15373 break;
15374 }
15375 case 2 : {
15376 OS << "[[clang::exclude_from_explicit_instantiation";
15377 OS << "]]";
15378 break;
15379 }
15380 }
15381 }
15382
15383 const char *ExcludeFromExplicitInstantiationAttr::getSpelling() const {
15384 switch (getAttributeSpellingListIndex()) {
15385 default:
15386 llvm_unreachable("Unknown attribute spelling!");
15387 return "(No spelling)";
15388 case 0:
15389 return "exclude_from_explicit_instantiation";
15390 case 1:
15391 return "exclude_from_explicit_instantiation";
15392 case 2:
15393 return "exclude_from_explicit_instantiation";
15394 }
15395 }
15396
15397
15398 // ExclusiveTrylockFunctionAttr implementation
15399
15400 ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
15401 auto *A = new (Ctx) ExclusiveTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize);
15402 A->setImplicit(true);
15403 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15404 A->setAttributeSpellingListIndex(0);
15405 return A;
15406 }
15407
15408 ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
15409 auto *A = new (Ctx) ExclusiveTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize);
15410 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15411 A->setAttributeSpellingListIndex(0);
15412 return A;
15413 }
15414
15415 ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
15416 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
15417 return CreateImplicit(Ctx, SuccessValue, Args, ArgsSize, I);
15418 }
15419
15420 ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
15421 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
15422 return Create(Ctx, SuccessValue, Args, ArgsSize, I);
15423 }
15424
15425 ExclusiveTrylockFunctionAttr::ExclusiveTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15426 , Expr * SuccessValue
15427 , Expr * *Args, unsigned ArgsSize
15428 )
15429 : InheritableAttr(Ctx, CommonInfo, attr::ExclusiveTrylockFunction, /*IsLateParsed=*/true, true)
15430 , successValue(SuccessValue)
15431 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
15432 {
15433 std::copy(Args, Args + args_Size, args_);
15434 }
15435
15436 ExclusiveTrylockFunctionAttr::ExclusiveTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15437 , Expr * SuccessValue
15438 )
15439 : InheritableAttr(Ctx, CommonInfo, attr::ExclusiveTrylockFunction, /*IsLateParsed=*/true, true)
15440 , successValue(SuccessValue)
15441 , args_Size(0), args_(nullptr)
15442 {
15443 }
15444
15445
15446
15447
15448
15449 ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::clone(ASTContext &C) const {
15450 auto *A = new (C) ExclusiveTrylockFunctionAttr(C, *this, successValue, args_, args_Size);
15451 A->Inherited = Inherited;
15452 A->IsPackExpansion = IsPackExpansion;
15453 A->setImplicit(Implicit);
15454 return A;
15455 }
15456
15457 void ExclusiveTrylockFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
15458 bool IsFirstArgument = true; (void)IsFirstArgument;
15459 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
15460 switch (getAttributeSpellingListIndex()) {
15461 default:
15462 llvm_unreachable("Unknown attribute spelling!");
15463 break;
15464 case 0 : {
15465 OS << "__attribute__((exclusive_trylock_function";
15466 DelimitAttributeArgument(OS, IsFirstArgument);
15467 OS << "";
15468 getSuccessValue()->printPretty(OS, nullptr, Policy);
15469 OS << "";
15470 OS << "";
15471 for (const auto &Val : args()) {
15472 DelimitAttributeArgument(OS, IsFirstArgument);
15473 OS << Val;
15474 }
15475 OS << "";
15476 if (!IsFirstArgument)
15477 OS << ")";
15478 OS << "))";
15479 break;
15480 }
15481 }
15482 }
15483
15484 const char *ExclusiveTrylockFunctionAttr::getSpelling() const {
15485 switch (getAttributeSpellingListIndex()) {
15486 default:
15487 llvm_unreachable("Unknown attribute spelling!");
15488 return "(No spelling)";
15489 case 0:
15490 return "exclusive_trylock_function";
15491 }
15492 }
15493
15494
15495 // ExplicitInitAttr implementation
15496
15497 ExplicitInitAttr *ExplicitInitAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
15498 auto *A = new (Ctx) ExplicitInitAttr(Ctx, CommonInfo);
15499 A->setImplicit(true);
15500 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15501 A->setAttributeSpellingListIndex(0);
15502 return A;
15503 }
15504
15505 ExplicitInitAttr *ExplicitInitAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
15506 auto *A = new (Ctx) ExplicitInitAttr(Ctx, CommonInfo);
15507 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15508 A->setAttributeSpellingListIndex(0);
15509 return A;
15510 }
15511
15512 ExplicitInitAttr *ExplicitInitAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
15513 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15514 switch (S) {
15515 case GNU_require_explicit_initialization:
15516 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_require_explicit_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15517 case CXX11_clang_require_explicit_initialization:
15518 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_require_explicit_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15519 case C23_clang_require_explicit_initialization:
15520 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_require_explicit_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15521 default:
15522 llvm_unreachable("Unknown attribute spelling!");
15523 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15524 }
15525 }());
15526 return CreateImplicit(Ctx, I);
15527 }
15528
15529 ExplicitInitAttr *ExplicitInitAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
15530 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15531 switch (S) {
15532 case GNU_require_explicit_initialization:
15533 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_require_explicit_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15534 case CXX11_clang_require_explicit_initialization:
15535 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_require_explicit_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15536 case C23_clang_require_explicit_initialization:
15537 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_require_explicit_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15538 default:
15539 llvm_unreachable("Unknown attribute spelling!");
15540 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15541 }
15542 }());
15543 return Create(Ctx, I);
15544 }
15545
15546 ExplicitInitAttr::ExplicitInitAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15547 )
15548 : InheritableAttr(Ctx, CommonInfo, attr::ExplicitInit, /*IsLateParsed=*/false, false)
15549 {
15550 }
15551
15552 ExplicitInitAttr *ExplicitInitAttr::clone(ASTContext &C) const {
15553 auto *A = new (C) ExplicitInitAttr(C, *this);
15554 A->Inherited = Inherited;
15555 A->IsPackExpansion = IsPackExpansion;
15556 A->setImplicit(Implicit);
15557 return A;
15558 }
15559
15560 void ExplicitInitAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
15561 bool IsFirstArgument = true; (void)IsFirstArgument;
15562 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
15563 switch (getAttributeSpellingListIndex()) {
15564 default:
15565 llvm_unreachable("Unknown attribute spelling!");
15566 break;
15567 case 0 : {
15568 OS << "__attribute__((require_explicit_initialization";
15569 OS << "))";
15570 break;
15571 }
15572 case 1 : {
15573 OS << "[[clang::require_explicit_initialization";
15574 OS << "]]";
15575 break;
15576 }
15577 case 2 : {
15578 OS << "[[clang::require_explicit_initialization";
15579 OS << "]]";
15580 break;
15581 }
15582 }
15583 }
15584
15585 const char *ExplicitInitAttr::getSpelling() const {
15586 switch (getAttributeSpellingListIndex()) {
15587 default:
15588 llvm_unreachable("Unknown attribute spelling!");
15589 return "(No spelling)";
15590 case 0:
15591 return "require_explicit_initialization";
15592 case 1:
15593 return "require_explicit_initialization";
15594 case 2:
15595 return "require_explicit_initialization";
15596 }
15597 }
15598
15599
15600 // ExternalSourceSymbolAttr implementation
15601
15602 ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, llvm::StringRef USR, const AttributeCommonInfo &CommonInfo) {
15603 auto *A = new (Ctx) ExternalSourceSymbolAttr(Ctx, CommonInfo, Language, DefinedIn, GeneratedDeclaration, USR);
15604 A->setImplicit(true);
15605 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15606 A->setAttributeSpellingListIndex(0);
15607 return A;
15608 }
15609
15610 ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::Create(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, llvm::StringRef USR, const AttributeCommonInfo &CommonInfo) {
15611 auto *A = new (Ctx) ExternalSourceSymbolAttr(Ctx, CommonInfo, Language, DefinedIn, GeneratedDeclaration, USR);
15612 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15613 A->setAttributeSpellingListIndex(0);
15614 return A;
15615 }
15616
15617 ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, llvm::StringRef USR, SourceRange Range, Spelling S) {
15618 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15619 switch (S) {
15620 case GNU_external_source_symbol:
15621 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15622 case CXX11_clang_external_source_symbol:
15623 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15624 case C23_clang_external_source_symbol:
15625 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15626 default:
15627 llvm_unreachable("Unknown attribute spelling!");
15628 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15629 }
15630 }());
15631 return CreateImplicit(Ctx, Language, DefinedIn, GeneratedDeclaration, USR, I);
15632 }
15633
15634 ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::Create(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, llvm::StringRef USR, SourceRange Range, Spelling S) {
15635 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15636 switch (S) {
15637 case GNU_external_source_symbol:
15638 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15639 case CXX11_clang_external_source_symbol:
15640 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15641 case C23_clang_external_source_symbol:
15642 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15643 default:
15644 llvm_unreachable("Unknown attribute spelling!");
15645 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15646 }
15647 }());
15648 return Create(Ctx, Language, DefinedIn, GeneratedDeclaration, USR, I);
15649 }
15650
15651 ExternalSourceSymbolAttr::ExternalSourceSymbolAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15652 , llvm::StringRef Language
15653 , llvm::StringRef DefinedIn
15654 , bool GeneratedDeclaration
15655 , llvm::StringRef USR
15656 )
15657 : InheritableAttr(Ctx, CommonInfo, attr::ExternalSourceSymbol, /*IsLateParsed=*/false, false)
15658 , languageLength(Language.size()),language(new (Ctx, 1) char[languageLength])
15659 , definedInLength(DefinedIn.size()),definedIn(new (Ctx, 1) char[definedInLength])
15660 , generatedDeclaration(GeneratedDeclaration)
15661 , uSRLength(USR.size()),uSR(new (Ctx, 1) char[uSRLength])
15662 {
15663 if (!Language.empty())
15664 std::memcpy(language, Language.data(), languageLength);
15665 if (!DefinedIn.empty())
15666 std::memcpy(definedIn, DefinedIn.data(), definedInLength);
15667 if (!USR.empty())
15668 std::memcpy(uSR, USR.data(), uSRLength);
15669 }
15670
15671 ExternalSourceSymbolAttr::ExternalSourceSymbolAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15672 )
15673 : InheritableAttr(Ctx, CommonInfo, attr::ExternalSourceSymbol, /*IsLateParsed=*/false, false)
15674 , languageLength(0),language(nullptr)
15675 , definedInLength(0),definedIn(nullptr)
15676 , generatedDeclaration()
15677 , uSRLength(0),uSR(nullptr)
15678 {
15679 }
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689 ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::clone(ASTContext &C) const {
15690 auto *A = new (C) ExternalSourceSymbolAttr(C, *this, getLanguage(), getDefinedIn(), generatedDeclaration, getUSR());
15691 A->Inherited = Inherited;
15692 A->IsPackExpansion = IsPackExpansion;
15693 A->setImplicit(Implicit);
15694 return A;
15695 }
15696
15697 void ExternalSourceSymbolAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
15698 bool IsFirstArgument = true; (void)IsFirstArgument;
15699 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
15700 switch (getAttributeSpellingListIndex()) {
15701 default:
15702 llvm_unreachable("Unknown attribute spelling!");
15703 break;
15704 case 0 : {
15705 OS << "__attribute__((external_source_symbol";
15706 DelimitAttributeArgument(OS, IsFirstArgument);
15707 OS << "\"" << getLanguage() << "\"";
15708 DelimitAttributeArgument(OS, IsFirstArgument);
15709 OS << "\"" << getDefinedIn() << "\"";
15710 DelimitAttributeArgument(OS, IsFirstArgument);
15711 OS << "" << getGeneratedDeclaration() << "";
15712 DelimitAttributeArgument(OS, IsFirstArgument);
15713 OS << "\"" << getUSR() << "\"";
15714 if (!IsFirstArgument)
15715 OS << ")";
15716 OS << "))";
15717 break;
15718 }
15719 case 1 : {
15720 OS << "[[clang::external_source_symbol";
15721 DelimitAttributeArgument(OS, IsFirstArgument);
15722 OS << "\"" << getLanguage() << "\"";
15723 DelimitAttributeArgument(OS, IsFirstArgument);
15724 OS << "\"" << getDefinedIn() << "\"";
15725 DelimitAttributeArgument(OS, IsFirstArgument);
15726 OS << "" << getGeneratedDeclaration() << "";
15727 DelimitAttributeArgument(OS, IsFirstArgument);
15728 OS << "\"" << getUSR() << "\"";
15729 if (!IsFirstArgument)
15730 OS << ")";
15731 OS << "]]";
15732 break;
15733 }
15734 case 2 : {
15735 OS << "[[clang::external_source_symbol";
15736 DelimitAttributeArgument(OS, IsFirstArgument);
15737 OS << "\"" << getLanguage() << "\"";
15738 DelimitAttributeArgument(OS, IsFirstArgument);
15739 OS << "\"" << getDefinedIn() << "\"";
15740 DelimitAttributeArgument(OS, IsFirstArgument);
15741 OS << "" << getGeneratedDeclaration() << "";
15742 DelimitAttributeArgument(OS, IsFirstArgument);
15743 OS << "\"" << getUSR() << "\"";
15744 if (!IsFirstArgument)
15745 OS << ")";
15746 OS << "]]";
15747 break;
15748 }
15749 }
15750 }
15751
15752 const char *ExternalSourceSymbolAttr::getSpelling() const {
15753 switch (getAttributeSpellingListIndex()) {
15754 default:
15755 llvm_unreachable("Unknown attribute spelling!");
15756 return "(No spelling)";
15757 case 0:
15758 return "external_source_symbol";
15759 case 1:
15760 return "external_source_symbol";
15761 case 2:
15762 return "external_source_symbol";
15763 }
15764 }
15765
15766
15767 // FallThroughAttr implementation
15768
15769 FallThroughAttr *FallThroughAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
15770 auto *A = new (Ctx) FallThroughAttr(Ctx, CommonInfo);
15771 A->setImplicit(true);
15772 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15773 A->setAttributeSpellingListIndex(0);
15774 return A;
15775 }
15776
15777 FallThroughAttr *FallThroughAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
15778 auto *A = new (Ctx) FallThroughAttr(Ctx, CommonInfo);
15779 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15780 A->setAttributeSpellingListIndex(0);
15781 return A;
15782 }
15783
15784 FallThroughAttr *FallThroughAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
15785 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15786 switch (S) {
15787 case CXX11_fallthrough:
15788 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15789 case C23_fallthrough:
15790 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15791 case CXX11_clang_fallthrough:
15792 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15793 case GNU_fallthrough:
15794 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15795 case CXX11_gnu_fallthrough:
15796 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15797 case C23_gnu_fallthrough:
15798 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15799 default:
15800 llvm_unreachable("Unknown attribute spelling!");
15801 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15802 }
15803 }());
15804 return CreateImplicit(Ctx, I);
15805 }
15806
15807 FallThroughAttr *FallThroughAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
15808 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15809 switch (S) {
15810 case CXX11_fallthrough:
15811 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15812 case C23_fallthrough:
15813 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15814 case CXX11_clang_fallthrough:
15815 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15816 case GNU_fallthrough:
15817 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15818 case CXX11_gnu_fallthrough:
15819 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15820 case C23_gnu_fallthrough:
15821 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15822 default:
15823 llvm_unreachable("Unknown attribute spelling!");
15824 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15825 }
15826 }());
15827 return Create(Ctx, I);
15828 }
15829
15830 FallThroughAttr::FallThroughAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15831 )
15832 : StmtAttr(Ctx, CommonInfo, attr::FallThrough, /*IsLateParsed=*/false)
15833 {
15834 }
15835
15836 FallThroughAttr *FallThroughAttr::clone(ASTContext &C) const {
15837 auto *A = new (C) FallThroughAttr(C, *this);
15838 A->Inherited = Inherited;
15839 A->IsPackExpansion = IsPackExpansion;
15840 A->setImplicit(Implicit);
15841 return A;
15842 }
15843
15844 void FallThroughAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
15845 bool IsFirstArgument = true; (void)IsFirstArgument;
15846 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
15847 switch (getAttributeSpellingListIndex()) {
15848 default:
15849 llvm_unreachable("Unknown attribute spelling!");
15850 break;
15851 case 0 : {
15852 OS << "[[fallthrough";
15853 OS << "]]";
15854 break;
15855 }
15856 case 1 : {
15857 OS << "[[fallthrough";
15858 OS << "]]";
15859 break;
15860 }
15861 case 2 : {
15862 OS << "[[clang::fallthrough";
15863 OS << "]]";
15864 break;
15865 }
15866 case 3 : {
15867 OS << "__attribute__((fallthrough";
15868 OS << "))";
15869 break;
15870 }
15871 case 4 : {
15872 OS << "[[gnu::fallthrough";
15873 OS << "]]";
15874 break;
15875 }
15876 case 5 : {
15877 OS << "[[gnu::fallthrough";
15878 OS << "]]";
15879 break;
15880 }
15881 }
15882 }
15883
15884 const char *FallThroughAttr::getSpelling() const {
15885 switch (getAttributeSpellingListIndex()) {
15886 default:
15887 llvm_unreachable("Unknown attribute spelling!");
15888 return "(No spelling)";
15889 case 0:
15890 return "fallthrough";
15891 case 1:
15892 return "fallthrough";
15893 case 2:
15894 return "fallthrough";
15895 case 3:
15896 return "fallthrough";
15897 case 4:
15898 return "fallthrough";
15899 case 5:
15900 return "fallthrough";
15901 }
15902 }
15903
15904
15905 // FastCallAttr implementation
15906
15907 FastCallAttr *FastCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
15908 auto *A = new (Ctx) FastCallAttr(Ctx, CommonInfo);
15909 A->setImplicit(true);
15910 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15911 A->setAttributeSpellingListIndex(0);
15912 return A;
15913 }
15914
15915 FastCallAttr *FastCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
15916 auto *A = new (Ctx) FastCallAttr(Ctx, CommonInfo);
15917 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
15918 A->setAttributeSpellingListIndex(0);
15919 return A;
15920 }
15921
15922 FastCallAttr *FastCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
15923 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15924 switch (S) {
15925 case GNU_fastcall:
15926 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15927 case CXX11_gnu_fastcall:
15928 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15929 case C23_gnu_fastcall:
15930 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15931 case Keyword_fastcall:
15932 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15933 default:
15934 llvm_unreachable("Unknown attribute spelling!");
15935 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15936 }
15937 }());
15938 return CreateImplicit(Ctx, I);
15939 }
15940
15941 FastCallAttr *FastCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
15942 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
15943 switch (S) {
15944 case GNU_fastcall:
15945 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15946 case CXX11_gnu_fastcall:
15947 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15948 case C23_gnu_fastcall:
15949 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15950 case Keyword_fastcall:
15951 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15952 default:
15953 llvm_unreachable("Unknown attribute spelling!");
15954 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
15955 }
15956 }());
15957 return Create(Ctx, I);
15958 }
15959
15960 FastCallAttr::FastCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
15961 )
15962 : InheritableAttr(Ctx, CommonInfo, attr::FastCall, /*IsLateParsed=*/false, false)
15963 {
15964 }
15965
15966 FastCallAttr *FastCallAttr::clone(ASTContext &C) const {
15967 auto *A = new (C) FastCallAttr(C, *this);
15968 A->Inherited = Inherited;
15969 A->IsPackExpansion = IsPackExpansion;
15970 A->setImplicit(Implicit);
15971 return A;
15972 }
15973
15974 void FastCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
15975 bool IsFirstArgument = true; (void)IsFirstArgument;
15976 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
15977 switch (getAttributeSpellingListIndex()) {
15978 default:
15979 llvm_unreachable("Unknown attribute spelling!");
15980 break;
15981 case 0 : {
15982 OS << "__attribute__((fastcall";
15983 OS << "))";
15984 break;
15985 }
15986 case 1 : {
15987 OS << "[[gnu::fastcall";
15988 OS << "]]";
15989 break;
15990 }
15991 case 2 : {
15992 OS << "[[gnu::fastcall";
15993 OS << "]]";
15994 break;
15995 }
15996 case 3 : {
15997 OS << "__fastcall";
15998 OS << "";
15999 break;
16000 }
16001 case 4 : {
16002 OS << "_fastcall";
16003 OS << "";
16004 break;
16005 }
16006 }
16007 }
16008
16009 const char *FastCallAttr::getSpelling() const {
16010 switch (getAttributeSpellingListIndex()) {
16011 default:
16012 llvm_unreachable("Unknown attribute spelling!");
16013 return "(No spelling)";
16014 case 0:
16015 return "fastcall";
16016 case 1:
16017 return "fastcall";
16018 case 2:
16019 return "fastcall";
16020 case 3:
16021 return "__fastcall";
16022 case 4:
16023 return "_fastcall";
16024 }
16025 }
16026
16027
16028 // FinalAttr implementation
16029
16030 FinalAttr *FinalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16031 auto *A = new (Ctx) FinalAttr(Ctx, CommonInfo);
16032 A->setImplicit(true);
16033 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16034 A->setAttributeSpellingListIndex(0);
16035 return A;
16036 }
16037
16038 FinalAttr *FinalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16039 auto *A = new (Ctx) FinalAttr(Ctx, CommonInfo);
16040 return A;
16041 }
16042
16043 FinalAttr *FinalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
16044 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16045 switch (S) {
16046 case Keyword_final:
16047 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_final, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16048 case Keyword_sealed:
16049 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_sealed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16050 default:
16051 llvm_unreachable("Unknown attribute spelling!");
16052 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16053 }
16054 }());
16055 return CreateImplicit(Ctx, I);
16056 }
16057
16058 FinalAttr *FinalAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
16059 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16060 switch (S) {
16061 case Keyword_final:
16062 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_final, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16063 case Keyword_sealed:
16064 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_sealed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16065 default:
16066 llvm_unreachable("Unknown attribute spelling!");
16067 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16068 }
16069 }());
16070 return Create(Ctx, I);
16071 }
16072
16073 FinalAttr::FinalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
16074 )
16075 : InheritableAttr(Ctx, CommonInfo, attr::Final, /*IsLateParsed=*/false, false)
16076 {
16077 }
16078
16079 FinalAttr::Spelling FinalAttr::getSemanticSpelling() const {
16080 switch (getAttributeSpellingListIndex()) {
16081 default: llvm_unreachable("Unknown spelling list index");
16082 case 0: return Keyword_final;
16083 case 1: return Keyword_sealed;
16084 }
16085 }
16086 FinalAttr *FinalAttr::clone(ASTContext &C) const {
16087 auto *A = new (C) FinalAttr(C, *this);
16088 A->Inherited = Inherited;
16089 A->IsPackExpansion = IsPackExpansion;
16090 A->setImplicit(Implicit);
16091 return A;
16092 }
16093
16094 void FinalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
16095 bool IsFirstArgument = true; (void)IsFirstArgument;
16096 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
16097 switch (getAttributeSpellingListIndex()) {
16098 default:
16099 llvm_unreachable("Unknown attribute spelling!");
16100 break;
16101 case 0 : {
16102 OS << "final";
16103 OS << "";
16104 break;
16105 }
16106 case 1 : {
16107 OS << "sealed";
16108 OS << "";
16109 break;
16110 }
16111 }
16112 }
16113
16114 const char *FinalAttr::getSpelling() const {
16115 switch (getAttributeSpellingListIndex()) {
16116 default:
16117 llvm_unreachable("Unknown attribute spelling!");
16118 return "(No spelling)";
16119 case 0:
16120 return "final";
16121 case 1:
16122 return "sealed";
16123 }
16124 }
16125
16126
16127 // FlagEnumAttr implementation
16128
16129 FlagEnumAttr *FlagEnumAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16130 auto *A = new (Ctx) FlagEnumAttr(Ctx, CommonInfo);
16131 A->setImplicit(true);
16132 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16133 A->setAttributeSpellingListIndex(0);
16134 return A;
16135 }
16136
16137 FlagEnumAttr *FlagEnumAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16138 auto *A = new (Ctx) FlagEnumAttr(Ctx, CommonInfo);
16139 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16140 A->setAttributeSpellingListIndex(0);
16141 return A;
16142 }
16143
16144 FlagEnumAttr *FlagEnumAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
16145 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16146 switch (S) {
16147 case GNU_flag_enum:
16148 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16149 case CXX11_clang_flag_enum:
16150 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16151 case C23_clang_flag_enum:
16152 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16153 default:
16154 llvm_unreachable("Unknown attribute spelling!");
16155 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16156 }
16157 }());
16158 return CreateImplicit(Ctx, I);
16159 }
16160
16161 FlagEnumAttr *FlagEnumAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
16162 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16163 switch (S) {
16164 case GNU_flag_enum:
16165 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16166 case CXX11_clang_flag_enum:
16167 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16168 case C23_clang_flag_enum:
16169 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16170 default:
16171 llvm_unreachable("Unknown attribute spelling!");
16172 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16173 }
16174 }());
16175 return Create(Ctx, I);
16176 }
16177
16178 FlagEnumAttr::FlagEnumAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
16179 )
16180 : InheritableAttr(Ctx, CommonInfo, attr::FlagEnum, /*IsLateParsed=*/false, false)
16181 {
16182 }
16183
16184 FlagEnumAttr *FlagEnumAttr::clone(ASTContext &C) const {
16185 auto *A = new (C) FlagEnumAttr(C, *this);
16186 A->Inherited = Inherited;
16187 A->IsPackExpansion = IsPackExpansion;
16188 A->setImplicit(Implicit);
16189 return A;
16190 }
16191
16192 void FlagEnumAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
16193 bool IsFirstArgument = true; (void)IsFirstArgument;
16194 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
16195 switch (getAttributeSpellingListIndex()) {
16196 default:
16197 llvm_unreachable("Unknown attribute spelling!");
16198 break;
16199 case 0 : {
16200 OS << "__attribute__((flag_enum";
16201 OS << "))";
16202 break;
16203 }
16204 case 1 : {
16205 OS << "[[clang::flag_enum";
16206 OS << "]]";
16207 break;
16208 }
16209 case 2 : {
16210 OS << "[[clang::flag_enum";
16211 OS << "]]";
16212 break;
16213 }
16214 }
16215 }
16216
16217 const char *FlagEnumAttr::getSpelling() const {
16218 switch (getAttributeSpellingListIndex()) {
16219 default:
16220 llvm_unreachable("Unknown attribute spelling!");
16221 return "(No spelling)";
16222 case 0:
16223 return "flag_enum";
16224 case 1:
16225 return "flag_enum";
16226 case 2:
16227 return "flag_enum";
16228 }
16229 }
16230
16231
16232 // FlattenAttr implementation
16233
16234 FlattenAttr *FlattenAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16235 auto *A = new (Ctx) FlattenAttr(Ctx, CommonInfo);
16236 A->setImplicit(true);
16237 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16238 A->setAttributeSpellingListIndex(0);
16239 return A;
16240 }
16241
16242 FlattenAttr *FlattenAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16243 auto *A = new (Ctx) FlattenAttr(Ctx, CommonInfo);
16244 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16245 A->setAttributeSpellingListIndex(0);
16246 return A;
16247 }
16248
16249 FlattenAttr *FlattenAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
16250 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16251 switch (S) {
16252 case GNU_flatten:
16253 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16254 case CXX11_gnu_flatten:
16255 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16256 case C23_gnu_flatten:
16257 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16258 default:
16259 llvm_unreachable("Unknown attribute spelling!");
16260 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16261 }
16262 }());
16263 return CreateImplicit(Ctx, I);
16264 }
16265
16266 FlattenAttr *FlattenAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
16267 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16268 switch (S) {
16269 case GNU_flatten:
16270 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16271 case CXX11_gnu_flatten:
16272 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16273 case C23_gnu_flatten:
16274 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16275 default:
16276 llvm_unreachable("Unknown attribute spelling!");
16277 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16278 }
16279 }());
16280 return Create(Ctx, I);
16281 }
16282
16283 FlattenAttr::FlattenAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
16284 )
16285 : InheritableAttr(Ctx, CommonInfo, attr::Flatten, /*IsLateParsed=*/false, false)
16286 {
16287 }
16288
16289 FlattenAttr *FlattenAttr::clone(ASTContext &C) const {
16290 auto *A = new (C) FlattenAttr(C, *this);
16291 A->Inherited = Inherited;
16292 A->IsPackExpansion = IsPackExpansion;
16293 A->setImplicit(Implicit);
16294 return A;
16295 }
16296
16297 void FlattenAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
16298 bool IsFirstArgument = true; (void)IsFirstArgument;
16299 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
16300 switch (getAttributeSpellingListIndex()) {
16301 default:
16302 llvm_unreachable("Unknown attribute spelling!");
16303 break;
16304 case 0 : {
16305 OS << "__attribute__((flatten";
16306 OS << "))";
16307 break;
16308 }
16309 case 1 : {
16310 OS << "[[gnu::flatten";
16311 OS << "]]";
16312 break;
16313 }
16314 case 2 : {
16315 OS << "[[gnu::flatten";
16316 OS << "]]";
16317 break;
16318 }
16319 }
16320 }
16321
16322 const char *FlattenAttr::getSpelling() const {
16323 switch (getAttributeSpellingListIndex()) {
16324 default:
16325 llvm_unreachable("Unknown attribute spelling!");
16326 return "(No spelling)";
16327 case 0:
16328 return "flatten";
16329 case 1:
16330 return "flatten";
16331 case 2:
16332 return "flatten";
16333 }
16334 }
16335
16336
16337 // FormatAttr implementation
16338
16339 FormatAttr *FormatAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, const AttributeCommonInfo &CommonInfo) {
16340 auto *A = new (Ctx) FormatAttr(Ctx, CommonInfo, Type, FormatIdx, FirstArg);
16341 A->setImplicit(true);
16342 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16343 A->setAttributeSpellingListIndex(0);
16344 return A;
16345 }
16346
16347 FormatAttr *FormatAttr::Create(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, const AttributeCommonInfo &CommonInfo) {
16348 auto *A = new (Ctx) FormatAttr(Ctx, CommonInfo, Type, FormatIdx, FirstArg);
16349 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16350 A->setAttributeSpellingListIndex(0);
16351 return A;
16352 }
16353
16354 FormatAttr *FormatAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, SourceRange Range, Spelling S) {
16355 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16356 switch (S) {
16357 case GNU_format:
16358 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16359 case CXX11_gnu_format:
16360 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16361 case C23_gnu_format:
16362 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16363 default:
16364 llvm_unreachable("Unknown attribute spelling!");
16365 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16366 }
16367 }());
16368 return CreateImplicit(Ctx, Type, FormatIdx, FirstArg, I);
16369 }
16370
16371 FormatAttr *FormatAttr::Create(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, SourceRange Range, Spelling S) {
16372 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16373 switch (S) {
16374 case GNU_format:
16375 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16376 case CXX11_gnu_format:
16377 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16378 case C23_gnu_format:
16379 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16380 default:
16381 llvm_unreachable("Unknown attribute spelling!");
16382 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16383 }
16384 }());
16385 return Create(Ctx, Type, FormatIdx, FirstArg, I);
16386 }
16387
16388 FormatAttr::FormatAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
16389 , IdentifierInfo * Type
16390 , int FormatIdx
16391 , int FirstArg
16392 )
16393 : InheritableAttr(Ctx, CommonInfo, attr::Format, /*IsLateParsed=*/false, false)
16394 , type(Type)
16395 , formatIdx(FormatIdx)
16396 , firstArg(FirstArg)
16397 {
16398 }
16399
16400
16401
16402
16403
16404
16405
16406 FormatAttr *FormatAttr::clone(ASTContext &C) const {
16407 auto *A = new (C) FormatAttr(C, *this, type, formatIdx, firstArg);
16408 A->Inherited = Inherited;
16409 A->IsPackExpansion = IsPackExpansion;
16410 A->setImplicit(Implicit);
16411 return A;
16412 }
16413
16414 void FormatAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
16415 bool IsFirstArgument = true; (void)IsFirstArgument;
16416 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
16417 switch (getAttributeSpellingListIndex()) {
16418 default:
16419 llvm_unreachable("Unknown attribute spelling!");
16420 break;
16421 case 0 : {
16422 OS << "__attribute__((format";
16423 DelimitAttributeArgument(OS, IsFirstArgument);
16424 OS << "" << (getType() ? getType()->getName() : "") << "";
16425 DelimitAttributeArgument(OS, IsFirstArgument);
16426 OS << "" << getFormatIdx() << "";
16427 DelimitAttributeArgument(OS, IsFirstArgument);
16428 OS << "" << getFirstArg() << "";
16429 if (!IsFirstArgument)
16430 OS << ")";
16431 OS << "))";
16432 break;
16433 }
16434 case 1 : {
16435 OS << "[[gnu::format";
16436 DelimitAttributeArgument(OS, IsFirstArgument);
16437 OS << "" << (getType() ? getType()->getName() : "") << "";
16438 DelimitAttributeArgument(OS, IsFirstArgument);
16439 OS << "" << getFormatIdx() << "";
16440 DelimitAttributeArgument(OS, IsFirstArgument);
16441 OS << "" << getFirstArg() << "";
16442 if (!IsFirstArgument)
16443 OS << ")";
16444 OS << "]]";
16445 break;
16446 }
16447 case 2 : {
16448 OS << "[[gnu::format";
16449 DelimitAttributeArgument(OS, IsFirstArgument);
16450 OS << "" << (getType() ? getType()->getName() : "") << "";
16451 DelimitAttributeArgument(OS, IsFirstArgument);
16452 OS << "" << getFormatIdx() << "";
16453 DelimitAttributeArgument(OS, IsFirstArgument);
16454 OS << "" << getFirstArg() << "";
16455 if (!IsFirstArgument)
16456 OS << ")";
16457 OS << "]]";
16458 break;
16459 }
16460 }
16461 }
16462
16463 const char *FormatAttr::getSpelling() const {
16464 switch (getAttributeSpellingListIndex()) {
16465 default:
16466 llvm_unreachable("Unknown attribute spelling!");
16467 return "(No spelling)";
16468 case 0:
16469 return "format";
16470 case 1:
16471 return "format";
16472 case 2:
16473 return "format";
16474 }
16475 }
16476
16477
16478 // FormatArgAttr implementation
16479
16480 FormatArgAttr *FormatArgAttr::CreateImplicit(ASTContext &Ctx, ParamIdx FormatIdx, const AttributeCommonInfo &CommonInfo) {
16481 auto *A = new (Ctx) FormatArgAttr(Ctx, CommonInfo, FormatIdx);
16482 A->setImplicit(true);
16483 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16484 A->setAttributeSpellingListIndex(0);
16485 return A;
16486 }
16487
16488 FormatArgAttr *FormatArgAttr::Create(ASTContext &Ctx, ParamIdx FormatIdx, const AttributeCommonInfo &CommonInfo) {
16489 auto *A = new (Ctx) FormatArgAttr(Ctx, CommonInfo, FormatIdx);
16490 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16491 A->setAttributeSpellingListIndex(0);
16492 return A;
16493 }
16494
16495 FormatArgAttr *FormatArgAttr::CreateImplicit(ASTContext &Ctx, ParamIdx FormatIdx, SourceRange Range, Spelling S) {
16496 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16497 switch (S) {
16498 case GNU_format_arg:
16499 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16500 case CXX11_gnu_format_arg:
16501 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16502 case C23_gnu_format_arg:
16503 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16504 default:
16505 llvm_unreachable("Unknown attribute spelling!");
16506 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16507 }
16508 }());
16509 return CreateImplicit(Ctx, FormatIdx, I);
16510 }
16511
16512 FormatArgAttr *FormatArgAttr::Create(ASTContext &Ctx, ParamIdx FormatIdx, SourceRange Range, Spelling S) {
16513 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16514 switch (S) {
16515 case GNU_format_arg:
16516 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16517 case CXX11_gnu_format_arg:
16518 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16519 case C23_gnu_format_arg:
16520 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16521 default:
16522 llvm_unreachable("Unknown attribute spelling!");
16523 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16524 }
16525 }());
16526 return Create(Ctx, FormatIdx, I);
16527 }
16528
16529 FormatArgAttr::FormatArgAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
16530 , ParamIdx FormatIdx
16531 )
16532 : InheritableAttr(Ctx, CommonInfo, attr::FormatArg, /*IsLateParsed=*/false, false)
16533 , formatIdx(FormatIdx)
16534 {
16535 }
16536
16537
16538
16539 FormatArgAttr *FormatArgAttr::clone(ASTContext &C) const {
16540 auto *A = new (C) FormatArgAttr(C, *this, formatIdx);
16541 A->Inherited = Inherited;
16542 A->IsPackExpansion = IsPackExpansion;
16543 A->setImplicit(Implicit);
16544 return A;
16545 }
16546
16547 void FormatArgAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
16548 bool IsFirstArgument = true; (void)IsFirstArgument;
16549 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
16550 switch (getAttributeSpellingListIndex()) {
16551 default:
16552 llvm_unreachable("Unknown attribute spelling!");
16553 break;
16554 case 0 : {
16555 OS << "__attribute__((format_arg";
16556 DelimitAttributeArgument(OS, IsFirstArgument);
16557 OS << "" << getFormatIdx().getSourceIndex() << "";
16558 if (!IsFirstArgument)
16559 OS << ")";
16560 OS << "))";
16561 break;
16562 }
16563 case 1 : {
16564 OS << "[[gnu::format_arg";
16565 DelimitAttributeArgument(OS, IsFirstArgument);
16566 OS << "" << getFormatIdx().getSourceIndex() << "";
16567 if (!IsFirstArgument)
16568 OS << ")";
16569 OS << "]]";
16570 break;
16571 }
16572 case 2 : {
16573 OS << "[[gnu::format_arg";
16574 DelimitAttributeArgument(OS, IsFirstArgument);
16575 OS << "" << getFormatIdx().getSourceIndex() << "";
16576 if (!IsFirstArgument)
16577 OS << ")";
16578 OS << "]]";
16579 break;
16580 }
16581 }
16582 }
16583
16584 const char *FormatArgAttr::getSpelling() const {
16585 switch (getAttributeSpellingListIndex()) {
16586 default:
16587 llvm_unreachable("Unknown attribute spelling!");
16588 return "(No spelling)";
16589 case 0:
16590 return "format_arg";
16591 case 1:
16592 return "format_arg";
16593 case 2:
16594 return "format_arg";
16595 }
16596 }
16597
16598
16599 // FunctionReturnThunksAttr implementation
16600
16601 FunctionReturnThunksAttr *FunctionReturnThunksAttr::CreateImplicit(ASTContext &Ctx, FunctionReturnThunksAttr::Kind ThunkType, const AttributeCommonInfo &CommonInfo) {
16602 auto *A = new (Ctx) FunctionReturnThunksAttr(Ctx, CommonInfo, ThunkType);
16603 A->setImplicit(true);
16604 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16605 A->setAttributeSpellingListIndex(0);
16606 return A;
16607 }
16608
16609 FunctionReturnThunksAttr *FunctionReturnThunksAttr::Create(ASTContext &Ctx, FunctionReturnThunksAttr::Kind ThunkType, const AttributeCommonInfo &CommonInfo) {
16610 auto *A = new (Ctx) FunctionReturnThunksAttr(Ctx, CommonInfo, ThunkType);
16611 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16612 A->setAttributeSpellingListIndex(0);
16613 return A;
16614 }
16615
16616 FunctionReturnThunksAttr *FunctionReturnThunksAttr::CreateImplicit(ASTContext &Ctx, FunctionReturnThunksAttr::Kind ThunkType, SourceRange Range, Spelling S) {
16617 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16618 switch (S) {
16619 case GNU_function_return:
16620 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16621 case CXX11_gnu_function_return:
16622 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16623 case C23_gnu_function_return:
16624 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16625 default:
16626 llvm_unreachable("Unknown attribute spelling!");
16627 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16628 }
16629 }());
16630 return CreateImplicit(Ctx, ThunkType, I);
16631 }
16632
16633 FunctionReturnThunksAttr *FunctionReturnThunksAttr::Create(ASTContext &Ctx, FunctionReturnThunksAttr::Kind ThunkType, SourceRange Range, Spelling S) {
16634 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16635 switch (S) {
16636 case GNU_function_return:
16637 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16638 case CXX11_gnu_function_return:
16639 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16640 case C23_gnu_function_return:
16641 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16642 default:
16643 llvm_unreachable("Unknown attribute spelling!");
16644 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16645 }
16646 }());
16647 return Create(Ctx, ThunkType, I);
16648 }
16649
16650 FunctionReturnThunksAttr::FunctionReturnThunksAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
16651 , FunctionReturnThunksAttr::Kind ThunkType
16652 )
16653 : InheritableAttr(Ctx, CommonInfo, attr::FunctionReturnThunks, /*IsLateParsed=*/false, false)
16654 , thunkType(ThunkType)
16655 {
16656 }
16657
16658
16659
16660 bool FunctionReturnThunksAttr::ConvertStrToKind(StringRef Val, FunctionReturnThunksAttr::Kind &Out) {
16661 std::optional<FunctionReturnThunksAttr::Kind> R = llvm::StringSwitch<std::optional<FunctionReturnThunksAttr::Kind>>(Val)
16662 .Case("keep", FunctionReturnThunksAttr::Kind::Keep)
16663 .Case("thunk-extern", FunctionReturnThunksAttr::Kind::Extern)
16664 .Default(std::optional<FunctionReturnThunksAttr::Kind>());
16665 if (R) {
16666 Out = *R;
16667 return true;
16668 }
16669 return false;
16670 }
16671
16672 const char *FunctionReturnThunksAttr::ConvertKindToStr(FunctionReturnThunksAttr::Kind Val) {
16673 switch(Val) {
16674 case FunctionReturnThunksAttr::Kind::Keep: return "keep";
16675 case FunctionReturnThunksAttr::Kind::Extern: return "thunk-extern";
16676 }
16677 llvm_unreachable("No enumerator with that value");
16678 }
16679 FunctionReturnThunksAttr *FunctionReturnThunksAttr::clone(ASTContext &C) const {
16680 auto *A = new (C) FunctionReturnThunksAttr(C, *this, thunkType);
16681 A->Inherited = Inherited;
16682 A->IsPackExpansion = IsPackExpansion;
16683 A->setImplicit(Implicit);
16684 return A;
16685 }
16686
16687 void FunctionReturnThunksAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
16688 bool IsFirstArgument = true; (void)IsFirstArgument;
16689 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
16690 switch (getAttributeSpellingListIndex()) {
16691 default:
16692 llvm_unreachable("Unknown attribute spelling!");
16693 break;
16694 case 0 : {
16695 OS << "__attribute__((function_return";
16696 DelimitAttributeArgument(OS, IsFirstArgument);
16697 OS << "\"" << FunctionReturnThunksAttr::ConvertKindToStr(getThunkType()) << "\"";
16698 if (!IsFirstArgument)
16699 OS << ")";
16700 OS << "))";
16701 break;
16702 }
16703 case 1 : {
16704 OS << "[[gnu::function_return";
16705 DelimitAttributeArgument(OS, IsFirstArgument);
16706 OS << "\"" << FunctionReturnThunksAttr::ConvertKindToStr(getThunkType()) << "\"";
16707 if (!IsFirstArgument)
16708 OS << ")";
16709 OS << "]]";
16710 break;
16711 }
16712 case 2 : {
16713 OS << "[[gnu::function_return";
16714 DelimitAttributeArgument(OS, IsFirstArgument);
16715 OS << "\"" << FunctionReturnThunksAttr::ConvertKindToStr(getThunkType()) << "\"";
16716 if (!IsFirstArgument)
16717 OS << ")";
16718 OS << "]]";
16719 break;
16720 }
16721 }
16722 }
16723
16724 const char *FunctionReturnThunksAttr::getSpelling() const {
16725 switch (getAttributeSpellingListIndex()) {
16726 default:
16727 llvm_unreachable("Unknown attribute spelling!");
16728 return "(No spelling)";
16729 case 0:
16730 return "function_return";
16731 case 1:
16732 return "function_return";
16733 case 2:
16734 return "function_return";
16735 }
16736 }
16737
16738
16739 // GNUInlineAttr implementation
16740
16741 GNUInlineAttr *GNUInlineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16742 auto *A = new (Ctx) GNUInlineAttr(Ctx, CommonInfo);
16743 A->setImplicit(true);
16744 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16745 A->setAttributeSpellingListIndex(0);
16746 return A;
16747 }
16748
16749 GNUInlineAttr *GNUInlineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16750 auto *A = new (Ctx) GNUInlineAttr(Ctx, CommonInfo);
16751 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16752 A->setAttributeSpellingListIndex(0);
16753 return A;
16754 }
16755
16756 GNUInlineAttr *GNUInlineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
16757 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16758 switch (S) {
16759 case GNU_gnu_inline:
16760 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16761 case CXX11_gnu_gnu_inline:
16762 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16763 case C23_gnu_gnu_inline:
16764 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16765 default:
16766 llvm_unreachable("Unknown attribute spelling!");
16767 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16768 }
16769 }());
16770 return CreateImplicit(Ctx, I);
16771 }
16772
16773 GNUInlineAttr *GNUInlineAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
16774 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16775 switch (S) {
16776 case GNU_gnu_inline:
16777 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16778 case CXX11_gnu_gnu_inline:
16779 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16780 case C23_gnu_gnu_inline:
16781 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16782 default:
16783 llvm_unreachable("Unknown attribute spelling!");
16784 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16785 }
16786 }());
16787 return Create(Ctx, I);
16788 }
16789
16790 GNUInlineAttr::GNUInlineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
16791 )
16792 : InheritableAttr(Ctx, CommonInfo, attr::GNUInline, /*IsLateParsed=*/false, false)
16793 {
16794 }
16795
16796 GNUInlineAttr *GNUInlineAttr::clone(ASTContext &C) const {
16797 auto *A = new (C) GNUInlineAttr(C, *this);
16798 A->Inherited = Inherited;
16799 A->IsPackExpansion = IsPackExpansion;
16800 A->setImplicit(Implicit);
16801 return A;
16802 }
16803
16804 void GNUInlineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
16805 bool IsFirstArgument = true; (void)IsFirstArgument;
16806 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
16807 switch (getAttributeSpellingListIndex()) {
16808 default:
16809 llvm_unreachable("Unknown attribute spelling!");
16810 break;
16811 case 0 : {
16812 OS << "__attribute__((gnu_inline";
16813 OS << "))";
16814 break;
16815 }
16816 case 1 : {
16817 OS << "[[gnu::gnu_inline";
16818 OS << "]]";
16819 break;
16820 }
16821 case 2 : {
16822 OS << "[[gnu::gnu_inline";
16823 OS << "]]";
16824 break;
16825 }
16826 }
16827 }
16828
16829 const char *GNUInlineAttr::getSpelling() const {
16830 switch (getAttributeSpellingListIndex()) {
16831 default:
16832 llvm_unreachable("Unknown attribute spelling!");
16833 return "(No spelling)";
16834 case 0:
16835 return "gnu_inline";
16836 case 1:
16837 return "gnu_inline";
16838 case 2:
16839 return "gnu_inline";
16840 }
16841 }
16842
16843
16844 // GuardedByAttr implementation
16845
16846 GuardedByAttr *GuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) {
16847 auto *A = new (Ctx) GuardedByAttr(Ctx, CommonInfo, Arg);
16848 A->setImplicit(true);
16849 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16850 A->setAttributeSpellingListIndex(0);
16851 return A;
16852 }
16853
16854 GuardedByAttr *GuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) {
16855 auto *A = new (Ctx) GuardedByAttr(Ctx, CommonInfo, Arg);
16856 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16857 A->setAttributeSpellingListIndex(0);
16858 return A;
16859 }
16860
16861 GuardedByAttr *GuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Range) {
16862 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
16863 return CreateImplicit(Ctx, Arg, I);
16864 }
16865
16866 GuardedByAttr *GuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, SourceRange Range) {
16867 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
16868 return Create(Ctx, Arg, I);
16869 }
16870
16871 GuardedByAttr::GuardedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
16872 , Expr * Arg
16873 )
16874 : InheritableAttr(Ctx, CommonInfo, attr::GuardedBy, /*IsLateParsed=*/true, true)
16875 , arg(Arg)
16876 {
16877 }
16878
16879
16880
16881 GuardedByAttr *GuardedByAttr::clone(ASTContext &C) const {
16882 auto *A = new (C) GuardedByAttr(C, *this, arg);
16883 A->Inherited = Inherited;
16884 A->IsPackExpansion = IsPackExpansion;
16885 A->setImplicit(Implicit);
16886 return A;
16887 }
16888
16889 void GuardedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
16890 bool IsFirstArgument = true; (void)IsFirstArgument;
16891 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
16892 switch (getAttributeSpellingListIndex()) {
16893 default:
16894 llvm_unreachable("Unknown attribute spelling!");
16895 break;
16896 case 0 : {
16897 OS << "__attribute__((guarded_by";
16898 DelimitAttributeArgument(OS, IsFirstArgument);
16899 OS << "";
16900 getArg()->printPretty(OS, nullptr, Policy);
16901 OS << "";
16902 if (!IsFirstArgument)
16903 OS << ")";
16904 OS << "))";
16905 break;
16906 }
16907 }
16908 }
16909
16910 const char *GuardedByAttr::getSpelling() const {
16911 switch (getAttributeSpellingListIndex()) {
16912 default:
16913 llvm_unreachable("Unknown attribute spelling!");
16914 return "(No spelling)";
16915 case 0:
16916 return "guarded_by";
16917 }
16918 }
16919
16920
16921 // GuardedVarAttr implementation
16922
16923 GuardedVarAttr *GuardedVarAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16924 auto *A = new (Ctx) GuardedVarAttr(Ctx, CommonInfo);
16925 A->setImplicit(true);
16926 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16927 A->setAttributeSpellingListIndex(0);
16928 return A;
16929 }
16930
16931 GuardedVarAttr *GuardedVarAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
16932 auto *A = new (Ctx) GuardedVarAttr(Ctx, CommonInfo);
16933 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
16934 A->setAttributeSpellingListIndex(0);
16935 return A;
16936 }
16937
16938 GuardedVarAttr *GuardedVarAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
16939 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16940 switch (S) {
16941 case GNU_guarded_var:
16942 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16943 case CXX11_clang_guarded_var:
16944 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16945 default:
16946 llvm_unreachable("Unknown attribute spelling!");
16947 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16948 }
16949 }());
16950 return CreateImplicit(Ctx, I);
16951 }
16952
16953 GuardedVarAttr *GuardedVarAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
16954 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
16955 switch (S) {
16956 case GNU_guarded_var:
16957 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16958 case CXX11_clang_guarded_var:
16959 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16960 default:
16961 llvm_unreachable("Unknown attribute spelling!");
16962 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
16963 }
16964 }());
16965 return Create(Ctx, I);
16966 }
16967
16968 GuardedVarAttr::GuardedVarAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
16969 )
16970 : InheritableAttr(Ctx, CommonInfo, attr::GuardedVar, /*IsLateParsed=*/false, false)
16971 {
16972 }
16973
16974 GuardedVarAttr *GuardedVarAttr::clone(ASTContext &C) const {
16975 auto *A = new (C) GuardedVarAttr(C, *this);
16976 A->Inherited = Inherited;
16977 A->IsPackExpansion = IsPackExpansion;
16978 A->setImplicit(Implicit);
16979 return A;
16980 }
16981
16982 void GuardedVarAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
16983 bool IsFirstArgument = true; (void)IsFirstArgument;
16984 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
16985 switch (getAttributeSpellingListIndex()) {
16986 default:
16987 llvm_unreachable("Unknown attribute spelling!");
16988 break;
16989 case 0 : {
16990 OS << "__attribute__((guarded_var";
16991 OS << "))";
16992 break;
16993 }
16994 case 1 : {
16995 OS << "[[clang::guarded_var";
16996 OS << "]]";
16997 break;
16998 }
16999 }
17000 }
17001
17002 const char *GuardedVarAttr::getSpelling() const {
17003 switch (getAttributeSpellingListIndex()) {
17004 default:
17005 llvm_unreachable("Unknown attribute spelling!");
17006 return "(No spelling)";
17007 case 0:
17008 return "guarded_var";
17009 case 1:
17010 return "guarded_var";
17011 }
17012 }
17013
17014
17015 // HIPManagedAttr implementation
17016
17017 HIPManagedAttr *HIPManagedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17018 auto *A = new (Ctx) HIPManagedAttr(Ctx, CommonInfo);
17019 A->setImplicit(true);
17020 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17021 A->setAttributeSpellingListIndex(0);
17022 return A;
17023 }
17024
17025 HIPManagedAttr *HIPManagedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17026 auto *A = new (Ctx) HIPManagedAttr(Ctx, CommonInfo);
17027 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17028 A->setAttributeSpellingListIndex(0);
17029 return A;
17030 }
17031
17032 HIPManagedAttr *HIPManagedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
17033 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17034 switch (S) {
17035 case GNU_managed:
17036 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_managed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17037 case Declspec_managed:
17038 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_managed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17039 default:
17040 llvm_unreachable("Unknown attribute spelling!");
17041 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17042 }
17043 }());
17044 return CreateImplicit(Ctx, I);
17045 }
17046
17047 HIPManagedAttr *HIPManagedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
17048 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17049 switch (S) {
17050 case GNU_managed:
17051 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_managed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17052 case Declspec_managed:
17053 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_managed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17054 default:
17055 llvm_unreachable("Unknown attribute spelling!");
17056 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17057 }
17058 }());
17059 return Create(Ctx, I);
17060 }
17061
17062 HIPManagedAttr::HIPManagedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17063 )
17064 : InheritableAttr(Ctx, CommonInfo, attr::HIPManaged, /*IsLateParsed=*/false, false)
17065 {
17066 }
17067
17068 HIPManagedAttr *HIPManagedAttr::clone(ASTContext &C) const {
17069 auto *A = new (C) HIPManagedAttr(C, *this);
17070 A->Inherited = Inherited;
17071 A->IsPackExpansion = IsPackExpansion;
17072 A->setImplicit(Implicit);
17073 return A;
17074 }
17075
17076 void HIPManagedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
17077 bool IsFirstArgument = true; (void)IsFirstArgument;
17078 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
17079 switch (getAttributeSpellingListIndex()) {
17080 default:
17081 llvm_unreachable("Unknown attribute spelling!");
17082 break;
17083 case 0 : {
17084 OS << "__attribute__((managed";
17085 OS << "))";
17086 break;
17087 }
17088 case 1 : {
17089 OS << "__declspec(__managed__";
17090 OS << ")";
17091 break;
17092 }
17093 }
17094 }
17095
17096 const char *HIPManagedAttr::getSpelling() const {
17097 switch (getAttributeSpellingListIndex()) {
17098 default:
17099 llvm_unreachable("Unknown attribute spelling!");
17100 return "(No spelling)";
17101 case 0:
17102 return "managed";
17103 case 1:
17104 return "__managed__";
17105 }
17106 }
17107
17108
17109 // HLSLContainedTypeAttr implementation
17110
17111 HLSLContainedTypeAttr *HLSLContainedTypeAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Type, const AttributeCommonInfo &CommonInfo) {
17112 auto *A = new (Ctx) HLSLContainedTypeAttr(Ctx, CommonInfo, Type);
17113 A->setImplicit(true);
17114 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17115 A->setAttributeSpellingListIndex(0);
17116 return A;
17117 }
17118
17119 HLSLContainedTypeAttr *HLSLContainedTypeAttr::Create(ASTContext &Ctx, TypeSourceInfo * Type, const AttributeCommonInfo &CommonInfo) {
17120 auto *A = new (Ctx) HLSLContainedTypeAttr(Ctx, CommonInfo, Type);
17121 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17122 A->setAttributeSpellingListIndex(0);
17123 return A;
17124 }
17125
17126 HLSLContainedTypeAttr *HLSLContainedTypeAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Type, SourceRange Range) {
17127 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17128 return CreateImplicit(Ctx, Type, I);
17129 }
17130
17131 HLSLContainedTypeAttr *HLSLContainedTypeAttr::Create(ASTContext &Ctx, TypeSourceInfo * Type, SourceRange Range) {
17132 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17133 return Create(Ctx, Type, I);
17134 }
17135
17136 HLSLContainedTypeAttr::HLSLContainedTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17137 , TypeSourceInfo * Type
17138 )
17139 : TypeAttr(Ctx, CommonInfo, attr::HLSLContainedType, /*IsLateParsed=*/false)
17140 , type(Type)
17141 {
17142 }
17143
17144
17145
17146 HLSLContainedTypeAttr *HLSLContainedTypeAttr::clone(ASTContext &C) const {
17147 auto *A = new (C) HLSLContainedTypeAttr(C, *this, type);
17148 A->Inherited = Inherited;
17149 A->IsPackExpansion = IsPackExpansion;
17150 A->setImplicit(Implicit);
17151 return A;
17152 }
17153
17154 void HLSLContainedTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
17155 bool IsFirstArgument = true; (void)IsFirstArgument;
17156 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
17157 switch (getAttributeSpellingListIndex()) {
17158 default:
17159 llvm_unreachable("Unknown attribute spelling!");
17160 break;
17161 case 0 : {
17162 OS << "[[hlsl::contained_type";
17163 DelimitAttributeArgument(OS, IsFirstArgument);
17164 OS << "" << getType().getAsString() << "";
17165 if (!IsFirstArgument)
17166 OS << ")";
17167 OS << "]]";
17168 break;
17169 }
17170 }
17171 }
17172
17173 const char *HLSLContainedTypeAttr::getSpelling() const {
17174 switch (getAttributeSpellingListIndex()) {
17175 default:
17176 llvm_unreachable("Unknown attribute spelling!");
17177 return "(No spelling)";
17178 case 0:
17179 return "contained_type";
17180 }
17181 }
17182
17183
17184 // HLSLControlFlowHintAttr implementation
17185
17186 HLSLControlFlowHintAttr *HLSLControlFlowHintAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17187 auto *A = new (Ctx) HLSLControlFlowHintAttr(Ctx, CommonInfo);
17188 A->setImplicit(true);
17189 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17190 A->setAttributeSpellingListIndex(0);
17191 return A;
17192 }
17193
17194 HLSLControlFlowHintAttr *HLSLControlFlowHintAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17195 auto *A = new (Ctx) HLSLControlFlowHintAttr(Ctx, CommonInfo);
17196 return A;
17197 }
17198
17199 HLSLControlFlowHintAttr *HLSLControlFlowHintAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
17200 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17201 switch (S) {
17202 case Microsoft_branch:
17203 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_branch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17204 case Microsoft_flatten:
17205 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17206 default:
17207 llvm_unreachable("Unknown attribute spelling!");
17208 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17209 }
17210 }());
17211 return CreateImplicit(Ctx, I);
17212 }
17213
17214 HLSLControlFlowHintAttr *HLSLControlFlowHintAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
17215 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17216 switch (S) {
17217 case Microsoft_branch:
17218 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_branch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17219 case Microsoft_flatten:
17220 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17221 default:
17222 llvm_unreachable("Unknown attribute spelling!");
17223 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17224 }
17225 }());
17226 return Create(Ctx, I);
17227 }
17228
17229 HLSLControlFlowHintAttr::HLSLControlFlowHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17230 )
17231 : StmtAttr(Ctx, CommonInfo, attr::HLSLControlFlowHint, /*IsLateParsed=*/false)
17232 {
17233 }
17234
17235 HLSLControlFlowHintAttr::Spelling HLSLControlFlowHintAttr::getSemanticSpelling() const {
17236 switch (getAttributeSpellingListIndex()) {
17237 default: llvm_unreachable("Unknown spelling list index");
17238 case 0: return Microsoft_branch;
17239 case 1: return Microsoft_flatten;
17240 }
17241 }
17242 HLSLControlFlowHintAttr *HLSLControlFlowHintAttr::clone(ASTContext &C) const {
17243 auto *A = new (C) HLSLControlFlowHintAttr(C, *this);
17244 A->Inherited = Inherited;
17245 A->IsPackExpansion = IsPackExpansion;
17246 A->setImplicit(Implicit);
17247 return A;
17248 }
17249
17250 void HLSLControlFlowHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
17251 bool IsFirstArgument = true; (void)IsFirstArgument;
17252 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
17253 switch (getAttributeSpellingListIndex()) {
17254 default:
17255 llvm_unreachable("Unknown attribute spelling!");
17256 break;
17257 case 0 : {
17258 OS << "[branch";
17259 OS << "]";
17260 break;
17261 }
17262 case 1 : {
17263 OS << "[flatten";
17264 OS << "]";
17265 break;
17266 }
17267 }
17268 }
17269
17270 const char *HLSLControlFlowHintAttr::getSpelling() const {
17271 switch (getAttributeSpellingListIndex()) {
17272 default:
17273 llvm_unreachable("Unknown attribute spelling!");
17274 return "(No spelling)";
17275 case 0:
17276 return "branch";
17277 case 1:
17278 return "flatten";
17279 }
17280 }
17281
17282
17283 // HLSLGroupSharedAddressSpaceAttr implementation
17284
17285 HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17286 auto *A = new (Ctx) HLSLGroupSharedAddressSpaceAttr(Ctx, CommonInfo);
17287 A->setImplicit(true);
17288 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17289 A->setAttributeSpellingListIndex(0);
17290 return A;
17291 }
17292
17293 HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17294 auto *A = new (Ctx) HLSLGroupSharedAddressSpaceAttr(Ctx, CommonInfo);
17295 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17296 A->setAttributeSpellingListIndex(0);
17297 return A;
17298 }
17299
17300 HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
17301 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17302 return CreateImplicit(Ctx, I);
17303 }
17304
17305 HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range) {
17306 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17307 return Create(Ctx, I);
17308 }
17309
17310 HLSLGroupSharedAddressSpaceAttr::HLSLGroupSharedAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17311 )
17312 : TypeAttr(Ctx, CommonInfo, attr::HLSLGroupSharedAddressSpace, /*IsLateParsed=*/false)
17313 {
17314 }
17315
17316 HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::clone(ASTContext &C) const {
17317 auto *A = new (C) HLSLGroupSharedAddressSpaceAttr(C, *this);
17318 A->Inherited = Inherited;
17319 A->IsPackExpansion = IsPackExpansion;
17320 A->setImplicit(Implicit);
17321 return A;
17322 }
17323
17324 void HLSLGroupSharedAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
17325 bool IsFirstArgument = true; (void)IsFirstArgument;
17326 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
17327 switch (getAttributeSpellingListIndex()) {
17328 default:
17329 llvm_unreachable("Unknown attribute spelling!");
17330 break;
17331 case 0 : {
17332 OS << "groupshared";
17333 OS << "";
17334 break;
17335 }
17336 }
17337 }
17338
17339 const char *HLSLGroupSharedAddressSpaceAttr::getSpelling() const {
17340 switch (getAttributeSpellingListIndex()) {
17341 default:
17342 llvm_unreachable("Unknown attribute spelling!");
17343 return "(No spelling)";
17344 case 0:
17345 return "groupshared";
17346 }
17347 }
17348
17349
17350 // HLSLLoopHintAttr implementation
17351
17352 HLSLLoopHintAttr *HLSLLoopHintAttr::CreateImplicit(ASTContext &Ctx, unsigned Directive, const AttributeCommonInfo &CommonInfo) {
17353 auto *A = new (Ctx) HLSLLoopHintAttr(Ctx, CommonInfo, Directive);
17354 A->setImplicit(true);
17355 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17356 A->setAttributeSpellingListIndex(0);
17357 return A;
17358 }
17359
17360 HLSLLoopHintAttr *HLSLLoopHintAttr::Create(ASTContext &Ctx, unsigned Directive, const AttributeCommonInfo &CommonInfo) {
17361 auto *A = new (Ctx) HLSLLoopHintAttr(Ctx, CommonInfo, Directive);
17362 return A;
17363 }
17364
17365 HLSLLoopHintAttr *HLSLLoopHintAttr::CreateImplicit(ASTContext &Ctx, unsigned Directive, SourceRange Range, Spelling S) {
17366 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17367 switch (S) {
17368 case Microsoft_unroll:
17369 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_unroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17370 case Microsoft_loop:
17371 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_loop, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17372 default:
17373 llvm_unreachable("Unknown attribute spelling!");
17374 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17375 }
17376 }());
17377 return CreateImplicit(Ctx, Directive, I);
17378 }
17379
17380 HLSLLoopHintAttr *HLSLLoopHintAttr::Create(ASTContext &Ctx, unsigned Directive, SourceRange Range, Spelling S) {
17381 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17382 switch (S) {
17383 case Microsoft_unroll:
17384 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_unroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17385 case Microsoft_loop:
17386 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_loop, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17387 default:
17388 llvm_unreachable("Unknown attribute spelling!");
17389 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17390 }
17391 }());
17392 return Create(Ctx, Directive, I);
17393 }
17394
17395 HLSLLoopHintAttr::HLSLLoopHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17396 , unsigned Directive
17397 )
17398 : StmtAttr(Ctx, CommonInfo, attr::HLSLLoopHint, /*IsLateParsed=*/false)
17399 , directive(Directive)
17400 {
17401 }
17402
17403 HLSLLoopHintAttr::HLSLLoopHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17404 )
17405 : StmtAttr(Ctx, CommonInfo, attr::HLSLLoopHint, /*IsLateParsed=*/false)
17406 , directive()
17407 {
17408 }
17409
17410 HLSLLoopHintAttr::Spelling HLSLLoopHintAttr::getSemanticSpelling() const {
17411 switch (getAttributeSpellingListIndex()) {
17412 default: llvm_unreachable("Unknown spelling list index");
17413 case 0: return Microsoft_unroll;
17414 case 1: return Microsoft_loop;
17415 }
17416 }
17417
17418
17419 HLSLLoopHintAttr *HLSLLoopHintAttr::clone(ASTContext &C) const {
17420 auto *A = new (C) HLSLLoopHintAttr(C, *this, directive);
17421 A->Inherited = Inherited;
17422 A->IsPackExpansion = IsPackExpansion;
17423 A->setImplicit(Implicit);
17424 return A;
17425 }
17426
17427 void HLSLLoopHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
17428 bool IsFirstArgument = true; (void)IsFirstArgument;
17429 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
17430 switch (getAttributeSpellingListIndex()) {
17431 default:
17432 llvm_unreachable("Unknown attribute spelling!");
17433 break;
17434 case 0 : {
17435 OS << "[unroll";
17436 DelimitAttributeArgument(OS, IsFirstArgument);
17437 OS << "" << getDirective() << "";
17438 if (!IsFirstArgument)
17439 OS << ")";
17440 OS << "]";
17441 break;
17442 }
17443 case 1 : {
17444 OS << "[loop";
17445 DelimitAttributeArgument(OS, IsFirstArgument);
17446 OS << "" << getDirective() << "";
17447 if (!IsFirstArgument)
17448 OS << ")";
17449 OS << "]";
17450 break;
17451 }
17452 }
17453 }
17454
17455 const char *HLSLLoopHintAttr::getSpelling() const {
17456 switch (getAttributeSpellingListIndex()) {
17457 default:
17458 llvm_unreachable("Unknown attribute spelling!");
17459 return "(No spelling)";
17460 case 0:
17461 return "unroll";
17462 case 1:
17463 return "loop";
17464 }
17465 }
17466
17467
17468 // HLSLNumThreadsAttr implementation
17469
17470 HLSLNumThreadsAttr *HLSLNumThreadsAttr::CreateImplicit(ASTContext &Ctx, int X, int Y, int Z, const AttributeCommonInfo &CommonInfo) {
17471 auto *A = new (Ctx) HLSLNumThreadsAttr(Ctx, CommonInfo, X, Y, Z);
17472 A->setImplicit(true);
17473 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17474 A->setAttributeSpellingListIndex(0);
17475 return A;
17476 }
17477
17478 HLSLNumThreadsAttr *HLSLNumThreadsAttr::Create(ASTContext &Ctx, int X, int Y, int Z, const AttributeCommonInfo &CommonInfo) {
17479 auto *A = new (Ctx) HLSLNumThreadsAttr(Ctx, CommonInfo, X, Y, Z);
17480 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17481 A->setAttributeSpellingListIndex(0);
17482 return A;
17483 }
17484
17485 HLSLNumThreadsAttr *HLSLNumThreadsAttr::CreateImplicit(ASTContext &Ctx, int X, int Y, int Z, SourceRange Range) {
17486 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17487 return CreateImplicit(Ctx, X, Y, Z, I);
17488 }
17489
17490 HLSLNumThreadsAttr *HLSLNumThreadsAttr::Create(ASTContext &Ctx, int X, int Y, int Z, SourceRange Range) {
17491 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17492 return Create(Ctx, X, Y, Z, I);
17493 }
17494
17495 HLSLNumThreadsAttr::HLSLNumThreadsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17496 , int X
17497 , int Y
17498 , int Z
17499 )
17500 : InheritableAttr(Ctx, CommonInfo, attr::HLSLNumThreads, /*IsLateParsed=*/false, false)
17501 , x(X)
17502 , y(Y)
17503 , z(Z)
17504 {
17505 }
17506
17507
17508
17509
17510
17511
17512
17513 HLSLNumThreadsAttr *HLSLNumThreadsAttr::clone(ASTContext &C) const {
17514 auto *A = new (C) HLSLNumThreadsAttr(C, *this, x, y, z);
17515 A->Inherited = Inherited;
17516 A->IsPackExpansion = IsPackExpansion;
17517 A->setImplicit(Implicit);
17518 return A;
17519 }
17520
17521 void HLSLNumThreadsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
17522 bool IsFirstArgument = true; (void)IsFirstArgument;
17523 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
17524 switch (getAttributeSpellingListIndex()) {
17525 default:
17526 llvm_unreachable("Unknown attribute spelling!");
17527 break;
17528 case 0 : {
17529 OS << "[numthreads";
17530 DelimitAttributeArgument(OS, IsFirstArgument);
17531 OS << "" << getX() << "";
17532 DelimitAttributeArgument(OS, IsFirstArgument);
17533 OS << "" << getY() << "";
17534 DelimitAttributeArgument(OS, IsFirstArgument);
17535 OS << "" << getZ() << "";
17536 if (!IsFirstArgument)
17537 OS << ")";
17538 OS << "]";
17539 break;
17540 }
17541 }
17542 }
17543
17544 const char *HLSLNumThreadsAttr::getSpelling() const {
17545 switch (getAttributeSpellingListIndex()) {
17546 default:
17547 llvm_unreachable("Unknown attribute spelling!");
17548 return "(No spelling)";
17549 case 0:
17550 return "numthreads";
17551 }
17552 }
17553
17554
17555 // HLSLPackOffsetAttr implementation
17556
17557 HLSLPackOffsetAttr *HLSLPackOffsetAttr::CreateImplicit(ASTContext &Ctx, int Subcomponent, int Component, const AttributeCommonInfo &CommonInfo) {
17558 auto *A = new (Ctx) HLSLPackOffsetAttr(Ctx, CommonInfo, Subcomponent, Component);
17559 A->setImplicit(true);
17560 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17561 A->setAttributeSpellingListIndex(0);
17562 return A;
17563 }
17564
17565 HLSLPackOffsetAttr *HLSLPackOffsetAttr::Create(ASTContext &Ctx, int Subcomponent, int Component, const AttributeCommonInfo &CommonInfo) {
17566 auto *A = new (Ctx) HLSLPackOffsetAttr(Ctx, CommonInfo, Subcomponent, Component);
17567 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17568 A->setAttributeSpellingListIndex(0);
17569 return A;
17570 }
17571
17572 HLSLPackOffsetAttr *HLSLPackOffsetAttr::CreateImplicit(ASTContext &Ctx, int Subcomponent, int Component, SourceRange Range) {
17573 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17574 return CreateImplicit(Ctx, Subcomponent, Component, I);
17575 }
17576
17577 HLSLPackOffsetAttr *HLSLPackOffsetAttr::Create(ASTContext &Ctx, int Subcomponent, int Component, SourceRange Range) {
17578 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17579 return Create(Ctx, Subcomponent, Component, I);
17580 }
17581
17582 HLSLPackOffsetAttr::HLSLPackOffsetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17583 , int Subcomponent
17584 , int Component
17585 )
17586 : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLPackOffset, /*IsLateParsed=*/false, false)
17587 , subcomponent(Subcomponent)
17588 , component(Component)
17589 {
17590 }
17591
17592
17593
17594
17595
17596 HLSLPackOffsetAttr *HLSLPackOffsetAttr::clone(ASTContext &C) const {
17597 auto *A = new (C) HLSLPackOffsetAttr(C, *this, subcomponent, component);
17598 A->Inherited = Inherited;
17599 A->IsPackExpansion = IsPackExpansion;
17600 A->setImplicit(Implicit);
17601 return A;
17602 }
17603
17604 void HLSLPackOffsetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
17605 bool IsFirstArgument = true; (void)IsFirstArgument;
17606 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
17607 switch (getAttributeSpellingListIndex()) {
17608 default:
17609 llvm_unreachable("Unknown attribute spelling!");
17610 break;
17611 case 0 : {
17612 OS << ":packoffset";
17613 DelimitAttributeArgument(OS, IsFirstArgument);
17614 OS << "" << getSubcomponent() << "";
17615 DelimitAttributeArgument(OS, IsFirstArgument);
17616 OS << "" << getComponent() << "";
17617 if (!IsFirstArgument)
17618 OS << ")";
17619 OS << "";
17620 break;
17621 }
17622 }
17623 }
17624
17625 const char *HLSLPackOffsetAttr::getSpelling() const {
17626 switch (getAttributeSpellingListIndex()) {
17627 default:
17628 llvm_unreachable("Unknown attribute spelling!");
17629 return "(No spelling)";
17630 case 0:
17631 return "packoffset";
17632 }
17633 }
17634
17635
17636 // HLSLParamModifierAttr implementation
17637
17638 HLSLParamModifierAttr *HLSLParamModifierAttr::CreateImplicit(ASTContext &Ctx, bool MergedSpelling, const AttributeCommonInfo &CommonInfo) {
17639 auto *A = new (Ctx) HLSLParamModifierAttr(Ctx, CommonInfo, MergedSpelling);
17640 A->setImplicit(true);
17641 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17642 A->setAttributeSpellingListIndex(0);
17643 return A;
17644 }
17645
17646 HLSLParamModifierAttr *HLSLParamModifierAttr::Create(ASTContext &Ctx, bool MergedSpelling, const AttributeCommonInfo &CommonInfo) {
17647 auto *A = new (Ctx) HLSLParamModifierAttr(Ctx, CommonInfo, MergedSpelling);
17648 return A;
17649 }
17650
17651 HLSLParamModifierAttr *HLSLParamModifierAttr::CreateImplicit(ASTContext &Ctx, bool MergedSpelling, SourceRange Range, Spelling S) {
17652 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17653 switch (S) {
17654 case Keyword_in:
17655 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_in, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17656 case Keyword_inout:
17657 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_inout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17658 case Keyword_out:
17659 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_out, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17660 default:
17661 llvm_unreachable("Unknown attribute spelling!");
17662 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17663 }
17664 }());
17665 return CreateImplicit(Ctx, MergedSpelling, I);
17666 }
17667
17668 HLSLParamModifierAttr *HLSLParamModifierAttr::Create(ASTContext &Ctx, bool MergedSpelling, SourceRange Range, Spelling S) {
17669 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17670 switch (S) {
17671 case Keyword_in:
17672 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_in, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17673 case Keyword_inout:
17674 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_inout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17675 case Keyword_out:
17676 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_out, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17677 default:
17678 llvm_unreachable("Unknown attribute spelling!");
17679 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17680 }
17681 }());
17682 return Create(Ctx, MergedSpelling, I);
17683 }
17684
17685 HLSLParamModifierAttr *HLSLParamModifierAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17686 auto *A = new (Ctx) HLSLParamModifierAttr(Ctx, CommonInfo);
17687 A->setImplicit(true);
17688 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17689 A->setAttributeSpellingListIndex(0);
17690 return A;
17691 }
17692
17693 HLSLParamModifierAttr *HLSLParamModifierAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17694 auto *A = new (Ctx) HLSLParamModifierAttr(Ctx, CommonInfo);
17695 return A;
17696 }
17697
17698 HLSLParamModifierAttr *HLSLParamModifierAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
17699 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17700 switch (S) {
17701 case Keyword_in:
17702 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_in, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17703 case Keyword_inout:
17704 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_inout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17705 case Keyword_out:
17706 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_out, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17707 default:
17708 llvm_unreachable("Unknown attribute spelling!");
17709 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17710 }
17711 }());
17712 return CreateImplicit(Ctx, I);
17713 }
17714
17715 HLSLParamModifierAttr *HLSLParamModifierAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
17716 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
17717 switch (S) {
17718 case Keyword_in:
17719 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_in, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17720 case Keyword_inout:
17721 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_inout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17722 case Keyword_out:
17723 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_out, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17724 default:
17725 llvm_unreachable("Unknown attribute spelling!");
17726 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
17727 }
17728 }());
17729 return Create(Ctx, I);
17730 }
17731
17732 HLSLParamModifierAttr::HLSLParamModifierAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17733 , bool MergedSpelling
17734 )
17735 : ParameterABIAttr(Ctx, CommonInfo, attr::HLSLParamModifier, /*IsLateParsed=*/false, false)
17736 , mergedSpelling(MergedSpelling)
17737 {
17738 }
17739
17740 HLSLParamModifierAttr::HLSLParamModifierAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17741 )
17742 : ParameterABIAttr(Ctx, CommonInfo, attr::HLSLParamModifier, /*IsLateParsed=*/false, false)
17743 , mergedSpelling()
17744 {
17745 }
17746
17747 HLSLParamModifierAttr::Spelling HLSLParamModifierAttr::getSemanticSpelling() const {
17748 switch (getAttributeSpellingListIndex()) {
17749 default: llvm_unreachable("Unknown spelling list index");
17750 case 0: return Keyword_in;
17751 case 1: return Keyword_inout;
17752 case 2: return Keyword_out;
17753 }
17754 }
17755
17756
17757 HLSLParamModifierAttr *HLSLParamModifierAttr::clone(ASTContext &C) const {
17758 auto *A = new (C) HLSLParamModifierAttr(C, *this, mergedSpelling);
17759 A->Inherited = Inherited;
17760 A->IsPackExpansion = IsPackExpansion;
17761 A->setImplicit(Implicit);
17762 return A;
17763 }
17764
17765 void HLSLParamModifierAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
17766 bool IsFirstArgument = true; (void)IsFirstArgument;
17767 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
17768 switch (getAttributeSpellingListIndex()) {
17769 default:
17770 llvm_unreachable("Unknown attribute spelling!");
17771 break;
17772 case 0 : {
17773 OS << "in";
17774 OS << "";
17775 break;
17776 }
17777 case 1 : {
17778 OS << "inout";
17779 OS << "";
17780 break;
17781 }
17782 case 2 : {
17783 OS << "out";
17784 OS << "";
17785 break;
17786 }
17787 }
17788 }
17789
17790 const char *HLSLParamModifierAttr::getSpelling() const {
17791 switch (getAttributeSpellingListIndex()) {
17792 default:
17793 llvm_unreachable("Unknown attribute spelling!");
17794 return "(No spelling)";
17795 case 0:
17796 return "in";
17797 case 1:
17798 return "inout";
17799 case 2:
17800 return "out";
17801 }
17802 }
17803
17804
17805 // HLSLROVAttr implementation
17806
17807 HLSLROVAttr *HLSLROVAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17808 auto *A = new (Ctx) HLSLROVAttr(Ctx, CommonInfo);
17809 A->setImplicit(true);
17810 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17811 A->setAttributeSpellingListIndex(0);
17812 return A;
17813 }
17814
17815 HLSLROVAttr *HLSLROVAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17816 auto *A = new (Ctx) HLSLROVAttr(Ctx, CommonInfo);
17817 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17818 A->setAttributeSpellingListIndex(0);
17819 return A;
17820 }
17821
17822 HLSLROVAttr *HLSLROVAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
17823 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17824 return CreateImplicit(Ctx, I);
17825 }
17826
17827 HLSLROVAttr *HLSLROVAttr::Create(ASTContext &Ctx, SourceRange Range) {
17828 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17829 return Create(Ctx, I);
17830 }
17831
17832 HLSLROVAttr::HLSLROVAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17833 )
17834 : TypeAttr(Ctx, CommonInfo, attr::HLSLROV, /*IsLateParsed=*/false)
17835 {
17836 }
17837
17838 HLSLROVAttr *HLSLROVAttr::clone(ASTContext &C) const {
17839 auto *A = new (C) HLSLROVAttr(C, *this);
17840 A->Inherited = Inherited;
17841 A->IsPackExpansion = IsPackExpansion;
17842 A->setImplicit(Implicit);
17843 return A;
17844 }
17845
17846 void HLSLROVAttr::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 << "[[hlsl::is_rov";
17855 OS << "]]";
17856 break;
17857 }
17858 }
17859 }
17860
17861 const char *HLSLROVAttr::getSpelling() const {
17862 switch (getAttributeSpellingListIndex()) {
17863 default:
17864 llvm_unreachable("Unknown attribute spelling!");
17865 return "(No spelling)";
17866 case 0:
17867 return "is_rov";
17868 }
17869 }
17870
17871
17872 // HLSLRawBufferAttr implementation
17873
17874 HLSLRawBufferAttr *HLSLRawBufferAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17875 auto *A = new (Ctx) HLSLRawBufferAttr(Ctx, CommonInfo);
17876 A->setImplicit(true);
17877 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17878 A->setAttributeSpellingListIndex(0);
17879 return A;
17880 }
17881
17882 HLSLRawBufferAttr *HLSLRawBufferAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
17883 auto *A = new (Ctx) HLSLRawBufferAttr(Ctx, CommonInfo);
17884 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17885 A->setAttributeSpellingListIndex(0);
17886 return A;
17887 }
17888
17889 HLSLRawBufferAttr *HLSLRawBufferAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
17890 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17891 return CreateImplicit(Ctx, I);
17892 }
17893
17894 HLSLRawBufferAttr *HLSLRawBufferAttr::Create(ASTContext &Ctx, SourceRange Range) {
17895 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
17896 return Create(Ctx, I);
17897 }
17898
17899 HLSLRawBufferAttr::HLSLRawBufferAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17900 )
17901 : TypeAttr(Ctx, CommonInfo, attr::HLSLRawBuffer, /*IsLateParsed=*/false)
17902 {
17903 }
17904
17905 HLSLRawBufferAttr *HLSLRawBufferAttr::clone(ASTContext &C) const {
17906 auto *A = new (C) HLSLRawBufferAttr(C, *this);
17907 A->Inherited = Inherited;
17908 A->IsPackExpansion = IsPackExpansion;
17909 A->setImplicit(Implicit);
17910 return A;
17911 }
17912
17913 void HLSLRawBufferAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
17914 bool IsFirstArgument = true; (void)IsFirstArgument;
17915 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
17916 switch (getAttributeSpellingListIndex()) {
17917 default:
17918 llvm_unreachable("Unknown attribute spelling!");
17919 break;
17920 case 0 : {
17921 OS << "[[hlsl::raw_buffer";
17922 OS << "]]";
17923 break;
17924 }
17925 }
17926 }
17927
17928 const char *HLSLRawBufferAttr::getSpelling() const {
17929 switch (getAttributeSpellingListIndex()) {
17930 default:
17931 llvm_unreachable("Unknown attribute spelling!");
17932 return "(No spelling)";
17933 case 0:
17934 return "raw_buffer";
17935 }
17936 }
17937
17938
17939 // HLSLResourceAttr implementation
17940
17941 HLSLResourceAttr *HLSLResourceAttr::CreateImplicit(ASTContext &Ctx, llvm::hlsl::ResourceKind ResourceKind, const AttributeCommonInfo &CommonInfo) {
17942 auto *A = new (Ctx) HLSLResourceAttr(Ctx, CommonInfo, ResourceKind);
17943 A->setImplicit(true);
17944 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17945 A->setAttributeSpellingListIndex(0);
17946 return A;
17947 }
17948
17949 HLSLResourceAttr *HLSLResourceAttr::Create(ASTContext &Ctx, llvm::hlsl::ResourceKind ResourceKind, const AttributeCommonInfo &CommonInfo) {
17950 auto *A = new (Ctx) HLSLResourceAttr(Ctx, CommonInfo, ResourceKind);
17951 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
17952 A->setAttributeSpellingListIndex(0);
17953 return A;
17954 }
17955
17956 HLSLResourceAttr *HLSLResourceAttr::CreateImplicit(ASTContext &Ctx, llvm::hlsl::ResourceKind ResourceKind, SourceRange Range) {
17957 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
17958 return CreateImplicit(Ctx, ResourceKind, I);
17959 }
17960
17961 HLSLResourceAttr *HLSLResourceAttr::Create(ASTContext &Ctx, llvm::hlsl::ResourceKind ResourceKind, SourceRange Range) {
17962 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
17963 return Create(Ctx, ResourceKind, I);
17964 }
17965
17966 HLSLResourceAttr::HLSLResourceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
17967 , llvm::hlsl::ResourceKind ResourceKind
17968 )
17969 : InheritableAttr(Ctx, CommonInfo, attr::HLSLResource, /*IsLateParsed=*/false, false)
17970 , resourceKind(ResourceKind)
17971 {
17972 }
17973
17974
17975
17976 bool HLSLResourceAttr::ConvertStrToResourceKind(StringRef Val, llvm::hlsl::ResourceKind &Out) {
17977 std::optional<llvm::hlsl::ResourceKind> R = llvm::StringSwitch<std::optional<llvm::hlsl::ResourceKind>>(Val)
17978 .Case("Texture1D", llvm::hlsl::ResourceKind::Texture1D)
17979 .Case("Texture2D", llvm::hlsl::ResourceKind::Texture2D)
17980 .Case("Texture2DMS", llvm::hlsl::ResourceKind::Texture2DMS)
17981 .Case("Texture3D", llvm::hlsl::ResourceKind::Texture3D)
17982 .Case("TextureCube", llvm::hlsl::ResourceKind::TextureCube)
17983 .Case("Texture1DArray", llvm::hlsl::ResourceKind::Texture1DArray)
17984 .Case("Texture2DArray", llvm::hlsl::ResourceKind::Texture2DArray)
17985 .Case("Texture2DMSArray", llvm::hlsl::ResourceKind::Texture2DMSArray)
17986 .Case("TextureCubeArray", llvm::hlsl::ResourceKind::TextureCubeArray)
17987 .Case("TypedBuffer", llvm::hlsl::ResourceKind::TypedBuffer)
17988 .Case("RawBuffer", llvm::hlsl::ResourceKind::RawBuffer)
17989 .Case("StructuredBuffer", llvm::hlsl::ResourceKind::StructuredBuffer)
17990 .Case("CBuffer", llvm::hlsl::ResourceKind::CBuffer)
17991 .Case("Sampler", llvm::hlsl::ResourceKind::Sampler)
17992 .Case("TBuffer", llvm::hlsl::ResourceKind::TBuffer)
17993 .Case("RTAccelerationStructure", llvm::hlsl::ResourceKind::RTAccelerationStructure)
17994 .Case("FeedbackTexture2D", llvm::hlsl::ResourceKind::FeedbackTexture2D)
17995 .Case("FeedbackTexture2DArray", llvm::hlsl::ResourceKind::FeedbackTexture2DArray)
17996 .Default(std::optional<llvm::hlsl::ResourceKind>());
17997 if (R) {
17998 Out = *R;
17999 return true;
18000 }
18001 return false;
18002 }
18003
18004 const char *HLSLResourceAttr::ConvertResourceKindToStr(llvm::hlsl::ResourceKind Val) {
18005 switch(Val) {
18006 case llvm::hlsl::ResourceKind::Texture1D: return "Texture1D";
18007 case llvm::hlsl::ResourceKind::Texture2D: return "Texture2D";
18008 case llvm::hlsl::ResourceKind::Texture2DMS: return "Texture2DMS";
18009 case llvm::hlsl::ResourceKind::Texture3D: return "Texture3D";
18010 case llvm::hlsl::ResourceKind::TextureCube: return "TextureCube";
18011 case llvm::hlsl::ResourceKind::Texture1DArray: return "Texture1DArray";
18012 case llvm::hlsl::ResourceKind::Texture2DArray: return "Texture2DArray";
18013 case llvm::hlsl::ResourceKind::Texture2DMSArray: return "Texture2DMSArray";
18014 case llvm::hlsl::ResourceKind::TextureCubeArray: return "TextureCubeArray";
18015 case llvm::hlsl::ResourceKind::TypedBuffer: return "TypedBuffer";
18016 case llvm::hlsl::ResourceKind::RawBuffer: return "RawBuffer";
18017 case llvm::hlsl::ResourceKind::StructuredBuffer: return "StructuredBuffer";
18018 case llvm::hlsl::ResourceKind::CBuffer: return "CBuffer";
18019 case llvm::hlsl::ResourceKind::Sampler: return "Sampler";
18020 case llvm::hlsl::ResourceKind::TBuffer: return "TBuffer";
18021 case llvm::hlsl::ResourceKind::RTAccelerationStructure: return "RTAccelerationStructure";
18022 case llvm::hlsl::ResourceKind::FeedbackTexture2D: return "FeedbackTexture2D";
18023 case llvm::hlsl::ResourceKind::FeedbackTexture2DArray: return "FeedbackTexture2DArray";
18024 default: llvm_unreachable("Invalid attribute value");
18025 }
18026 llvm_unreachable("No enumerator with that value");
18027 }
18028 HLSLResourceAttr *HLSLResourceAttr::clone(ASTContext &C) const {
18029 auto *A = new (C) HLSLResourceAttr(C, *this, resourceKind);
18030 A->Inherited = Inherited;
18031 A->IsPackExpansion = IsPackExpansion;
18032 A->setImplicit(Implicit);
18033 return A;
18034 }
18035
18036 void HLSLResourceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18037 }
18038
18039 const char *HLSLResourceAttr::getSpelling() const {
18040 return "(No spelling)";
18041 }
18042
18043
18044 // HLSLResourceBindingAttr implementation
18045
18046 HLSLResourceBindingAttr *HLSLResourceBindingAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, const AttributeCommonInfo &CommonInfo) {
18047 auto *A = new (Ctx) HLSLResourceBindingAttr(Ctx, CommonInfo, Slot, Space);
18048 A->setImplicit(true);
18049 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18050 A->setAttributeSpellingListIndex(0);
18051 return A;
18052 }
18053
18054 HLSLResourceBindingAttr *HLSLResourceBindingAttr::Create(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, const AttributeCommonInfo &CommonInfo) {
18055 auto *A = new (Ctx) HLSLResourceBindingAttr(Ctx, CommonInfo, Slot, Space);
18056 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18057 A->setAttributeSpellingListIndex(0);
18058 return A;
18059 }
18060
18061 HLSLResourceBindingAttr *HLSLResourceBindingAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, SourceRange Range) {
18062 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18063 return CreateImplicit(Ctx, Slot, Space, I);
18064 }
18065
18066 HLSLResourceBindingAttr *HLSLResourceBindingAttr::Create(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, SourceRange Range) {
18067 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18068 return Create(Ctx, Slot, Space, I);
18069 }
18070
18071 HLSLResourceBindingAttr::HLSLResourceBindingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18072 , llvm::StringRef Slot
18073 , llvm::StringRef Space
18074 )
18075 : InheritableAttr(Ctx, CommonInfo, attr::HLSLResourceBinding, /*IsLateParsed=*/false, false)
18076 , slotLength(Slot.size()),slot(new (Ctx, 1) char[slotLength])
18077 , spaceLength(Space.size()),space(new (Ctx, 1) char[spaceLength])
18078 {
18079 if (!Slot.empty())
18080 std::memcpy(slot, Slot.data(), slotLength);
18081 if (!Space.empty())
18082 std::memcpy(space, Space.data(), spaceLength);
18083 }
18084
18085 HLSLResourceBindingAttr::HLSLResourceBindingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18086 , llvm::StringRef Slot
18087 )
18088 : InheritableAttr(Ctx, CommonInfo, attr::HLSLResourceBinding, /*IsLateParsed=*/false, false)
18089 , slotLength(Slot.size()),slot(new (Ctx, 1) char[slotLength])
18090 , spaceLength(0),space(nullptr)
18091 {
18092 if (!Slot.empty())
18093 std::memcpy(slot, Slot.data(), slotLength);
18094 }
18095
18096
18097
18098
18099
18100 HLSLResourceBindingAttr *HLSLResourceBindingAttr::clone(ASTContext &C) const {
18101 auto *A = new (C) HLSLResourceBindingAttr(C, *this, getSlot(), getSpace());
18102 A->Inherited = Inherited;
18103 A->IsPackExpansion = IsPackExpansion;
18104 A->setImplicit(Implicit);
18105 return A;
18106 }
18107
18108 void HLSLResourceBindingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18109 bool IsFirstArgument = true; (void)IsFirstArgument;
18110 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18111 switch (getAttributeSpellingListIndex()) {
18112 default:
18113 llvm_unreachable("Unknown attribute spelling!");
18114 break;
18115 case 0 : {
18116 OS << ":register";
18117 DelimitAttributeArgument(OS, IsFirstArgument);
18118 OS << "\"" << getSlot() << "\"";
18119 DelimitAttributeArgument(OS, IsFirstArgument);
18120 OS << "\"" << getSpace() << "\"";
18121 if (!IsFirstArgument)
18122 OS << ")";
18123 OS << "";
18124 break;
18125 }
18126 }
18127 }
18128
18129 const char *HLSLResourceBindingAttr::getSpelling() const {
18130 switch (getAttributeSpellingListIndex()) {
18131 default:
18132 llvm_unreachable("Unknown attribute spelling!");
18133 return "(No spelling)";
18134 case 0:
18135 return "register";
18136 }
18137 }
18138
18139
18140 // HLSLResourceClassAttr implementation
18141
18142 HLSLResourceClassAttr *HLSLResourceClassAttr::CreateImplicit(ASTContext &Ctx, llvm::hlsl::ResourceClass ResourceClass, const AttributeCommonInfo &CommonInfo) {
18143 auto *A = new (Ctx) HLSLResourceClassAttr(Ctx, CommonInfo, ResourceClass);
18144 A->setImplicit(true);
18145 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18146 A->setAttributeSpellingListIndex(0);
18147 return A;
18148 }
18149
18150 HLSLResourceClassAttr *HLSLResourceClassAttr::Create(ASTContext &Ctx, llvm::hlsl::ResourceClass ResourceClass, const AttributeCommonInfo &CommonInfo) {
18151 auto *A = new (Ctx) HLSLResourceClassAttr(Ctx, CommonInfo, ResourceClass);
18152 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18153 A->setAttributeSpellingListIndex(0);
18154 return A;
18155 }
18156
18157 HLSLResourceClassAttr *HLSLResourceClassAttr::CreateImplicit(ASTContext &Ctx, llvm::hlsl::ResourceClass ResourceClass, SourceRange Range) {
18158 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18159 return CreateImplicit(Ctx, ResourceClass, I);
18160 }
18161
18162 HLSLResourceClassAttr *HLSLResourceClassAttr::Create(ASTContext &Ctx, llvm::hlsl::ResourceClass ResourceClass, SourceRange Range) {
18163 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18164 return Create(Ctx, ResourceClass, I);
18165 }
18166
18167 HLSLResourceClassAttr::HLSLResourceClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18168 , llvm::hlsl::ResourceClass ResourceClass
18169 )
18170 : TypeAttr(Ctx, CommonInfo, attr::HLSLResourceClass, /*IsLateParsed=*/false)
18171 , resourceClass(ResourceClass)
18172 {
18173 }
18174
18175
18176
18177 bool HLSLResourceClassAttr::ConvertStrToResourceClass(StringRef Val, llvm::hlsl::ResourceClass &Out) {
18178 std::optional<llvm::hlsl::ResourceClass> R = llvm::StringSwitch<std::optional<llvm::hlsl::ResourceClass>>(Val)
18179 .Case("SRV", llvm::hlsl::ResourceClass::SRV)
18180 .Case("UAV", llvm::hlsl::ResourceClass::UAV)
18181 .Case("CBuffer", llvm::hlsl::ResourceClass::CBuffer)
18182 .Case("Sampler", llvm::hlsl::ResourceClass::Sampler)
18183 .Default(std::optional<llvm::hlsl::ResourceClass>());
18184 if (R) {
18185 Out = *R;
18186 return true;
18187 }
18188 return false;
18189 }
18190
18191 const char *HLSLResourceClassAttr::ConvertResourceClassToStr(llvm::hlsl::ResourceClass Val) {
18192 switch(Val) {
18193 case llvm::hlsl::ResourceClass::SRV: return "SRV";
18194 case llvm::hlsl::ResourceClass::UAV: return "UAV";
18195 case llvm::hlsl::ResourceClass::CBuffer: return "CBuffer";
18196 case llvm::hlsl::ResourceClass::Sampler: return "Sampler";
18197 }
18198 llvm_unreachable("No enumerator with that value");
18199 }
18200 HLSLResourceClassAttr *HLSLResourceClassAttr::clone(ASTContext &C) const {
18201 auto *A = new (C) HLSLResourceClassAttr(C, *this, resourceClass);
18202 A->Inherited = Inherited;
18203 A->IsPackExpansion = IsPackExpansion;
18204 A->setImplicit(Implicit);
18205 return A;
18206 }
18207
18208 void HLSLResourceClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18209 bool IsFirstArgument = true; (void)IsFirstArgument;
18210 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18211 switch (getAttributeSpellingListIndex()) {
18212 default:
18213 llvm_unreachable("Unknown attribute spelling!");
18214 break;
18215 case 0 : {
18216 OS << "[[hlsl::resource_class";
18217 DelimitAttributeArgument(OS, IsFirstArgument);
18218 OS << "\"" << HLSLResourceClassAttr::ConvertResourceClassToStr(getResourceClass()) << "\"";
18219 if (!IsFirstArgument)
18220 OS << ")";
18221 OS << "]]";
18222 break;
18223 }
18224 }
18225 }
18226
18227 const char *HLSLResourceClassAttr::getSpelling() const {
18228 switch (getAttributeSpellingListIndex()) {
18229 default:
18230 llvm_unreachable("Unknown attribute spelling!");
18231 return "(No spelling)";
18232 case 0:
18233 return "resource_class";
18234 }
18235 }
18236
18237
18238 // HLSLSV_DispatchThreadIDAttr implementation
18239
18240 HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18241 auto *A = new (Ctx) HLSLSV_DispatchThreadIDAttr(Ctx, CommonInfo);
18242 A->setImplicit(true);
18243 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18244 A->setAttributeSpellingListIndex(0);
18245 return A;
18246 }
18247
18248 HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18249 auto *A = new (Ctx) HLSLSV_DispatchThreadIDAttr(Ctx, CommonInfo);
18250 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18251 A->setAttributeSpellingListIndex(0);
18252 return A;
18253 }
18254
18255 HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
18256 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18257 return CreateImplicit(Ctx, I);
18258 }
18259
18260 HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::Create(ASTContext &Ctx, SourceRange Range) {
18261 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18262 return Create(Ctx, I);
18263 }
18264
18265 HLSLSV_DispatchThreadIDAttr::HLSLSV_DispatchThreadIDAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18266 )
18267 : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLSV_DispatchThreadID, /*IsLateParsed=*/false, false)
18268 {
18269 }
18270
18271 HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::clone(ASTContext &C) const {
18272 auto *A = new (C) HLSLSV_DispatchThreadIDAttr(C, *this);
18273 A->Inherited = Inherited;
18274 A->IsPackExpansion = IsPackExpansion;
18275 A->setImplicit(Implicit);
18276 return A;
18277 }
18278
18279 void HLSLSV_DispatchThreadIDAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18280 bool IsFirstArgument = true; (void)IsFirstArgument;
18281 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18282 switch (getAttributeSpellingListIndex()) {
18283 default:
18284 llvm_unreachable("Unknown attribute spelling!");
18285 break;
18286 case 0 : {
18287 OS << ":SV_DispatchThreadID";
18288 OS << "";
18289 break;
18290 }
18291 }
18292 }
18293
18294 const char *HLSLSV_DispatchThreadIDAttr::getSpelling() const {
18295 switch (getAttributeSpellingListIndex()) {
18296 default:
18297 llvm_unreachable("Unknown attribute spelling!");
18298 return "(No spelling)";
18299 case 0:
18300 return "SV_DispatchThreadID";
18301 }
18302 }
18303
18304
18305 // HLSLSV_GroupIDAttr implementation
18306
18307 HLSLSV_GroupIDAttr *HLSLSV_GroupIDAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18308 auto *A = new (Ctx) HLSLSV_GroupIDAttr(Ctx, CommonInfo);
18309 A->setImplicit(true);
18310 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18311 A->setAttributeSpellingListIndex(0);
18312 return A;
18313 }
18314
18315 HLSLSV_GroupIDAttr *HLSLSV_GroupIDAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18316 auto *A = new (Ctx) HLSLSV_GroupIDAttr(Ctx, CommonInfo);
18317 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18318 A->setAttributeSpellingListIndex(0);
18319 return A;
18320 }
18321
18322 HLSLSV_GroupIDAttr *HLSLSV_GroupIDAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
18323 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18324 return CreateImplicit(Ctx, I);
18325 }
18326
18327 HLSLSV_GroupIDAttr *HLSLSV_GroupIDAttr::Create(ASTContext &Ctx, SourceRange Range) {
18328 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18329 return Create(Ctx, I);
18330 }
18331
18332 HLSLSV_GroupIDAttr::HLSLSV_GroupIDAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18333 )
18334 : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLSV_GroupID, /*IsLateParsed=*/false, false)
18335 {
18336 }
18337
18338 HLSLSV_GroupIDAttr *HLSLSV_GroupIDAttr::clone(ASTContext &C) const {
18339 auto *A = new (C) HLSLSV_GroupIDAttr(C, *this);
18340 A->Inherited = Inherited;
18341 A->IsPackExpansion = IsPackExpansion;
18342 A->setImplicit(Implicit);
18343 return A;
18344 }
18345
18346 void HLSLSV_GroupIDAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18347 bool IsFirstArgument = true; (void)IsFirstArgument;
18348 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18349 switch (getAttributeSpellingListIndex()) {
18350 default:
18351 llvm_unreachable("Unknown attribute spelling!");
18352 break;
18353 case 0 : {
18354 OS << ":SV_GroupID";
18355 OS << "";
18356 break;
18357 }
18358 }
18359 }
18360
18361 const char *HLSLSV_GroupIDAttr::getSpelling() const {
18362 switch (getAttributeSpellingListIndex()) {
18363 default:
18364 llvm_unreachable("Unknown attribute spelling!");
18365 return "(No spelling)";
18366 case 0:
18367 return "SV_GroupID";
18368 }
18369 }
18370
18371
18372 // HLSLSV_GroupIndexAttr implementation
18373
18374 HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18375 auto *A = new (Ctx) HLSLSV_GroupIndexAttr(Ctx, CommonInfo);
18376 A->setImplicit(true);
18377 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18378 A->setAttributeSpellingListIndex(0);
18379 return A;
18380 }
18381
18382 HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18383 auto *A = new (Ctx) HLSLSV_GroupIndexAttr(Ctx, CommonInfo);
18384 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18385 A->setAttributeSpellingListIndex(0);
18386 return A;
18387 }
18388
18389 HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
18390 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18391 return CreateImplicit(Ctx, I);
18392 }
18393
18394 HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::Create(ASTContext &Ctx, SourceRange Range) {
18395 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18396 return Create(Ctx, I);
18397 }
18398
18399 HLSLSV_GroupIndexAttr::HLSLSV_GroupIndexAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18400 )
18401 : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLSV_GroupIndex, /*IsLateParsed=*/false, false)
18402 {
18403 }
18404
18405 HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::clone(ASTContext &C) const {
18406 auto *A = new (C) HLSLSV_GroupIndexAttr(C, *this);
18407 A->Inherited = Inherited;
18408 A->IsPackExpansion = IsPackExpansion;
18409 A->setImplicit(Implicit);
18410 return A;
18411 }
18412
18413 void HLSLSV_GroupIndexAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18414 bool IsFirstArgument = true; (void)IsFirstArgument;
18415 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18416 switch (getAttributeSpellingListIndex()) {
18417 default:
18418 llvm_unreachable("Unknown attribute spelling!");
18419 break;
18420 case 0 : {
18421 OS << ":SV_GroupIndex";
18422 OS << "";
18423 break;
18424 }
18425 }
18426 }
18427
18428 const char *HLSLSV_GroupIndexAttr::getSpelling() const {
18429 switch (getAttributeSpellingListIndex()) {
18430 default:
18431 llvm_unreachable("Unknown attribute spelling!");
18432 return "(No spelling)";
18433 case 0:
18434 return "SV_GroupIndex";
18435 }
18436 }
18437
18438
18439 // HLSLSV_GroupThreadIDAttr implementation
18440
18441 HLSLSV_GroupThreadIDAttr *HLSLSV_GroupThreadIDAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18442 auto *A = new (Ctx) HLSLSV_GroupThreadIDAttr(Ctx, CommonInfo);
18443 A->setImplicit(true);
18444 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18445 A->setAttributeSpellingListIndex(0);
18446 return A;
18447 }
18448
18449 HLSLSV_GroupThreadIDAttr *HLSLSV_GroupThreadIDAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18450 auto *A = new (Ctx) HLSLSV_GroupThreadIDAttr(Ctx, CommonInfo);
18451 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18452 A->setAttributeSpellingListIndex(0);
18453 return A;
18454 }
18455
18456 HLSLSV_GroupThreadIDAttr *HLSLSV_GroupThreadIDAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
18457 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18458 return CreateImplicit(Ctx, I);
18459 }
18460
18461 HLSLSV_GroupThreadIDAttr *HLSLSV_GroupThreadIDAttr::Create(ASTContext &Ctx, SourceRange Range) {
18462 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18463 return Create(Ctx, I);
18464 }
18465
18466 HLSLSV_GroupThreadIDAttr::HLSLSV_GroupThreadIDAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18467 )
18468 : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLSV_GroupThreadID, /*IsLateParsed=*/false, false)
18469 {
18470 }
18471
18472 HLSLSV_GroupThreadIDAttr *HLSLSV_GroupThreadIDAttr::clone(ASTContext &C) const {
18473 auto *A = new (C) HLSLSV_GroupThreadIDAttr(C, *this);
18474 A->Inherited = Inherited;
18475 A->IsPackExpansion = IsPackExpansion;
18476 A->setImplicit(Implicit);
18477 return A;
18478 }
18479
18480 void HLSLSV_GroupThreadIDAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18481 bool IsFirstArgument = true; (void)IsFirstArgument;
18482 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18483 switch (getAttributeSpellingListIndex()) {
18484 default:
18485 llvm_unreachable("Unknown attribute spelling!");
18486 break;
18487 case 0 : {
18488 OS << ":SV_GroupThreadID";
18489 OS << "";
18490 break;
18491 }
18492 }
18493 }
18494
18495 const char *HLSLSV_GroupThreadIDAttr::getSpelling() const {
18496 switch (getAttributeSpellingListIndex()) {
18497 default:
18498 llvm_unreachable("Unknown attribute spelling!");
18499 return "(No spelling)";
18500 case 0:
18501 return "SV_GroupThreadID";
18502 }
18503 }
18504
18505
18506 // HLSLShaderAttr implementation
18507
18508 HLSLShaderAttr *HLSLShaderAttr::CreateImplicit(ASTContext &Ctx, llvm::Triple::EnvironmentType Type, const AttributeCommonInfo &CommonInfo) {
18509 auto *A = new (Ctx) HLSLShaderAttr(Ctx, CommonInfo, Type);
18510 A->setImplicit(true);
18511 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18512 A->setAttributeSpellingListIndex(0);
18513 return A;
18514 }
18515
18516 HLSLShaderAttr *HLSLShaderAttr::Create(ASTContext &Ctx, llvm::Triple::EnvironmentType Type, const AttributeCommonInfo &CommonInfo) {
18517 auto *A = new (Ctx) HLSLShaderAttr(Ctx, CommonInfo, Type);
18518 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18519 A->setAttributeSpellingListIndex(0);
18520 return A;
18521 }
18522
18523 HLSLShaderAttr *HLSLShaderAttr::CreateImplicit(ASTContext &Ctx, llvm::Triple::EnvironmentType Type, SourceRange Range) {
18524 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18525 return CreateImplicit(Ctx, Type, I);
18526 }
18527
18528 HLSLShaderAttr *HLSLShaderAttr::Create(ASTContext &Ctx, llvm::Triple::EnvironmentType Type, SourceRange Range) {
18529 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18530 return Create(Ctx, Type, I);
18531 }
18532
18533 HLSLShaderAttr::HLSLShaderAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18534 , llvm::Triple::EnvironmentType Type
18535 )
18536 : InheritableAttr(Ctx, CommonInfo, attr::HLSLShader, /*IsLateParsed=*/false, false)
18537 , type(Type)
18538 {
18539 }
18540
18541
18542
18543 bool HLSLShaderAttr::ConvertStrToEnvironmentType(StringRef Val, llvm::Triple::EnvironmentType &Out) {
18544 std::optional<llvm::Triple::EnvironmentType> R = llvm::StringSwitch<std::optional<llvm::Triple::EnvironmentType>>(Val)
18545 .Case("pixel", llvm::Triple::EnvironmentType::Pixel)
18546 .Case("vertex", llvm::Triple::EnvironmentType::Vertex)
18547 .Case("geometry", llvm::Triple::EnvironmentType::Geometry)
18548 .Case("hull", llvm::Triple::EnvironmentType::Hull)
18549 .Case("domain", llvm::Triple::EnvironmentType::Domain)
18550 .Case("compute", llvm::Triple::EnvironmentType::Compute)
18551 .Case("raygeneration", llvm::Triple::EnvironmentType::RayGeneration)
18552 .Case("intersection", llvm::Triple::EnvironmentType::Intersection)
18553 .Case("anyhit", llvm::Triple::EnvironmentType::AnyHit)
18554 .Case("closesthit", llvm::Triple::EnvironmentType::ClosestHit)
18555 .Case("miss", llvm::Triple::EnvironmentType::Miss)
18556 .Case("callable", llvm::Triple::EnvironmentType::Callable)
18557 .Case("mesh", llvm::Triple::EnvironmentType::Mesh)
18558 .Case("amplification", llvm::Triple::EnvironmentType::Amplification)
18559 .Default(std::optional<llvm::Triple::EnvironmentType>());
18560 if (R) {
18561 Out = *R;
18562 return true;
18563 }
18564 return false;
18565 }
18566
18567 const char *HLSLShaderAttr::ConvertEnvironmentTypeToStr(llvm::Triple::EnvironmentType Val) {
18568 switch(Val) {
18569 case llvm::Triple::EnvironmentType::Pixel: return "pixel";
18570 case llvm::Triple::EnvironmentType::Vertex: return "vertex";
18571 case llvm::Triple::EnvironmentType::Geometry: return "geometry";
18572 case llvm::Triple::EnvironmentType::Hull: return "hull";
18573 case llvm::Triple::EnvironmentType::Domain: return "domain";
18574 case llvm::Triple::EnvironmentType::Compute: return "compute";
18575 case llvm::Triple::EnvironmentType::RayGeneration: return "raygeneration";
18576 case llvm::Triple::EnvironmentType::Intersection: return "intersection";
18577 case llvm::Triple::EnvironmentType::AnyHit: return "anyhit";
18578 case llvm::Triple::EnvironmentType::ClosestHit: return "closesthit";
18579 case llvm::Triple::EnvironmentType::Miss: return "miss";
18580 case llvm::Triple::EnvironmentType::Callable: return "callable";
18581 case llvm::Triple::EnvironmentType::Mesh: return "mesh";
18582 case llvm::Triple::EnvironmentType::Amplification: return "amplification";
18583 default: llvm_unreachable("Invalid attribute value");
18584 }
18585 llvm_unreachable("No enumerator with that value");
18586 }
18587 HLSLShaderAttr *HLSLShaderAttr::clone(ASTContext &C) const {
18588 auto *A = new (C) HLSLShaderAttr(C, *this, type);
18589 A->Inherited = Inherited;
18590 A->IsPackExpansion = IsPackExpansion;
18591 A->setImplicit(Implicit);
18592 return A;
18593 }
18594
18595 void HLSLShaderAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18596 bool IsFirstArgument = true; (void)IsFirstArgument;
18597 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18598 switch (getAttributeSpellingListIndex()) {
18599 default:
18600 llvm_unreachable("Unknown attribute spelling!");
18601 break;
18602 case 0 : {
18603 OS << "[shader";
18604 DelimitAttributeArgument(OS, IsFirstArgument);
18605 OS << "\"" << HLSLShaderAttr::ConvertEnvironmentTypeToStr(getType()) << "\"";
18606 if (!IsFirstArgument)
18607 OS << ")";
18608 OS << "]";
18609 break;
18610 }
18611 }
18612 }
18613
18614 const char *HLSLShaderAttr::getSpelling() const {
18615 switch (getAttributeSpellingListIndex()) {
18616 default:
18617 llvm_unreachable("Unknown attribute spelling!");
18618 return "(No spelling)";
18619 case 0:
18620 return "shader";
18621 }
18622 }
18623
18624
18625 // HLSLWaveSizeAttr implementation
18626
18627 HLSLWaveSizeAttr *HLSLWaveSizeAttr::CreateImplicit(ASTContext &Ctx, int Min, int Max, int Preferred, const AttributeCommonInfo &CommonInfo) {
18628 auto *A = new (Ctx) HLSLWaveSizeAttr(Ctx, CommonInfo, Min, Max, Preferred);
18629 A->setImplicit(true);
18630 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18631 A->setAttributeSpellingListIndex(0);
18632 return A;
18633 }
18634
18635 HLSLWaveSizeAttr *HLSLWaveSizeAttr::Create(ASTContext &Ctx, int Min, int Max, int Preferred, const AttributeCommonInfo &CommonInfo) {
18636 auto *A = new (Ctx) HLSLWaveSizeAttr(Ctx, CommonInfo, Min, Max, Preferred);
18637 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18638 A->setAttributeSpellingListIndex(0);
18639 return A;
18640 }
18641
18642 HLSLWaveSizeAttr *HLSLWaveSizeAttr::CreateImplicit(ASTContext &Ctx, int Min, int Max, int Preferred, SourceRange Range) {
18643 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18644 return CreateImplicit(Ctx, Min, Max, Preferred, I);
18645 }
18646
18647 HLSLWaveSizeAttr *HLSLWaveSizeAttr::Create(ASTContext &Ctx, int Min, int Max, int Preferred, SourceRange Range) {
18648 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
18649 return Create(Ctx, Min, Max, Preferred, I);
18650 }
18651
18652 HLSLWaveSizeAttr::HLSLWaveSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18653 , int Min
18654 , int Max
18655 , int Preferred
18656 )
18657 : InheritableAttr(Ctx, CommonInfo, attr::HLSLWaveSize, /*IsLateParsed=*/false, false)
18658 , min(Min)
18659 , max(Max)
18660 , preferred(Preferred)
18661 {
18662 }
18663
18664 HLSLWaveSizeAttr::HLSLWaveSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18665 , int Min
18666 )
18667 : InheritableAttr(Ctx, CommonInfo, attr::HLSLWaveSize, /*IsLateParsed=*/false, false)
18668 , min(Min)
18669 , max()
18670 , preferred()
18671 {
18672 }
18673
18674
18675
18676
18677
18678
18679
18680 HLSLWaveSizeAttr *HLSLWaveSizeAttr::clone(ASTContext &C) const {
18681 auto *A = new (C) HLSLWaveSizeAttr(C, *this, min, max, preferred);
18682 A->Inherited = Inherited;
18683 A->IsPackExpansion = IsPackExpansion;
18684 A->setImplicit(Implicit);
18685 return A;
18686 }
18687
18688 void HLSLWaveSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18689 bool IsFirstArgument = true; (void)IsFirstArgument;
18690 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18691 switch (getAttributeSpellingListIndex()) {
18692 default:
18693 llvm_unreachable("Unknown attribute spelling!");
18694 break;
18695 case 0 : {
18696 OS << "[WaveSize";
18697 DelimitAttributeArgument(OS, IsFirstArgument);
18698 OS << "" << getMin() << "";
18699 DelimitAttributeArgument(OS, IsFirstArgument);
18700 OS << "" << getMax() << "";
18701 DelimitAttributeArgument(OS, IsFirstArgument);
18702 OS << "" << getPreferred() << "";
18703 if (!IsFirstArgument)
18704 OS << ")";
18705 OS << "]";
18706 break;
18707 }
18708 }
18709 }
18710
18711 const char *HLSLWaveSizeAttr::getSpelling() const {
18712 switch (getAttributeSpellingListIndex()) {
18713 default:
18714 llvm_unreachable("Unknown attribute spelling!");
18715 return "(No spelling)";
18716 case 0:
18717 return "WaveSize";
18718 }
18719 }
18720
18721
18722 // HotAttr implementation
18723
18724 HotAttr *HotAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18725 auto *A = new (Ctx) HotAttr(Ctx, CommonInfo);
18726 A->setImplicit(true);
18727 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18728 A->setAttributeSpellingListIndex(0);
18729 return A;
18730 }
18731
18732 HotAttr *HotAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18733 auto *A = new (Ctx) HotAttr(Ctx, CommonInfo);
18734 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18735 A->setAttributeSpellingListIndex(0);
18736 return A;
18737 }
18738
18739 HotAttr *HotAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
18740 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
18741 switch (S) {
18742 case GNU_hot:
18743 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18744 case CXX11_gnu_hot:
18745 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18746 case C23_gnu_hot:
18747 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18748 default:
18749 llvm_unreachable("Unknown attribute spelling!");
18750 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18751 }
18752 }());
18753 return CreateImplicit(Ctx, I);
18754 }
18755
18756 HotAttr *HotAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
18757 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
18758 switch (S) {
18759 case GNU_hot:
18760 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18761 case CXX11_gnu_hot:
18762 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18763 case C23_gnu_hot:
18764 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18765 default:
18766 llvm_unreachable("Unknown attribute spelling!");
18767 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18768 }
18769 }());
18770 return Create(Ctx, I);
18771 }
18772
18773 HotAttr::HotAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18774 )
18775 : InheritableAttr(Ctx, CommonInfo, attr::Hot, /*IsLateParsed=*/false, false)
18776 {
18777 }
18778
18779 HotAttr *HotAttr::clone(ASTContext &C) const {
18780 auto *A = new (C) HotAttr(C, *this);
18781 A->Inherited = Inherited;
18782 A->IsPackExpansion = IsPackExpansion;
18783 A->setImplicit(Implicit);
18784 return A;
18785 }
18786
18787 void HotAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18788 bool IsFirstArgument = true; (void)IsFirstArgument;
18789 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18790 switch (getAttributeSpellingListIndex()) {
18791 default:
18792 llvm_unreachable("Unknown attribute spelling!");
18793 break;
18794 case 0 : {
18795 OS << "__attribute__((hot";
18796 OS << "))";
18797 break;
18798 }
18799 case 1 : {
18800 OS << "[[gnu::hot";
18801 OS << "]]";
18802 break;
18803 }
18804 case 2 : {
18805 OS << "[[gnu::hot";
18806 OS << "]]";
18807 break;
18808 }
18809 }
18810 }
18811
18812 const char *HotAttr::getSpelling() const {
18813 switch (getAttributeSpellingListIndex()) {
18814 default:
18815 llvm_unreachable("Unknown attribute spelling!");
18816 return "(No spelling)";
18817 case 0:
18818 return "hot";
18819 case 1:
18820 return "hot";
18821 case 2:
18822 return "hot";
18823 }
18824 }
18825
18826
18827 // HybridPatchableAttr implementation
18828
18829 HybridPatchableAttr *HybridPatchableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18830 auto *A = new (Ctx) HybridPatchableAttr(Ctx, CommonInfo);
18831 A->setImplicit(true);
18832 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18833 A->setAttributeSpellingListIndex(0);
18834 return A;
18835 }
18836
18837 HybridPatchableAttr *HybridPatchableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18838 auto *A = new (Ctx) HybridPatchableAttr(Ctx, CommonInfo);
18839 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18840 A->setAttributeSpellingListIndex(0);
18841 return A;
18842 }
18843
18844 HybridPatchableAttr *HybridPatchableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
18845 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
18846 switch (S) {
18847 case Declspec_hybrid_patchable:
18848 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18849 case GNU_hybrid_patchable:
18850 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18851 case CXX11_clang_hybrid_patchable:
18852 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18853 case C23_clang_hybrid_patchable:
18854 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18855 default:
18856 llvm_unreachable("Unknown attribute spelling!");
18857 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18858 }
18859 }());
18860 return CreateImplicit(Ctx, I);
18861 }
18862
18863 HybridPatchableAttr *HybridPatchableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
18864 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
18865 switch (S) {
18866 case Declspec_hybrid_patchable:
18867 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18868 case GNU_hybrid_patchable:
18869 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18870 case CXX11_clang_hybrid_patchable:
18871 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18872 case C23_clang_hybrid_patchable:
18873 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18874 default:
18875 llvm_unreachable("Unknown attribute spelling!");
18876 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18877 }
18878 }());
18879 return Create(Ctx, I);
18880 }
18881
18882 HybridPatchableAttr::HybridPatchableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18883 )
18884 : InheritableAttr(Ctx, CommonInfo, attr::HybridPatchable, /*IsLateParsed=*/false, false)
18885 {
18886 }
18887
18888 HybridPatchableAttr *HybridPatchableAttr::clone(ASTContext &C) const {
18889 auto *A = new (C) HybridPatchableAttr(C, *this);
18890 A->Inherited = Inherited;
18891 A->IsPackExpansion = IsPackExpansion;
18892 A->setImplicit(Implicit);
18893 return A;
18894 }
18895
18896 void HybridPatchableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
18897 bool IsFirstArgument = true; (void)IsFirstArgument;
18898 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
18899 switch (getAttributeSpellingListIndex()) {
18900 default:
18901 llvm_unreachable("Unknown attribute spelling!");
18902 break;
18903 case 0 : {
18904 OS << "__declspec(hybrid_patchable";
18905 OS << ")";
18906 break;
18907 }
18908 case 1 : {
18909 OS << "__attribute__((hybrid_patchable";
18910 OS << "))";
18911 break;
18912 }
18913 case 2 : {
18914 OS << "[[clang::hybrid_patchable";
18915 OS << "]]";
18916 break;
18917 }
18918 case 3 : {
18919 OS << "[[clang::hybrid_patchable";
18920 OS << "]]";
18921 break;
18922 }
18923 }
18924 }
18925
18926 const char *HybridPatchableAttr::getSpelling() const {
18927 switch (getAttributeSpellingListIndex()) {
18928 default:
18929 llvm_unreachable("Unknown attribute spelling!");
18930 return "(No spelling)";
18931 case 0:
18932 return "hybrid_patchable";
18933 case 1:
18934 return "hybrid_patchable";
18935 case 2:
18936 return "hybrid_patchable";
18937 case 3:
18938 return "hybrid_patchable";
18939 }
18940 }
18941
18942
18943 // IBActionAttr implementation
18944
18945 IBActionAttr *IBActionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18946 auto *A = new (Ctx) IBActionAttr(Ctx, CommonInfo);
18947 A->setImplicit(true);
18948 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18949 A->setAttributeSpellingListIndex(0);
18950 return A;
18951 }
18952
18953 IBActionAttr *IBActionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
18954 auto *A = new (Ctx) IBActionAttr(Ctx, CommonInfo);
18955 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
18956 A->setAttributeSpellingListIndex(0);
18957 return A;
18958 }
18959
18960 IBActionAttr *IBActionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
18961 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
18962 switch (S) {
18963 case GNU_ibaction:
18964 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18965 case CXX11_clang_ibaction:
18966 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18967 case C23_clang_ibaction:
18968 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18969 default:
18970 llvm_unreachable("Unknown attribute spelling!");
18971 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18972 }
18973 }());
18974 return CreateImplicit(Ctx, I);
18975 }
18976
18977 IBActionAttr *IBActionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
18978 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
18979 switch (S) {
18980 case GNU_ibaction:
18981 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18982 case CXX11_clang_ibaction:
18983 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18984 case C23_clang_ibaction:
18985 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18986 default:
18987 llvm_unreachable("Unknown attribute spelling!");
18988 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
18989 }
18990 }());
18991 return Create(Ctx, I);
18992 }
18993
18994 IBActionAttr::IBActionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
18995 )
18996 : InheritableAttr(Ctx, CommonInfo, attr::IBAction, /*IsLateParsed=*/false, false)
18997 {
18998 }
18999
19000 IBActionAttr *IBActionAttr::clone(ASTContext &C) const {
19001 auto *A = new (C) IBActionAttr(C, *this);
19002 A->Inherited = Inherited;
19003 A->IsPackExpansion = IsPackExpansion;
19004 A->setImplicit(Implicit);
19005 return A;
19006 }
19007
19008 void IBActionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19009 bool IsFirstArgument = true; (void)IsFirstArgument;
19010 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19011 switch (getAttributeSpellingListIndex()) {
19012 default:
19013 llvm_unreachable("Unknown attribute spelling!");
19014 break;
19015 case 0 : {
19016 OS << "__attribute__((ibaction";
19017 OS << "))";
19018 break;
19019 }
19020 case 1 : {
19021 OS << "[[clang::ibaction";
19022 OS << "]]";
19023 break;
19024 }
19025 case 2 : {
19026 OS << "[[clang::ibaction";
19027 OS << "]]";
19028 break;
19029 }
19030 }
19031 }
19032
19033 const char *IBActionAttr::getSpelling() const {
19034 switch (getAttributeSpellingListIndex()) {
19035 default:
19036 llvm_unreachable("Unknown attribute spelling!");
19037 return "(No spelling)";
19038 case 0:
19039 return "ibaction";
19040 case 1:
19041 return "ibaction";
19042 case 2:
19043 return "ibaction";
19044 }
19045 }
19046
19047
19048 // IBOutletAttr implementation
19049
19050 IBOutletAttr *IBOutletAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19051 auto *A = new (Ctx) IBOutletAttr(Ctx, CommonInfo);
19052 A->setImplicit(true);
19053 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19054 A->setAttributeSpellingListIndex(0);
19055 return A;
19056 }
19057
19058 IBOutletAttr *IBOutletAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19059 auto *A = new (Ctx) IBOutletAttr(Ctx, CommonInfo);
19060 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19061 A->setAttributeSpellingListIndex(0);
19062 return A;
19063 }
19064
19065 IBOutletAttr *IBOutletAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
19066 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19067 switch (S) {
19068 case GNU_iboutlet:
19069 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19070 case CXX11_clang_iboutlet:
19071 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19072 case C23_clang_iboutlet:
19073 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19074 default:
19075 llvm_unreachable("Unknown attribute spelling!");
19076 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19077 }
19078 }());
19079 return CreateImplicit(Ctx, I);
19080 }
19081
19082 IBOutletAttr *IBOutletAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
19083 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19084 switch (S) {
19085 case GNU_iboutlet:
19086 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19087 case CXX11_clang_iboutlet:
19088 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19089 case C23_clang_iboutlet:
19090 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19091 default:
19092 llvm_unreachable("Unknown attribute spelling!");
19093 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19094 }
19095 }());
19096 return Create(Ctx, I);
19097 }
19098
19099 IBOutletAttr::IBOutletAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19100 )
19101 : InheritableAttr(Ctx, CommonInfo, attr::IBOutlet, /*IsLateParsed=*/false, false)
19102 {
19103 }
19104
19105 IBOutletAttr *IBOutletAttr::clone(ASTContext &C) const {
19106 auto *A = new (C) IBOutletAttr(C, *this);
19107 A->Inherited = Inherited;
19108 A->IsPackExpansion = IsPackExpansion;
19109 A->setImplicit(Implicit);
19110 return A;
19111 }
19112
19113 void IBOutletAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19114 bool IsFirstArgument = true; (void)IsFirstArgument;
19115 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19116 switch (getAttributeSpellingListIndex()) {
19117 default:
19118 llvm_unreachable("Unknown attribute spelling!");
19119 break;
19120 case 0 : {
19121 OS << "__attribute__((iboutlet";
19122 OS << "))";
19123 break;
19124 }
19125 case 1 : {
19126 OS << "[[clang::iboutlet";
19127 OS << "]]";
19128 break;
19129 }
19130 case 2 : {
19131 OS << "[[clang::iboutlet";
19132 OS << "]]";
19133 break;
19134 }
19135 }
19136 }
19137
19138 const char *IBOutletAttr::getSpelling() const {
19139 switch (getAttributeSpellingListIndex()) {
19140 default:
19141 llvm_unreachable("Unknown attribute spelling!");
19142 return "(No spelling)";
19143 case 0:
19144 return "iboutlet";
19145 case 1:
19146 return "iboutlet";
19147 case 2:
19148 return "iboutlet";
19149 }
19150 }
19151
19152
19153 // IBOutletCollectionAttr implementation
19154
19155 IBOutletCollectionAttr *IBOutletCollectionAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Interface, const AttributeCommonInfo &CommonInfo) {
19156 auto *A = new (Ctx) IBOutletCollectionAttr(Ctx, CommonInfo, Interface);
19157 A->setImplicit(true);
19158 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19159 A->setAttributeSpellingListIndex(0);
19160 return A;
19161 }
19162
19163 IBOutletCollectionAttr *IBOutletCollectionAttr::Create(ASTContext &Ctx, TypeSourceInfo * Interface, const AttributeCommonInfo &CommonInfo) {
19164 auto *A = new (Ctx) IBOutletCollectionAttr(Ctx, CommonInfo, Interface);
19165 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19166 A->setAttributeSpellingListIndex(0);
19167 return A;
19168 }
19169
19170 IBOutletCollectionAttr *IBOutletCollectionAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Interface, SourceRange Range, Spelling S) {
19171 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19172 switch (S) {
19173 case GNU_iboutletcollection:
19174 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19175 case CXX11_clang_iboutletcollection:
19176 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19177 case C23_clang_iboutletcollection:
19178 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19179 default:
19180 llvm_unreachable("Unknown attribute spelling!");
19181 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19182 }
19183 }());
19184 return CreateImplicit(Ctx, Interface, I);
19185 }
19186
19187 IBOutletCollectionAttr *IBOutletCollectionAttr::Create(ASTContext &Ctx, TypeSourceInfo * Interface, SourceRange Range, Spelling S) {
19188 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19189 switch (S) {
19190 case GNU_iboutletcollection:
19191 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19192 case CXX11_clang_iboutletcollection:
19193 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19194 case C23_clang_iboutletcollection:
19195 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19196 default:
19197 llvm_unreachable("Unknown attribute spelling!");
19198 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19199 }
19200 }());
19201 return Create(Ctx, Interface, I);
19202 }
19203
19204 IBOutletCollectionAttr::IBOutletCollectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19205 , TypeSourceInfo * Interface
19206 )
19207 : InheritableAttr(Ctx, CommonInfo, attr::IBOutletCollection, /*IsLateParsed=*/false, false)
19208 , interface_(Interface)
19209 {
19210 }
19211
19212 IBOutletCollectionAttr::IBOutletCollectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19213 )
19214 : InheritableAttr(Ctx, CommonInfo, attr::IBOutletCollection, /*IsLateParsed=*/false, false)
19215 , interface_()
19216 {
19217 }
19218
19219
19220
19221 IBOutletCollectionAttr *IBOutletCollectionAttr::clone(ASTContext &C) const {
19222 auto *A = new (C) IBOutletCollectionAttr(C, *this, interface_);
19223 A->Inherited = Inherited;
19224 A->IsPackExpansion = IsPackExpansion;
19225 A->setImplicit(Implicit);
19226 return A;
19227 }
19228
19229 void IBOutletCollectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19230 bool IsFirstArgument = true; (void)IsFirstArgument;
19231 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19232 switch (getAttributeSpellingListIndex()) {
19233 default:
19234 llvm_unreachable("Unknown attribute spelling!");
19235 break;
19236 case 0 : {
19237 OS << "__attribute__((iboutletcollection";
19238 if (!getInterfaceLoc())
19239 ++TrailingOmittedArgs;
19240 if (!(!getInterfaceLoc())) {
19241 DelimitAttributeArgument(OS, IsFirstArgument);
19242 OS << "" << getInterface().getAsString() << "";
19243 }
19244 if (!IsFirstArgument)
19245 OS << ")";
19246 OS << "))";
19247 break;
19248 }
19249 case 1 : {
19250 OS << "[[clang::iboutletcollection";
19251 if (!getInterfaceLoc())
19252 ++TrailingOmittedArgs;
19253 if (!(!getInterfaceLoc())) {
19254 DelimitAttributeArgument(OS, IsFirstArgument);
19255 OS << "" << getInterface().getAsString() << "";
19256 }
19257 if (!IsFirstArgument)
19258 OS << ")";
19259 OS << "]]";
19260 break;
19261 }
19262 case 2 : {
19263 OS << "[[clang::iboutletcollection";
19264 if (!getInterfaceLoc())
19265 ++TrailingOmittedArgs;
19266 if (!(!getInterfaceLoc())) {
19267 DelimitAttributeArgument(OS, IsFirstArgument);
19268 OS << "" << getInterface().getAsString() << "";
19269 }
19270 if (!IsFirstArgument)
19271 OS << ")";
19272 OS << "]]";
19273 break;
19274 }
19275 }
19276 }
19277
19278 const char *IBOutletCollectionAttr::getSpelling() const {
19279 switch (getAttributeSpellingListIndex()) {
19280 default:
19281 llvm_unreachable("Unknown attribute spelling!");
19282 return "(No spelling)";
19283 case 0:
19284 return "iboutletcollection";
19285 case 1:
19286 return "iboutletcollection";
19287 case 2:
19288 return "iboutletcollection";
19289 }
19290 }
19291
19292
19293 // IFuncAttr implementation
19294
19295 IFuncAttr *IFuncAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Resolver, const AttributeCommonInfo &CommonInfo) {
19296 auto *A = new (Ctx) IFuncAttr(Ctx, CommonInfo, Resolver);
19297 A->setImplicit(true);
19298 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19299 A->setAttributeSpellingListIndex(0);
19300 return A;
19301 }
19302
19303 IFuncAttr *IFuncAttr::Create(ASTContext &Ctx, llvm::StringRef Resolver, const AttributeCommonInfo &CommonInfo) {
19304 auto *A = new (Ctx) IFuncAttr(Ctx, CommonInfo, Resolver);
19305 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19306 A->setAttributeSpellingListIndex(0);
19307 return A;
19308 }
19309
19310 IFuncAttr *IFuncAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Resolver, SourceRange Range, Spelling S) {
19311 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19312 switch (S) {
19313 case GNU_ifunc:
19314 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19315 case CXX11_gnu_ifunc:
19316 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19317 case C23_gnu_ifunc:
19318 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19319 default:
19320 llvm_unreachable("Unknown attribute spelling!");
19321 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19322 }
19323 }());
19324 return CreateImplicit(Ctx, Resolver, I);
19325 }
19326
19327 IFuncAttr *IFuncAttr::Create(ASTContext &Ctx, llvm::StringRef Resolver, SourceRange Range, Spelling S) {
19328 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19329 switch (S) {
19330 case GNU_ifunc:
19331 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19332 case CXX11_gnu_ifunc:
19333 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19334 case C23_gnu_ifunc:
19335 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19336 default:
19337 llvm_unreachable("Unknown attribute spelling!");
19338 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19339 }
19340 }());
19341 return Create(Ctx, Resolver, I);
19342 }
19343
19344 IFuncAttr::IFuncAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19345 , llvm::StringRef Resolver
19346 )
19347 : Attr(Ctx, CommonInfo, attr::IFunc, /*IsLateParsed=*/false)
19348 , resolverLength(Resolver.size()),resolver(new (Ctx, 1) char[resolverLength])
19349 {
19350 if (!Resolver.empty())
19351 std::memcpy(resolver, Resolver.data(), resolverLength);
19352 }
19353
19354
19355
19356 IFuncAttr *IFuncAttr::clone(ASTContext &C) const {
19357 auto *A = new (C) IFuncAttr(C, *this, getResolver());
19358 A->Inherited = Inherited;
19359 A->IsPackExpansion = IsPackExpansion;
19360 A->setImplicit(Implicit);
19361 return A;
19362 }
19363
19364 void IFuncAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19365 bool IsFirstArgument = true; (void)IsFirstArgument;
19366 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19367 switch (getAttributeSpellingListIndex()) {
19368 default:
19369 llvm_unreachable("Unknown attribute spelling!");
19370 break;
19371 case 0 : {
19372 OS << "__attribute__((ifunc";
19373 DelimitAttributeArgument(OS, IsFirstArgument);
19374 OS << "\"" << getResolver() << "\"";
19375 if (!IsFirstArgument)
19376 OS << ")";
19377 OS << "))";
19378 break;
19379 }
19380 case 1 : {
19381 OS << "[[gnu::ifunc";
19382 DelimitAttributeArgument(OS, IsFirstArgument);
19383 OS << "\"" << getResolver() << "\"";
19384 if (!IsFirstArgument)
19385 OS << ")";
19386 OS << "]]";
19387 break;
19388 }
19389 case 2 : {
19390 OS << "[[gnu::ifunc";
19391 DelimitAttributeArgument(OS, IsFirstArgument);
19392 OS << "\"" << getResolver() << "\"";
19393 if (!IsFirstArgument)
19394 OS << ")";
19395 OS << "]]";
19396 break;
19397 }
19398 }
19399 }
19400
19401 const char *IFuncAttr::getSpelling() const {
19402 switch (getAttributeSpellingListIndex()) {
19403 default:
19404 llvm_unreachable("Unknown attribute spelling!");
19405 return "(No spelling)";
19406 case 0:
19407 return "ifunc";
19408 case 1:
19409 return "ifunc";
19410 case 2:
19411 return "ifunc";
19412 }
19413 }
19414
19415
19416 // InitPriorityAttr implementation
19417
19418 InitPriorityAttr *InitPriorityAttr::CreateImplicit(ASTContext &Ctx, unsigned Priority, const AttributeCommonInfo &CommonInfo) {
19419 auto *A = new (Ctx) InitPriorityAttr(Ctx, CommonInfo, Priority);
19420 A->setImplicit(true);
19421 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19422 A->setAttributeSpellingListIndex(0);
19423 return A;
19424 }
19425
19426 InitPriorityAttr *InitPriorityAttr::Create(ASTContext &Ctx, unsigned Priority, const AttributeCommonInfo &CommonInfo) {
19427 auto *A = new (Ctx) InitPriorityAttr(Ctx, CommonInfo, Priority);
19428 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19429 A->setAttributeSpellingListIndex(0);
19430 return A;
19431 }
19432
19433 InitPriorityAttr *InitPriorityAttr::CreateImplicit(ASTContext &Ctx, unsigned Priority, SourceRange Range, Spelling S) {
19434 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19435 switch (S) {
19436 case GNU_init_priority:
19437 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_init_priority, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19438 case CXX11_gnu_init_priority:
19439 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_init_priority, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19440 default:
19441 llvm_unreachable("Unknown attribute spelling!");
19442 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19443 }
19444 }());
19445 return CreateImplicit(Ctx, Priority, I);
19446 }
19447
19448 InitPriorityAttr *InitPriorityAttr::Create(ASTContext &Ctx, unsigned Priority, SourceRange Range, Spelling S) {
19449 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19450 switch (S) {
19451 case GNU_init_priority:
19452 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_init_priority, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19453 case CXX11_gnu_init_priority:
19454 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_init_priority, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19455 default:
19456 llvm_unreachable("Unknown attribute spelling!");
19457 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19458 }
19459 }());
19460 return Create(Ctx, Priority, I);
19461 }
19462
19463 InitPriorityAttr::InitPriorityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19464 , unsigned Priority
19465 )
19466 : InheritableAttr(Ctx, CommonInfo, attr::InitPriority, /*IsLateParsed=*/false, false)
19467 , priority(Priority)
19468 {
19469 }
19470
19471
19472
19473 InitPriorityAttr *InitPriorityAttr::clone(ASTContext &C) const {
19474 auto *A = new (C) InitPriorityAttr(C, *this, priority);
19475 A->Inherited = Inherited;
19476 A->IsPackExpansion = IsPackExpansion;
19477 A->setImplicit(Implicit);
19478 return A;
19479 }
19480
19481 void InitPriorityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19482 bool IsFirstArgument = true; (void)IsFirstArgument;
19483 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19484 switch (getAttributeSpellingListIndex()) {
19485 default:
19486 llvm_unreachable("Unknown attribute spelling!");
19487 break;
19488 case 0 : {
19489 OS << "__attribute__((init_priority";
19490 DelimitAttributeArgument(OS, IsFirstArgument);
19491 OS << "" << getPriority() << "";
19492 if (!IsFirstArgument)
19493 OS << ")";
19494 OS << "))";
19495 break;
19496 }
19497 case 1 : {
19498 OS << "[[gnu::init_priority";
19499 DelimitAttributeArgument(OS, IsFirstArgument);
19500 OS << "" << getPriority() << "";
19501 if (!IsFirstArgument)
19502 OS << ")";
19503 OS << "]]";
19504 break;
19505 }
19506 }
19507 }
19508
19509 const char *InitPriorityAttr::getSpelling() const {
19510 switch (getAttributeSpellingListIndex()) {
19511 default:
19512 llvm_unreachable("Unknown attribute spelling!");
19513 return "(No spelling)";
19514 case 0:
19515 return "init_priority";
19516 case 1:
19517 return "init_priority";
19518 }
19519 }
19520
19521
19522 // InitSegAttr implementation
19523
19524 InitSegAttr *InitSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Section, const AttributeCommonInfo &CommonInfo) {
19525 auto *A = new (Ctx) InitSegAttr(Ctx, CommonInfo, Section);
19526 A->setImplicit(true);
19527 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19528 A->setAttributeSpellingListIndex(0);
19529 return A;
19530 }
19531
19532 InitSegAttr *InitSegAttr::Create(ASTContext &Ctx, llvm::StringRef Section, const AttributeCommonInfo &CommonInfo) {
19533 auto *A = new (Ctx) InitSegAttr(Ctx, CommonInfo, Section);
19534 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19535 A->setAttributeSpellingListIndex(0);
19536 return A;
19537 }
19538
19539 InitSegAttr *InitSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Section, SourceRange Range) {
19540 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
19541 return CreateImplicit(Ctx, Section, I);
19542 }
19543
19544 InitSegAttr *InitSegAttr::Create(ASTContext &Ctx, llvm::StringRef Section, SourceRange Range) {
19545 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
19546 return Create(Ctx, Section, I);
19547 }
19548
19549 InitSegAttr::InitSegAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19550 , llvm::StringRef Section
19551 )
19552 : Attr(Ctx, CommonInfo, attr::InitSeg, /*IsLateParsed=*/false)
19553 , sectionLength(Section.size()),section(new (Ctx, 1) char[sectionLength])
19554 {
19555 if (!Section.empty())
19556 std::memcpy(section, Section.data(), sectionLength);
19557 }
19558
19559
19560
19561 InitSegAttr *InitSegAttr::clone(ASTContext &C) const {
19562 auto *A = new (C) InitSegAttr(C, *this, getSection());
19563 A->Inherited = Inherited;
19564 A->IsPackExpansion = IsPackExpansion;
19565 A->setImplicit(Implicit);
19566 return A;
19567 }
19568
19569 void InitSegAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19570 bool IsFirstArgument = true; (void)IsFirstArgument;
19571 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19572 switch (getAttributeSpellingListIndex()) {
19573 default:
19574 llvm_unreachable("Unknown attribute spelling!");
19575 break;
19576 case 0 : {
19577 OS << "#pragma init_seg";
19578 printPrettyPragma(OS, Policy);
19579 OS << "\n"; break;
19580 }
19581 }
19582 }
19583
19584 const char *InitSegAttr::getSpelling() const {
19585 switch (getAttributeSpellingListIndex()) {
19586 default:
19587 llvm_unreachable("Unknown attribute spelling!");
19588 return "(No spelling)";
19589 case 0:
19590 return "init_seg";
19591 }
19592 }
19593
19594
19595 // IntelOclBiccAttr implementation
19596
19597 IntelOclBiccAttr *IntelOclBiccAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19598 auto *A = new (Ctx) IntelOclBiccAttr(Ctx, CommonInfo);
19599 A->setImplicit(true);
19600 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19601 A->setAttributeSpellingListIndex(0);
19602 return A;
19603 }
19604
19605 IntelOclBiccAttr *IntelOclBiccAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19606 auto *A = new (Ctx) IntelOclBiccAttr(Ctx, CommonInfo);
19607 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19608 A->setAttributeSpellingListIndex(0);
19609 return A;
19610 }
19611
19612 IntelOclBiccAttr *IntelOclBiccAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
19613 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19614 switch (S) {
19615 case GNU_intel_ocl_bicc:
19616 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_intel_ocl_bicc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19617 case CXX11_clang_intel_ocl_bicc:
19618 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_intel_ocl_bicc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19619 default:
19620 llvm_unreachable("Unknown attribute spelling!");
19621 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19622 }
19623 }());
19624 return CreateImplicit(Ctx, I);
19625 }
19626
19627 IntelOclBiccAttr *IntelOclBiccAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
19628 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19629 switch (S) {
19630 case GNU_intel_ocl_bicc:
19631 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_intel_ocl_bicc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19632 case CXX11_clang_intel_ocl_bicc:
19633 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_intel_ocl_bicc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19634 default:
19635 llvm_unreachable("Unknown attribute spelling!");
19636 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19637 }
19638 }());
19639 return Create(Ctx, I);
19640 }
19641
19642 IntelOclBiccAttr::IntelOclBiccAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19643 )
19644 : InheritableAttr(Ctx, CommonInfo, attr::IntelOclBicc, /*IsLateParsed=*/false, false)
19645 {
19646 }
19647
19648 IntelOclBiccAttr *IntelOclBiccAttr::clone(ASTContext &C) const {
19649 auto *A = new (C) IntelOclBiccAttr(C, *this);
19650 A->Inherited = Inherited;
19651 A->IsPackExpansion = IsPackExpansion;
19652 A->setImplicit(Implicit);
19653 return A;
19654 }
19655
19656 void IntelOclBiccAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19657 bool IsFirstArgument = true; (void)IsFirstArgument;
19658 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19659 switch (getAttributeSpellingListIndex()) {
19660 default:
19661 llvm_unreachable("Unknown attribute spelling!");
19662 break;
19663 case 0 : {
19664 OS << "__attribute__((intel_ocl_bicc";
19665 OS << "))";
19666 break;
19667 }
19668 case 1 : {
19669 OS << "[[clang::intel_ocl_bicc";
19670 OS << "]]";
19671 break;
19672 }
19673 }
19674 }
19675
19676 const char *IntelOclBiccAttr::getSpelling() const {
19677 switch (getAttributeSpellingListIndex()) {
19678 default:
19679 llvm_unreachable("Unknown attribute spelling!");
19680 return "(No spelling)";
19681 case 0:
19682 return "intel_ocl_bicc";
19683 case 1:
19684 return "intel_ocl_bicc";
19685 }
19686 }
19687
19688
19689 // InternalLinkageAttr implementation
19690
19691 InternalLinkageAttr *InternalLinkageAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19692 auto *A = new (Ctx) InternalLinkageAttr(Ctx, CommonInfo);
19693 A->setImplicit(true);
19694 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19695 A->setAttributeSpellingListIndex(0);
19696 return A;
19697 }
19698
19699 InternalLinkageAttr *InternalLinkageAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19700 auto *A = new (Ctx) InternalLinkageAttr(Ctx, CommonInfo);
19701 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19702 A->setAttributeSpellingListIndex(0);
19703 return A;
19704 }
19705
19706 InternalLinkageAttr *InternalLinkageAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
19707 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19708 switch (S) {
19709 case GNU_internal_linkage:
19710 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19711 case CXX11_clang_internal_linkage:
19712 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19713 case C23_clang_internal_linkage:
19714 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19715 default:
19716 llvm_unreachable("Unknown attribute spelling!");
19717 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19718 }
19719 }());
19720 return CreateImplicit(Ctx, I);
19721 }
19722
19723 InternalLinkageAttr *InternalLinkageAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
19724 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19725 switch (S) {
19726 case GNU_internal_linkage:
19727 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19728 case CXX11_clang_internal_linkage:
19729 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19730 case C23_clang_internal_linkage:
19731 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19732 default:
19733 llvm_unreachable("Unknown attribute spelling!");
19734 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19735 }
19736 }());
19737 return Create(Ctx, I);
19738 }
19739
19740 InternalLinkageAttr::InternalLinkageAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19741 )
19742 : InheritableAttr(Ctx, CommonInfo, attr::InternalLinkage, /*IsLateParsed=*/false, false)
19743 {
19744 }
19745
19746 InternalLinkageAttr *InternalLinkageAttr::clone(ASTContext &C) const {
19747 auto *A = new (C) InternalLinkageAttr(C, *this);
19748 A->Inherited = Inherited;
19749 A->IsPackExpansion = IsPackExpansion;
19750 A->setImplicit(Implicit);
19751 return A;
19752 }
19753
19754 void InternalLinkageAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19755 bool IsFirstArgument = true; (void)IsFirstArgument;
19756 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19757 switch (getAttributeSpellingListIndex()) {
19758 default:
19759 llvm_unreachable("Unknown attribute spelling!");
19760 break;
19761 case 0 : {
19762 OS << "__attribute__((internal_linkage";
19763 OS << "))";
19764 break;
19765 }
19766 case 1 : {
19767 OS << "[[clang::internal_linkage";
19768 OS << "]]";
19769 break;
19770 }
19771 case 2 : {
19772 OS << "[[clang::internal_linkage";
19773 OS << "]]";
19774 break;
19775 }
19776 }
19777 }
19778
19779 const char *InternalLinkageAttr::getSpelling() const {
19780 switch (getAttributeSpellingListIndex()) {
19781 default:
19782 llvm_unreachable("Unknown attribute spelling!");
19783 return "(No spelling)";
19784 case 0:
19785 return "internal_linkage";
19786 case 1:
19787 return "internal_linkage";
19788 case 2:
19789 return "internal_linkage";
19790 }
19791 }
19792
19793
19794 // LTOVisibilityPublicAttr implementation
19795
19796 LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19797 auto *A = new (Ctx) LTOVisibilityPublicAttr(Ctx, CommonInfo);
19798 A->setImplicit(true);
19799 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19800 A->setAttributeSpellingListIndex(0);
19801 return A;
19802 }
19803
19804 LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19805 auto *A = new (Ctx) LTOVisibilityPublicAttr(Ctx, CommonInfo);
19806 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19807 A->setAttributeSpellingListIndex(0);
19808 return A;
19809 }
19810
19811 LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
19812 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19813 switch (S) {
19814 case GNU_lto_visibility_public:
19815 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19816 case CXX11_clang_lto_visibility_public:
19817 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19818 case C23_clang_lto_visibility_public:
19819 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19820 default:
19821 llvm_unreachable("Unknown attribute spelling!");
19822 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19823 }
19824 }());
19825 return CreateImplicit(Ctx, I);
19826 }
19827
19828 LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
19829 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19830 switch (S) {
19831 case GNU_lto_visibility_public:
19832 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19833 case CXX11_clang_lto_visibility_public:
19834 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19835 case C23_clang_lto_visibility_public:
19836 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19837 default:
19838 llvm_unreachable("Unknown attribute spelling!");
19839 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19840 }
19841 }());
19842 return Create(Ctx, I);
19843 }
19844
19845 LTOVisibilityPublicAttr::LTOVisibilityPublicAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19846 )
19847 : InheritableAttr(Ctx, CommonInfo, attr::LTOVisibilityPublic, /*IsLateParsed=*/false, false)
19848 {
19849 }
19850
19851 LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::clone(ASTContext &C) const {
19852 auto *A = new (C) LTOVisibilityPublicAttr(C, *this);
19853 A->Inherited = Inherited;
19854 A->IsPackExpansion = IsPackExpansion;
19855 A->setImplicit(Implicit);
19856 return A;
19857 }
19858
19859 void LTOVisibilityPublicAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19860 bool IsFirstArgument = true; (void)IsFirstArgument;
19861 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19862 switch (getAttributeSpellingListIndex()) {
19863 default:
19864 llvm_unreachable("Unknown attribute spelling!");
19865 break;
19866 case 0 : {
19867 OS << "__attribute__((lto_visibility_public";
19868 OS << "))";
19869 break;
19870 }
19871 case 1 : {
19872 OS << "[[clang::lto_visibility_public";
19873 OS << "]]";
19874 break;
19875 }
19876 case 2 : {
19877 OS << "[[clang::lto_visibility_public";
19878 OS << "]]";
19879 break;
19880 }
19881 }
19882 }
19883
19884 const char *LTOVisibilityPublicAttr::getSpelling() const {
19885 switch (getAttributeSpellingListIndex()) {
19886 default:
19887 llvm_unreachable("Unknown attribute spelling!");
19888 return "(No spelling)";
19889 case 0:
19890 return "lto_visibility_public";
19891 case 1:
19892 return "lto_visibility_public";
19893 case 2:
19894 return "lto_visibility_public";
19895 }
19896 }
19897
19898
19899 // LayoutVersionAttr implementation
19900
19901 LayoutVersionAttr *LayoutVersionAttr::CreateImplicit(ASTContext &Ctx, unsigned Version, const AttributeCommonInfo &CommonInfo) {
19902 auto *A = new (Ctx) LayoutVersionAttr(Ctx, CommonInfo, Version);
19903 A->setImplicit(true);
19904 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19905 A->setAttributeSpellingListIndex(0);
19906 return A;
19907 }
19908
19909 LayoutVersionAttr *LayoutVersionAttr::Create(ASTContext &Ctx, unsigned Version, const AttributeCommonInfo &CommonInfo) {
19910 auto *A = new (Ctx) LayoutVersionAttr(Ctx, CommonInfo, Version);
19911 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19912 A->setAttributeSpellingListIndex(0);
19913 return A;
19914 }
19915
19916 LayoutVersionAttr *LayoutVersionAttr::CreateImplicit(ASTContext &Ctx, unsigned Version, SourceRange Range) {
19917 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
19918 return CreateImplicit(Ctx, Version, I);
19919 }
19920
19921 LayoutVersionAttr *LayoutVersionAttr::Create(ASTContext &Ctx, unsigned Version, SourceRange Range) {
19922 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
19923 return Create(Ctx, Version, I);
19924 }
19925
19926 LayoutVersionAttr::LayoutVersionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
19927 , unsigned Version
19928 )
19929 : InheritableAttr(Ctx, CommonInfo, attr::LayoutVersion, /*IsLateParsed=*/false, false)
19930 , version(Version)
19931 {
19932 }
19933
19934
19935
19936 LayoutVersionAttr *LayoutVersionAttr::clone(ASTContext &C) const {
19937 auto *A = new (C) LayoutVersionAttr(C, *this, version);
19938 A->Inherited = Inherited;
19939 A->IsPackExpansion = IsPackExpansion;
19940 A->setImplicit(Implicit);
19941 return A;
19942 }
19943
19944 void LayoutVersionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
19945 bool IsFirstArgument = true; (void)IsFirstArgument;
19946 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
19947 switch (getAttributeSpellingListIndex()) {
19948 default:
19949 llvm_unreachable("Unknown attribute spelling!");
19950 break;
19951 case 0 : {
19952 OS << "__declspec(layout_version";
19953 DelimitAttributeArgument(OS, IsFirstArgument);
19954 OS << "" << getVersion() << "";
19955 if (!IsFirstArgument)
19956 OS << ")";
19957 OS << ")";
19958 break;
19959 }
19960 }
19961 }
19962
19963 const char *LayoutVersionAttr::getSpelling() const {
19964 switch (getAttributeSpellingListIndex()) {
19965 default:
19966 llvm_unreachable("Unknown attribute spelling!");
19967 return "(No spelling)";
19968 case 0:
19969 return "layout_version";
19970 }
19971 }
19972
19973
19974 // LeafAttr implementation
19975
19976 LeafAttr *LeafAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19977 auto *A = new (Ctx) LeafAttr(Ctx, CommonInfo);
19978 A->setImplicit(true);
19979 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19980 A->setAttributeSpellingListIndex(0);
19981 return A;
19982 }
19983
19984 LeafAttr *LeafAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
19985 auto *A = new (Ctx) LeafAttr(Ctx, CommonInfo);
19986 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
19987 A->setAttributeSpellingListIndex(0);
19988 return A;
19989 }
19990
19991 LeafAttr *LeafAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
19992 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
19993 switch (S) {
19994 case GNU_leaf:
19995 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19996 case CXX11_gnu_leaf:
19997 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
19998 case C23_gnu_leaf:
19999 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20000 default:
20001 llvm_unreachable("Unknown attribute spelling!");
20002 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20003 }
20004 }());
20005 return CreateImplicit(Ctx, I);
20006 }
20007
20008 LeafAttr *LeafAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
20009 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20010 switch (S) {
20011 case GNU_leaf:
20012 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20013 case CXX11_gnu_leaf:
20014 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20015 case C23_gnu_leaf:
20016 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20017 default:
20018 llvm_unreachable("Unknown attribute spelling!");
20019 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20020 }
20021 }());
20022 return Create(Ctx, I);
20023 }
20024
20025 LeafAttr::LeafAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20026 )
20027 : InheritableAttr(Ctx, CommonInfo, attr::Leaf, /*IsLateParsed=*/false, false)
20028 {
20029 }
20030
20031 LeafAttr *LeafAttr::clone(ASTContext &C) const {
20032 auto *A = new (C) LeafAttr(C, *this);
20033 A->Inherited = Inherited;
20034 A->IsPackExpansion = IsPackExpansion;
20035 A->setImplicit(Implicit);
20036 return A;
20037 }
20038
20039 void LeafAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
20040 bool IsFirstArgument = true; (void)IsFirstArgument;
20041 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
20042 switch (getAttributeSpellingListIndex()) {
20043 default:
20044 llvm_unreachable("Unknown attribute spelling!");
20045 break;
20046 case 0 : {
20047 OS << "__attribute__((leaf";
20048 OS << "))";
20049 break;
20050 }
20051 case 1 : {
20052 OS << "[[gnu::leaf";
20053 OS << "]]";
20054 break;
20055 }
20056 case 2 : {
20057 OS << "[[gnu::leaf";
20058 OS << "]]";
20059 break;
20060 }
20061 }
20062 }
20063
20064 const char *LeafAttr::getSpelling() const {
20065 switch (getAttributeSpellingListIndex()) {
20066 default:
20067 llvm_unreachable("Unknown attribute spelling!");
20068 return "(No spelling)";
20069 case 0:
20070 return "leaf";
20071 case 1:
20072 return "leaf";
20073 case 2:
20074 return "leaf";
20075 }
20076 }
20077
20078
20079 // LifetimeBoundAttr implementation
20080
20081 LifetimeBoundAttr *LifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
20082 auto *A = new (Ctx) LifetimeBoundAttr(Ctx, CommonInfo);
20083 A->setImplicit(true);
20084 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20085 A->setAttributeSpellingListIndex(0);
20086 return A;
20087 }
20088
20089 LifetimeBoundAttr *LifetimeBoundAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
20090 auto *A = new (Ctx) LifetimeBoundAttr(Ctx, CommonInfo);
20091 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20092 A->setAttributeSpellingListIndex(0);
20093 return A;
20094 }
20095
20096 LifetimeBoundAttr *LifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
20097 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20098 switch (S) {
20099 case GNU_lifetimebound:
20100 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20101 case CXX11_clang_lifetimebound:
20102 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20103 default:
20104 llvm_unreachable("Unknown attribute spelling!");
20105 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20106 }
20107 }());
20108 return CreateImplicit(Ctx, I);
20109 }
20110
20111 LifetimeBoundAttr *LifetimeBoundAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
20112 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20113 switch (S) {
20114 case GNU_lifetimebound:
20115 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20116 case CXX11_clang_lifetimebound:
20117 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20118 default:
20119 llvm_unreachable("Unknown attribute spelling!");
20120 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20121 }
20122 }());
20123 return Create(Ctx, I);
20124 }
20125
20126 LifetimeBoundAttr::LifetimeBoundAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20127 )
20128 : InheritableAttr(Ctx, CommonInfo, attr::LifetimeBound, /*IsLateParsed=*/false, false)
20129 {
20130 }
20131
20132 LifetimeBoundAttr *LifetimeBoundAttr::clone(ASTContext &C) const {
20133 auto *A = new (C) LifetimeBoundAttr(C, *this);
20134 A->Inherited = Inherited;
20135 A->IsPackExpansion = IsPackExpansion;
20136 A->setImplicit(Implicit);
20137 return A;
20138 }
20139
20140 void LifetimeBoundAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
20141 bool IsFirstArgument = true; (void)IsFirstArgument;
20142 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
20143 switch (getAttributeSpellingListIndex()) {
20144 default:
20145 llvm_unreachable("Unknown attribute spelling!");
20146 break;
20147 case 0 : {
20148 OS << "__attribute__((lifetimebound";
20149 OS << "))";
20150 break;
20151 }
20152 case 1 : {
20153 OS << "[[clang::lifetimebound";
20154 OS << "]]";
20155 break;
20156 }
20157 }
20158 }
20159
20160 const char *LifetimeBoundAttr::getSpelling() const {
20161 switch (getAttributeSpellingListIndex()) {
20162 default:
20163 llvm_unreachable("Unknown attribute spelling!");
20164 return "(No spelling)";
20165 case 0:
20166 return "lifetimebound";
20167 case 1:
20168 return "lifetimebound";
20169 }
20170 }
20171
20172
20173 // LifetimeCaptureByAttr implementation
20174
20175 LifetimeCaptureByAttr *LifetimeCaptureByAttr::CreateImplicit(ASTContext &Ctx, int *Params, unsigned ParamsSize, const AttributeCommonInfo &CommonInfo) {
20176 auto *A = new (Ctx) LifetimeCaptureByAttr(Ctx, CommonInfo, Params, ParamsSize);
20177 A->setImplicit(true);
20178 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20179 A->setAttributeSpellingListIndex(0);
20180 return A;
20181 }
20182
20183 LifetimeCaptureByAttr *LifetimeCaptureByAttr::Create(ASTContext &Ctx, int *Params, unsigned ParamsSize, const AttributeCommonInfo &CommonInfo) {
20184 auto *A = new (Ctx) LifetimeCaptureByAttr(Ctx, CommonInfo, Params, ParamsSize);
20185 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20186 A->setAttributeSpellingListIndex(0);
20187 return A;
20188 }
20189
20190 LifetimeCaptureByAttr *LifetimeCaptureByAttr::CreateImplicit(ASTContext &Ctx, int *Params, unsigned ParamsSize, SourceRange Range, Spelling S) {
20191 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20192 switch (S) {
20193 case GNU_lifetime_capture_by:
20194 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lifetime_capture_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20195 case CXX11_clang_lifetime_capture_by:
20196 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lifetime_capture_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20197 default:
20198 llvm_unreachable("Unknown attribute spelling!");
20199 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20200 }
20201 }());
20202 return CreateImplicit(Ctx, Params, ParamsSize, I);
20203 }
20204
20205 LifetimeCaptureByAttr *LifetimeCaptureByAttr::Create(ASTContext &Ctx, int *Params, unsigned ParamsSize, SourceRange Range, Spelling S) {
20206 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20207 switch (S) {
20208 case GNU_lifetime_capture_by:
20209 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lifetime_capture_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20210 case CXX11_clang_lifetime_capture_by:
20211 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lifetime_capture_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20212 default:
20213 llvm_unreachable("Unknown attribute spelling!");
20214 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20215 }
20216 }());
20217 return Create(Ctx, Params, ParamsSize, I);
20218 }
20219
20220 LifetimeCaptureByAttr::LifetimeCaptureByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20221 , int *Params, unsigned ParamsSize
20222 )
20223 : InheritableAttr(Ctx, CommonInfo, attr::LifetimeCaptureBy, /*IsLateParsed=*/false, false)
20224 , params_Size(ParamsSize), params_(new (Ctx, 16) int[params_Size])
20225 {
20226 std::copy(Params, Params + params_Size, params_);
20227 }
20228
20229 LifetimeCaptureByAttr::LifetimeCaptureByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20230 )
20231 : InheritableAttr(Ctx, CommonInfo, attr::LifetimeCaptureBy, /*IsLateParsed=*/false, false)
20232 , params_Size(0), params_(nullptr)
20233 {
20234 }
20235
20236
20237
20238 LifetimeCaptureByAttr *LifetimeCaptureByAttr::clone(ASTContext &C) const {
20239 auto *A = new (C) LifetimeCaptureByAttr(C, *this, params_, params_Size);
20240 A->Inherited = Inherited;
20241 A->IsPackExpansion = IsPackExpansion;
20242 A->setImplicit(Implicit);
20243 return A;
20244 }
20245
20246 void LifetimeCaptureByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
20247 bool IsFirstArgument = true; (void)IsFirstArgument;
20248 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
20249 switch (getAttributeSpellingListIndex()) {
20250 default:
20251 llvm_unreachable("Unknown attribute spelling!");
20252 break;
20253 case 0 : {
20254 OS << "__attribute__((lifetime_capture_by";
20255 OS << "";
20256 for (const auto &Val : params()) {
20257 DelimitAttributeArgument(OS, IsFirstArgument);
20258 OS << Val;
20259 }
20260 OS << "";
20261 if (!IsFirstArgument)
20262 OS << ")";
20263 OS << "))";
20264 break;
20265 }
20266 case 1 : {
20267 OS << "[[clang::lifetime_capture_by";
20268 OS << "";
20269 for (const auto &Val : params()) {
20270 DelimitAttributeArgument(OS, IsFirstArgument);
20271 OS << Val;
20272 }
20273 OS << "";
20274 if (!IsFirstArgument)
20275 OS << ")";
20276 OS << "]]";
20277 break;
20278 }
20279 }
20280 }
20281
20282 const char *LifetimeCaptureByAttr::getSpelling() const {
20283 switch (getAttributeSpellingListIndex()) {
20284 default:
20285 llvm_unreachable("Unknown attribute spelling!");
20286 return "(No spelling)";
20287 case 0:
20288 return "lifetime_capture_by";
20289 case 1:
20290 return "lifetime_capture_by";
20291 }
20292 }
20293
20294
20295 // LikelyAttr implementation
20296
20297 LikelyAttr *LikelyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
20298 auto *A = new (Ctx) LikelyAttr(Ctx, CommonInfo);
20299 A->setImplicit(true);
20300 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20301 A->setAttributeSpellingListIndex(0);
20302 return A;
20303 }
20304
20305 LikelyAttr *LikelyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
20306 auto *A = new (Ctx) LikelyAttr(Ctx, CommonInfo);
20307 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20308 A->setAttributeSpellingListIndex(0);
20309 return A;
20310 }
20311
20312 LikelyAttr *LikelyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
20313 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20314 switch (S) {
20315 case CXX11_likely:
20316 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_likely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20317 case C23_clang_likely:
20318 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_likely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20319 default:
20320 llvm_unreachable("Unknown attribute spelling!");
20321 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20322 }
20323 }());
20324 return CreateImplicit(Ctx, I);
20325 }
20326
20327 LikelyAttr *LikelyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
20328 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20329 switch (S) {
20330 case CXX11_likely:
20331 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_likely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20332 case C23_clang_likely:
20333 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_likely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20334 default:
20335 llvm_unreachable("Unknown attribute spelling!");
20336 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20337 }
20338 }());
20339 return Create(Ctx, I);
20340 }
20341
20342 LikelyAttr::LikelyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20343 )
20344 : StmtAttr(Ctx, CommonInfo, attr::Likely, /*IsLateParsed=*/false)
20345 {
20346 }
20347
20348 LikelyAttr *LikelyAttr::clone(ASTContext &C) const {
20349 auto *A = new (C) LikelyAttr(C, *this);
20350 A->Inherited = Inherited;
20351 A->IsPackExpansion = IsPackExpansion;
20352 A->setImplicit(Implicit);
20353 return A;
20354 }
20355
20356 void LikelyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
20357 bool IsFirstArgument = true; (void)IsFirstArgument;
20358 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
20359 switch (getAttributeSpellingListIndex()) {
20360 default:
20361 llvm_unreachable("Unknown attribute spelling!");
20362 break;
20363 case 0 : {
20364 OS << "[[likely";
20365 OS << "]]";
20366 break;
20367 }
20368 case 1 : {
20369 OS << "[[clang::likely";
20370 OS << "]]";
20371 break;
20372 }
20373 }
20374 }
20375
20376 const char *LikelyAttr::getSpelling() const {
20377 switch (getAttributeSpellingListIndex()) {
20378 default:
20379 llvm_unreachable("Unknown attribute spelling!");
20380 return "(No spelling)";
20381 case 0:
20382 return "likely";
20383 case 1:
20384 return "likely";
20385 }
20386 }
20387
20388
20389 // LoaderUninitializedAttr implementation
20390
20391 LoaderUninitializedAttr *LoaderUninitializedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
20392 auto *A = new (Ctx) LoaderUninitializedAttr(Ctx, CommonInfo);
20393 A->setImplicit(true);
20394 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20395 A->setAttributeSpellingListIndex(0);
20396 return A;
20397 }
20398
20399 LoaderUninitializedAttr *LoaderUninitializedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
20400 auto *A = new (Ctx) LoaderUninitializedAttr(Ctx, CommonInfo);
20401 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20402 A->setAttributeSpellingListIndex(0);
20403 return A;
20404 }
20405
20406 LoaderUninitializedAttr *LoaderUninitializedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
20407 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20408 switch (S) {
20409 case GNU_loader_uninitialized:
20410 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20411 case CXX11_clang_loader_uninitialized:
20412 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20413 case C23_clang_loader_uninitialized:
20414 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20415 default:
20416 llvm_unreachable("Unknown attribute spelling!");
20417 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20418 }
20419 }());
20420 return CreateImplicit(Ctx, I);
20421 }
20422
20423 LoaderUninitializedAttr *LoaderUninitializedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
20424 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20425 switch (S) {
20426 case GNU_loader_uninitialized:
20427 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20428 case CXX11_clang_loader_uninitialized:
20429 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20430 case C23_clang_loader_uninitialized:
20431 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20432 default:
20433 llvm_unreachable("Unknown attribute spelling!");
20434 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20435 }
20436 }());
20437 return Create(Ctx, I);
20438 }
20439
20440 LoaderUninitializedAttr::LoaderUninitializedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20441 )
20442 : Attr(Ctx, CommonInfo, attr::LoaderUninitialized, /*IsLateParsed=*/false)
20443 {
20444 }
20445
20446 LoaderUninitializedAttr *LoaderUninitializedAttr::clone(ASTContext &C) const {
20447 auto *A = new (C) LoaderUninitializedAttr(C, *this);
20448 A->Inherited = Inherited;
20449 A->IsPackExpansion = IsPackExpansion;
20450 A->setImplicit(Implicit);
20451 return A;
20452 }
20453
20454 void LoaderUninitializedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
20455 bool IsFirstArgument = true; (void)IsFirstArgument;
20456 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
20457 switch (getAttributeSpellingListIndex()) {
20458 default:
20459 llvm_unreachable("Unknown attribute spelling!");
20460 break;
20461 case 0 : {
20462 OS << "__attribute__((loader_uninitialized";
20463 OS << "))";
20464 break;
20465 }
20466 case 1 : {
20467 OS << "[[clang::loader_uninitialized";
20468 OS << "]]";
20469 break;
20470 }
20471 case 2 : {
20472 OS << "[[clang::loader_uninitialized";
20473 OS << "]]";
20474 break;
20475 }
20476 }
20477 }
20478
20479 const char *LoaderUninitializedAttr::getSpelling() const {
20480 switch (getAttributeSpellingListIndex()) {
20481 default:
20482 llvm_unreachable("Unknown attribute spelling!");
20483 return "(No spelling)";
20484 case 0:
20485 return "loader_uninitialized";
20486 case 1:
20487 return "loader_uninitialized";
20488 case 2:
20489 return "loader_uninitialized";
20490 }
20491 }
20492
20493
20494 // LockReturnedAttr implementation
20495
20496 LockReturnedAttr *LockReturnedAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) {
20497 auto *A = new (Ctx) LockReturnedAttr(Ctx, CommonInfo, Arg);
20498 A->setImplicit(true);
20499 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20500 A->setAttributeSpellingListIndex(0);
20501 return A;
20502 }
20503
20504 LockReturnedAttr *LockReturnedAttr::Create(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) {
20505 auto *A = new (Ctx) LockReturnedAttr(Ctx, CommonInfo, Arg);
20506 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20507 A->setAttributeSpellingListIndex(0);
20508 return A;
20509 }
20510
20511 LockReturnedAttr *LockReturnedAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Range) {
20512 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
20513 return CreateImplicit(Ctx, Arg, I);
20514 }
20515
20516 LockReturnedAttr *LockReturnedAttr::Create(ASTContext &Ctx, Expr * Arg, SourceRange Range) {
20517 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
20518 return Create(Ctx, Arg, I);
20519 }
20520
20521 LockReturnedAttr::LockReturnedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20522 , Expr * Arg
20523 )
20524 : InheritableAttr(Ctx, CommonInfo, attr::LockReturned, /*IsLateParsed=*/true, false)
20525 , arg(Arg)
20526 {
20527 }
20528
20529
20530
20531 LockReturnedAttr *LockReturnedAttr::clone(ASTContext &C) const {
20532 auto *A = new (C) LockReturnedAttr(C, *this, arg);
20533 A->Inherited = Inherited;
20534 A->IsPackExpansion = IsPackExpansion;
20535 A->setImplicit(Implicit);
20536 return A;
20537 }
20538
20539 void LockReturnedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
20540 bool IsFirstArgument = true; (void)IsFirstArgument;
20541 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
20542 switch (getAttributeSpellingListIndex()) {
20543 default:
20544 llvm_unreachable("Unknown attribute spelling!");
20545 break;
20546 case 0 : {
20547 OS << "__attribute__((lock_returned";
20548 DelimitAttributeArgument(OS, IsFirstArgument);
20549 OS << "";
20550 getArg()->printPretty(OS, nullptr, Policy);
20551 OS << "";
20552 if (!IsFirstArgument)
20553 OS << ")";
20554 OS << "))";
20555 break;
20556 }
20557 }
20558 }
20559
20560 const char *LockReturnedAttr::getSpelling() const {
20561 switch (getAttributeSpellingListIndex()) {
20562 default:
20563 llvm_unreachable("Unknown attribute spelling!");
20564 return "(No spelling)";
20565 case 0:
20566 return "lock_returned";
20567 }
20568 }
20569
20570
20571 // LocksExcludedAttr implementation
20572
20573 LocksExcludedAttr *LocksExcludedAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
20574 auto *A = new (Ctx) LocksExcludedAttr(Ctx, CommonInfo, Args, ArgsSize);
20575 A->setImplicit(true);
20576 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20577 A->setAttributeSpellingListIndex(0);
20578 return A;
20579 }
20580
20581 LocksExcludedAttr *LocksExcludedAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
20582 auto *A = new (Ctx) LocksExcludedAttr(Ctx, CommonInfo, Args, ArgsSize);
20583 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20584 A->setAttributeSpellingListIndex(0);
20585 return A;
20586 }
20587
20588 LocksExcludedAttr *LocksExcludedAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
20589 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
20590 return CreateImplicit(Ctx, Args, ArgsSize, I);
20591 }
20592
20593 LocksExcludedAttr *LocksExcludedAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
20594 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
20595 return Create(Ctx, Args, ArgsSize, I);
20596 }
20597
20598 LocksExcludedAttr::LocksExcludedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20599 , Expr * *Args, unsigned ArgsSize
20600 )
20601 : InheritableAttr(Ctx, CommonInfo, attr::LocksExcluded, /*IsLateParsed=*/true, true)
20602 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
20603 {
20604 std::copy(Args, Args + args_Size, args_);
20605 }
20606
20607 LocksExcludedAttr::LocksExcludedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20608 )
20609 : InheritableAttr(Ctx, CommonInfo, attr::LocksExcluded, /*IsLateParsed=*/true, true)
20610 , args_Size(0), args_(nullptr)
20611 {
20612 }
20613
20614
20615
20616 LocksExcludedAttr *LocksExcludedAttr::clone(ASTContext &C) const {
20617 auto *A = new (C) LocksExcludedAttr(C, *this, args_, args_Size);
20618 A->Inherited = Inherited;
20619 A->IsPackExpansion = IsPackExpansion;
20620 A->setImplicit(Implicit);
20621 return A;
20622 }
20623
20624 void LocksExcludedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
20625 bool IsFirstArgument = true; (void)IsFirstArgument;
20626 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
20627 switch (getAttributeSpellingListIndex()) {
20628 default:
20629 llvm_unreachable("Unknown attribute spelling!");
20630 break;
20631 case 0 : {
20632 OS << "__attribute__((locks_excluded";
20633 OS << "";
20634 for (const auto &Val : args()) {
20635 DelimitAttributeArgument(OS, IsFirstArgument);
20636 OS << Val;
20637 }
20638 OS << "";
20639 if (!IsFirstArgument)
20640 OS << ")";
20641 OS << "))";
20642 break;
20643 }
20644 }
20645 }
20646
20647 const char *LocksExcludedAttr::getSpelling() const {
20648 switch (getAttributeSpellingListIndex()) {
20649 default:
20650 llvm_unreachable("Unknown attribute spelling!");
20651 return "(No spelling)";
20652 case 0:
20653 return "locks_excluded";
20654 }
20655 }
20656
20657
20658 // LoopHintAttr implementation
20659
20660 LoopHintAttr *LoopHintAttr::CreateImplicit(ASTContext &Ctx, LoopHintAttr::OptionType Option, LoopHintAttr::LoopHintState State, Expr * Value, const AttributeCommonInfo &CommonInfo) {
20661 auto *A = new (Ctx) LoopHintAttr(Ctx, CommonInfo, Option, State, Value);
20662 A->setImplicit(true);
20663 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20664 A->setAttributeSpellingListIndex(0);
20665 return A;
20666 }
20667
20668 LoopHintAttr *LoopHintAttr::Create(ASTContext &Ctx, LoopHintAttr::OptionType Option, LoopHintAttr::LoopHintState State, Expr * Value, const AttributeCommonInfo &CommonInfo) {
20669 auto *A = new (Ctx) LoopHintAttr(Ctx, CommonInfo, Option, State, Value);
20670 return A;
20671 }
20672
20673 LoopHintAttr *LoopHintAttr::CreateImplicit(ASTContext &Ctx, LoopHintAttr::OptionType Option, LoopHintAttr::LoopHintState State, Expr * Value, SourceRange Range, Spelling S) {
20674 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20675 switch (S) {
20676 case Pragma_clang_loop:
20677 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_clang_loop, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20678 case Pragma_unroll:
20679 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_unroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20680 case Pragma_nounroll:
20681 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_nounroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20682 case Pragma_unroll_and_jam:
20683 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_unroll_and_jam, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20684 case Pragma_nounroll_and_jam:
20685 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_nounroll_and_jam, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20686 default:
20687 llvm_unreachable("Unknown attribute spelling!");
20688 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20689 }
20690 }());
20691 return CreateImplicit(Ctx, Option, State, Value, I);
20692 }
20693
20694 LoopHintAttr *LoopHintAttr::Create(ASTContext &Ctx, LoopHintAttr::OptionType Option, LoopHintAttr::LoopHintState State, Expr * Value, SourceRange Range, Spelling S) {
20695 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20696 switch (S) {
20697 case Pragma_clang_loop:
20698 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_clang_loop, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20699 case Pragma_unroll:
20700 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_unroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20701 case Pragma_nounroll:
20702 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_nounroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20703 case Pragma_unroll_and_jam:
20704 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_unroll_and_jam, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20705 case Pragma_nounroll_and_jam:
20706 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_nounroll_and_jam, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20707 default:
20708 llvm_unreachable("Unknown attribute spelling!");
20709 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20710 }
20711 }());
20712 return Create(Ctx, Option, State, Value, I);
20713 }
20714
20715 LoopHintAttr::LoopHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20716 , LoopHintAttr::OptionType Option
20717 , LoopHintAttr::LoopHintState State
20718 , Expr * Value
20719 )
20720 : Attr(Ctx, CommonInfo, attr::LoopHint, /*IsLateParsed=*/false)
20721 , option(Option)
20722 , state(State)
20723 , value(Value)
20724 {
20725 }
20726
20727 LoopHintAttr::Spelling LoopHintAttr::getSemanticSpelling() const {
20728 switch (getAttributeSpellingListIndex()) {
20729 default: llvm_unreachable("Unknown spelling list index");
20730 case 0: return Pragma_clang_loop;
20731 case 1: return Pragma_unroll;
20732 case 2: return Pragma_nounroll;
20733 case 3: return Pragma_unroll_and_jam;
20734 case 4: return Pragma_nounroll_and_jam;
20735 }
20736 }
20737
20738
20739 bool LoopHintAttr::ConvertStrToOptionType(StringRef Val, LoopHintAttr::OptionType &Out) {
20740 std::optional<LoopHintAttr::OptionType> R = llvm::StringSwitch<std::optional<LoopHintAttr::OptionType>>(Val)
20741 .Case("vectorize", LoopHintAttr::OptionType::Vectorize)
20742 .Case("vectorize_width", LoopHintAttr::OptionType::VectorizeWidth)
20743 .Case("interleave", LoopHintAttr::OptionType::Interleave)
20744 .Case("interleave_count", LoopHintAttr::OptionType::InterleaveCount)
20745 .Case("unroll", LoopHintAttr::OptionType::Unroll)
20746 .Case("unroll_count", LoopHintAttr::OptionType::UnrollCount)
20747 .Case("unroll_and_jam", LoopHintAttr::OptionType::UnrollAndJam)
20748 .Case("unroll_and_jam_count", LoopHintAttr::OptionType::UnrollAndJamCount)
20749 .Case("pipeline", LoopHintAttr::OptionType::PipelineDisabled)
20750 .Case("pipeline_initiation_interval", LoopHintAttr::OptionType::PipelineInitiationInterval)
20751 .Case("distribute", LoopHintAttr::OptionType::Distribute)
20752 .Case("vectorize_predicate", LoopHintAttr::OptionType::VectorizePredicate)
20753 .Default(std::optional<LoopHintAttr::OptionType>());
20754 if (R) {
20755 Out = *R;
20756 return true;
20757 }
20758 return false;
20759 }
20760
20761 const char *LoopHintAttr::ConvertOptionTypeToStr(LoopHintAttr::OptionType Val) {
20762 switch(Val) {
20763 case LoopHintAttr::OptionType::Vectorize: return "vectorize";
20764 case LoopHintAttr::OptionType::VectorizeWidth: return "vectorize_width";
20765 case LoopHintAttr::OptionType::Interleave: return "interleave";
20766 case LoopHintAttr::OptionType::InterleaveCount: return "interleave_count";
20767 case LoopHintAttr::OptionType::Unroll: return "unroll";
20768 case LoopHintAttr::OptionType::UnrollCount: return "unroll_count";
20769 case LoopHintAttr::OptionType::UnrollAndJam: return "unroll_and_jam";
20770 case LoopHintAttr::OptionType::UnrollAndJamCount: return "unroll_and_jam_count";
20771 case LoopHintAttr::OptionType::PipelineDisabled: return "pipeline";
20772 case LoopHintAttr::OptionType::PipelineInitiationInterval: return "pipeline_initiation_interval";
20773 case LoopHintAttr::OptionType::Distribute: return "distribute";
20774 case LoopHintAttr::OptionType::VectorizePredicate: return "vectorize_predicate";
20775 }
20776 llvm_unreachable("No enumerator with that value");
20777 }
20778
20779
20780 bool LoopHintAttr::ConvertStrToLoopHintState(StringRef Val, LoopHintAttr::LoopHintState &Out) {
20781 std::optional<LoopHintAttr::LoopHintState> R = llvm::StringSwitch<std::optional<LoopHintAttr::LoopHintState>>(Val)
20782 .Case("enable", LoopHintAttr::LoopHintState::Enable)
20783 .Case("disable", LoopHintAttr::LoopHintState::Disable)
20784 .Case("numeric", LoopHintAttr::LoopHintState::Numeric)
20785 .Case("fixed_width", LoopHintAttr::LoopHintState::FixedWidth)
20786 .Case("scalable_width", LoopHintAttr::LoopHintState::ScalableWidth)
20787 .Case("assume_safety", LoopHintAttr::LoopHintState::AssumeSafety)
20788 .Case("full", LoopHintAttr::LoopHintState::Full)
20789 .Default(std::optional<LoopHintAttr::LoopHintState>());
20790 if (R) {
20791 Out = *R;
20792 return true;
20793 }
20794 return false;
20795 }
20796
20797 const char *LoopHintAttr::ConvertLoopHintStateToStr(LoopHintAttr::LoopHintState Val) {
20798 switch(Val) {
20799 case LoopHintAttr::LoopHintState::Enable: return "enable";
20800 case LoopHintAttr::LoopHintState::Disable: return "disable";
20801 case LoopHintAttr::LoopHintState::Numeric: return "numeric";
20802 case LoopHintAttr::LoopHintState::FixedWidth: return "fixed_width";
20803 case LoopHintAttr::LoopHintState::ScalableWidth: return "scalable_width";
20804 case LoopHintAttr::LoopHintState::AssumeSafety: return "assume_safety";
20805 case LoopHintAttr::LoopHintState::Full: return "full";
20806 }
20807 llvm_unreachable("No enumerator with that value");
20808 }
20809
20810
20811 LoopHintAttr *LoopHintAttr::clone(ASTContext &C) const {
20812 auto *A = new (C) LoopHintAttr(C, *this, option, state, value);
20813 A->Inherited = Inherited;
20814 A->IsPackExpansion = IsPackExpansion;
20815 A->setImplicit(Implicit);
20816 return A;
20817 }
20818
20819 void LoopHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
20820 bool IsFirstArgument = true; (void)IsFirstArgument;
20821 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
20822 switch (getAttributeSpellingListIndex()) {
20823 default:
20824 llvm_unreachable("Unknown attribute spelling!");
20825 break;
20826 case 0 : {
20827 OS << "#pragma clang loop";
20828 printPrettyPragma(OS, Policy);
20829 OS << "\n"; break;
20830 }
20831 case 1 : {
20832 OS << "#pragma unroll";
20833 printPrettyPragma(OS, Policy);
20834 OS << "\n"; break;
20835 }
20836 case 2 : {
20837 OS << "#pragma nounroll";
20838 printPrettyPragma(OS, Policy);
20839 OS << "\n"; break;
20840 }
20841 case 3 : {
20842 OS << "#pragma unroll_and_jam";
20843 printPrettyPragma(OS, Policy);
20844 OS << "\n"; break;
20845 }
20846 case 4 : {
20847 OS << "#pragma nounroll_and_jam";
20848 printPrettyPragma(OS, Policy);
20849 OS << "\n"; break;
20850 }
20851 }
20852 }
20853
20854 const char *LoopHintAttr::getSpelling() const {
20855 switch (getAttributeSpellingListIndex()) {
20856 default:
20857 llvm_unreachable("Unknown attribute spelling!");
20858 return "(No spelling)";
20859 case 0:
20860 return "loop";
20861 case 1:
20862 return "unroll";
20863 case 2:
20864 return "nounroll";
20865 case 3:
20866 return "unroll_and_jam";
20867 case 4:
20868 return "nounroll_and_jam";
20869 }
20870 }
20871
20872
20873 // M68kInterruptAttr implementation
20874
20875 M68kInterruptAttr *M68kInterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) {
20876 auto *A = new (Ctx) M68kInterruptAttr(Ctx, CommonInfo, Number);
20877 A->setImplicit(true);
20878 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20879 A->setAttributeSpellingListIndex(0);
20880 return A;
20881 }
20882
20883 M68kInterruptAttr *M68kInterruptAttr::Create(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) {
20884 auto *A = new (Ctx) M68kInterruptAttr(Ctx, CommonInfo, Number);
20885 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20886 A->setAttributeSpellingListIndex(0);
20887 return A;
20888 }
20889
20890 M68kInterruptAttr *M68kInterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, SourceRange Range) {
20891 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
20892 return CreateImplicit(Ctx, Number, I);
20893 }
20894
20895 M68kInterruptAttr *M68kInterruptAttr::Create(ASTContext &Ctx, unsigned Number, SourceRange Range) {
20896 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
20897 return Create(Ctx, Number, I);
20898 }
20899
20900 M68kInterruptAttr::M68kInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
20901 , unsigned Number
20902 )
20903 : InheritableAttr(Ctx, CommonInfo, attr::M68kInterrupt, /*IsLateParsed=*/false, false)
20904 , number(Number)
20905 {
20906 }
20907
20908
20909
20910 M68kInterruptAttr *M68kInterruptAttr::clone(ASTContext &C) const {
20911 auto *A = new (C) M68kInterruptAttr(C, *this, number);
20912 A->Inherited = Inherited;
20913 A->IsPackExpansion = IsPackExpansion;
20914 A->setImplicit(Implicit);
20915 return A;
20916 }
20917
20918 void M68kInterruptAttr::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__((interrupt";
20927 DelimitAttributeArgument(OS, IsFirstArgument);
20928 OS << "" << getNumber() << "";
20929 if (!IsFirstArgument)
20930 OS << ")";
20931 OS << "))";
20932 break;
20933 }
20934 }
20935 }
20936
20937 const char *M68kInterruptAttr::getSpelling() const {
20938 switch (getAttributeSpellingListIndex()) {
20939 default:
20940 llvm_unreachable("Unknown attribute spelling!");
20941 return "(No spelling)";
20942 case 0:
20943 return "interrupt";
20944 }
20945 }
20946
20947
20948 // M68kRTDAttr implementation
20949
20950 M68kRTDAttr *M68kRTDAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
20951 auto *A = new (Ctx) M68kRTDAttr(Ctx, CommonInfo);
20952 A->setImplicit(true);
20953 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20954 A->setAttributeSpellingListIndex(0);
20955 return A;
20956 }
20957
20958 M68kRTDAttr *M68kRTDAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
20959 auto *A = new (Ctx) M68kRTDAttr(Ctx, CommonInfo);
20960 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
20961 A->setAttributeSpellingListIndex(0);
20962 return A;
20963 }
20964
20965 M68kRTDAttr *M68kRTDAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
20966 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20967 switch (S) {
20968 case GNU_m68k_rtd:
20969 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20970 case CXX11_clang_m68k_rtd:
20971 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20972 case C23_clang_m68k_rtd:
20973 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20974 default:
20975 llvm_unreachable("Unknown attribute spelling!");
20976 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20977 }
20978 }());
20979 return CreateImplicit(Ctx, I);
20980 }
20981
20982 M68kRTDAttr *M68kRTDAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
20983 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
20984 switch (S) {
20985 case GNU_m68k_rtd:
20986 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20987 case CXX11_clang_m68k_rtd:
20988 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20989 case C23_clang_m68k_rtd:
20990 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20991 default:
20992 llvm_unreachable("Unknown attribute spelling!");
20993 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
20994 }
20995 }());
20996 return Create(Ctx, I);
20997 }
20998
20999 M68kRTDAttr::M68kRTDAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21000 )
21001 : InheritableAttr(Ctx, CommonInfo, attr::M68kRTD, /*IsLateParsed=*/false, false)
21002 {
21003 }
21004
21005 M68kRTDAttr *M68kRTDAttr::clone(ASTContext &C) const {
21006 auto *A = new (C) M68kRTDAttr(C, *this);
21007 A->Inherited = Inherited;
21008 A->IsPackExpansion = IsPackExpansion;
21009 A->setImplicit(Implicit);
21010 return A;
21011 }
21012
21013 void M68kRTDAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21014 bool IsFirstArgument = true; (void)IsFirstArgument;
21015 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
21016 switch (getAttributeSpellingListIndex()) {
21017 default:
21018 llvm_unreachable("Unknown attribute spelling!");
21019 break;
21020 case 0 : {
21021 OS << "__attribute__((m68k_rtd";
21022 OS << "))";
21023 break;
21024 }
21025 case 1 : {
21026 OS << "[[clang::m68k_rtd";
21027 OS << "]]";
21028 break;
21029 }
21030 case 2 : {
21031 OS << "[[clang::m68k_rtd";
21032 OS << "]]";
21033 break;
21034 }
21035 }
21036 }
21037
21038 const char *M68kRTDAttr::getSpelling() const {
21039 switch (getAttributeSpellingListIndex()) {
21040 default:
21041 llvm_unreachable("Unknown attribute spelling!");
21042 return "(No spelling)";
21043 case 0:
21044 return "m68k_rtd";
21045 case 1:
21046 return "m68k_rtd";
21047 case 2:
21048 return "m68k_rtd";
21049 }
21050 }
21051
21052
21053 // MIGServerRoutineAttr implementation
21054
21055 MIGServerRoutineAttr *MIGServerRoutineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21056 auto *A = new (Ctx) MIGServerRoutineAttr(Ctx, CommonInfo);
21057 A->setImplicit(true);
21058 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21059 A->setAttributeSpellingListIndex(0);
21060 return A;
21061 }
21062
21063 MIGServerRoutineAttr *MIGServerRoutineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21064 auto *A = new (Ctx) MIGServerRoutineAttr(Ctx, CommonInfo);
21065 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21066 A->setAttributeSpellingListIndex(0);
21067 return A;
21068 }
21069
21070 MIGServerRoutineAttr *MIGServerRoutineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
21071 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21072 switch (S) {
21073 case GNU_mig_server_routine:
21074 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21075 case CXX11_clang_mig_server_routine:
21076 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21077 case C23_clang_mig_server_routine:
21078 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21079 default:
21080 llvm_unreachable("Unknown attribute spelling!");
21081 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21082 }
21083 }());
21084 return CreateImplicit(Ctx, I);
21085 }
21086
21087 MIGServerRoutineAttr *MIGServerRoutineAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
21088 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21089 switch (S) {
21090 case GNU_mig_server_routine:
21091 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21092 case CXX11_clang_mig_server_routine:
21093 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21094 case C23_clang_mig_server_routine:
21095 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21096 default:
21097 llvm_unreachable("Unknown attribute spelling!");
21098 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21099 }
21100 }());
21101 return Create(Ctx, I);
21102 }
21103
21104 MIGServerRoutineAttr::MIGServerRoutineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21105 )
21106 : InheritableAttr(Ctx, CommonInfo, attr::MIGServerRoutine, /*IsLateParsed=*/false, false)
21107 {
21108 }
21109
21110 MIGServerRoutineAttr *MIGServerRoutineAttr::clone(ASTContext &C) const {
21111 auto *A = new (C) MIGServerRoutineAttr(C, *this);
21112 A->Inherited = Inherited;
21113 A->IsPackExpansion = IsPackExpansion;
21114 A->setImplicit(Implicit);
21115 return A;
21116 }
21117
21118 void MIGServerRoutineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21119 bool IsFirstArgument = true; (void)IsFirstArgument;
21120 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
21121 switch (getAttributeSpellingListIndex()) {
21122 default:
21123 llvm_unreachable("Unknown attribute spelling!");
21124 break;
21125 case 0 : {
21126 OS << "__attribute__((mig_server_routine";
21127 OS << "))";
21128 break;
21129 }
21130 case 1 : {
21131 OS << "[[clang::mig_server_routine";
21132 OS << "]]";
21133 break;
21134 }
21135 case 2 : {
21136 OS << "[[clang::mig_server_routine";
21137 OS << "]]";
21138 break;
21139 }
21140 }
21141 }
21142
21143 const char *MIGServerRoutineAttr::getSpelling() const {
21144 switch (getAttributeSpellingListIndex()) {
21145 default:
21146 llvm_unreachable("Unknown attribute spelling!");
21147 return "(No spelling)";
21148 case 0:
21149 return "mig_server_routine";
21150 case 1:
21151 return "mig_server_routine";
21152 case 2:
21153 return "mig_server_routine";
21154 }
21155 }
21156
21157
21158 // MSABIAttr implementation
21159
21160 MSABIAttr *MSABIAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21161 auto *A = new (Ctx) MSABIAttr(Ctx, CommonInfo);
21162 A->setImplicit(true);
21163 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21164 A->setAttributeSpellingListIndex(0);
21165 return A;
21166 }
21167
21168 MSABIAttr *MSABIAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21169 auto *A = new (Ctx) MSABIAttr(Ctx, CommonInfo);
21170 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21171 A->setAttributeSpellingListIndex(0);
21172 return A;
21173 }
21174
21175 MSABIAttr *MSABIAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
21176 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21177 switch (S) {
21178 case GNU_ms_abi:
21179 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21180 case CXX11_gnu_ms_abi:
21181 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21182 case C23_gnu_ms_abi:
21183 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21184 default:
21185 llvm_unreachable("Unknown attribute spelling!");
21186 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21187 }
21188 }());
21189 return CreateImplicit(Ctx, I);
21190 }
21191
21192 MSABIAttr *MSABIAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
21193 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21194 switch (S) {
21195 case GNU_ms_abi:
21196 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21197 case CXX11_gnu_ms_abi:
21198 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21199 case C23_gnu_ms_abi:
21200 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21201 default:
21202 llvm_unreachable("Unknown attribute spelling!");
21203 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21204 }
21205 }());
21206 return Create(Ctx, I);
21207 }
21208
21209 MSABIAttr::MSABIAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21210 )
21211 : InheritableAttr(Ctx, CommonInfo, attr::MSABI, /*IsLateParsed=*/false, false)
21212 {
21213 }
21214
21215 MSABIAttr *MSABIAttr::clone(ASTContext &C) const {
21216 auto *A = new (C) MSABIAttr(C, *this);
21217 A->Inherited = Inherited;
21218 A->IsPackExpansion = IsPackExpansion;
21219 A->setImplicit(Implicit);
21220 return A;
21221 }
21222
21223 void MSABIAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21224 bool IsFirstArgument = true; (void)IsFirstArgument;
21225 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
21226 switch (getAttributeSpellingListIndex()) {
21227 default:
21228 llvm_unreachable("Unknown attribute spelling!");
21229 break;
21230 case 0 : {
21231 OS << "__attribute__((ms_abi";
21232 OS << "))";
21233 break;
21234 }
21235 case 1 : {
21236 OS << "[[gnu::ms_abi";
21237 OS << "]]";
21238 break;
21239 }
21240 case 2 : {
21241 OS << "[[gnu::ms_abi";
21242 OS << "]]";
21243 break;
21244 }
21245 }
21246 }
21247
21248 const char *MSABIAttr::getSpelling() const {
21249 switch (getAttributeSpellingListIndex()) {
21250 default:
21251 llvm_unreachable("Unknown attribute spelling!");
21252 return "(No spelling)";
21253 case 0:
21254 return "ms_abi";
21255 case 1:
21256 return "ms_abi";
21257 case 2:
21258 return "ms_abi";
21259 }
21260 }
21261
21262
21263 // MSAllocatorAttr implementation
21264
21265 MSAllocatorAttr *MSAllocatorAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21266 auto *A = new (Ctx) MSAllocatorAttr(Ctx, CommonInfo);
21267 A->setImplicit(true);
21268 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21269 A->setAttributeSpellingListIndex(0);
21270 return A;
21271 }
21272
21273 MSAllocatorAttr *MSAllocatorAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21274 auto *A = new (Ctx) MSAllocatorAttr(Ctx, CommonInfo);
21275 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21276 A->setAttributeSpellingListIndex(0);
21277 return A;
21278 }
21279
21280 MSAllocatorAttr *MSAllocatorAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
21281 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
21282 return CreateImplicit(Ctx, I);
21283 }
21284
21285 MSAllocatorAttr *MSAllocatorAttr::Create(ASTContext &Ctx, SourceRange Range) {
21286 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
21287 return Create(Ctx, I);
21288 }
21289
21290 MSAllocatorAttr::MSAllocatorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21291 )
21292 : InheritableAttr(Ctx, CommonInfo, attr::MSAllocator, /*IsLateParsed=*/false, false)
21293 {
21294 }
21295
21296 MSAllocatorAttr *MSAllocatorAttr::clone(ASTContext &C) const {
21297 auto *A = new (C) MSAllocatorAttr(C, *this);
21298 A->Inherited = Inherited;
21299 A->IsPackExpansion = IsPackExpansion;
21300 A->setImplicit(Implicit);
21301 return A;
21302 }
21303
21304 void MSAllocatorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21305 bool IsFirstArgument = true; (void)IsFirstArgument;
21306 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
21307 switch (getAttributeSpellingListIndex()) {
21308 default:
21309 llvm_unreachable("Unknown attribute spelling!");
21310 break;
21311 case 0 : {
21312 OS << "__declspec(allocator";
21313 OS << ")";
21314 break;
21315 }
21316 }
21317 }
21318
21319 const char *MSAllocatorAttr::getSpelling() const {
21320 switch (getAttributeSpellingListIndex()) {
21321 default:
21322 llvm_unreachable("Unknown attribute spelling!");
21323 return "(No spelling)";
21324 case 0:
21325 return "allocator";
21326 }
21327 }
21328
21329
21330 // MSConstexprAttr implementation
21331
21332 MSConstexprAttr *MSConstexprAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21333 auto *A = new (Ctx) MSConstexprAttr(Ctx, CommonInfo);
21334 A->setImplicit(true);
21335 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21336 A->setAttributeSpellingListIndex(0);
21337 return A;
21338 }
21339
21340 MSConstexprAttr *MSConstexprAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21341 auto *A = new (Ctx) MSConstexprAttr(Ctx, CommonInfo);
21342 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21343 A->setAttributeSpellingListIndex(0);
21344 return A;
21345 }
21346
21347 MSConstexprAttr *MSConstexprAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
21348 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
21349 return CreateImplicit(Ctx, I);
21350 }
21351
21352 MSConstexprAttr *MSConstexprAttr::Create(ASTContext &Ctx, SourceRange Range) {
21353 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
21354 return Create(Ctx, I);
21355 }
21356
21357 MSConstexprAttr::MSConstexprAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21358 )
21359 : InheritableAttr(Ctx, CommonInfo, attr::MSConstexpr, /*IsLateParsed=*/false, false)
21360 {
21361 }
21362
21363 MSConstexprAttr *MSConstexprAttr::clone(ASTContext &C) const {
21364 auto *A = new (C) MSConstexprAttr(C, *this);
21365 A->Inherited = Inherited;
21366 A->IsPackExpansion = IsPackExpansion;
21367 A->setImplicit(Implicit);
21368 return A;
21369 }
21370
21371 void MSConstexprAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21372 bool IsFirstArgument = true; (void)IsFirstArgument;
21373 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
21374 switch (getAttributeSpellingListIndex()) {
21375 default:
21376 llvm_unreachable("Unknown attribute spelling!");
21377 break;
21378 case 0 : {
21379 OS << "[[msvc::constexpr";
21380 OS << "]]";
21381 break;
21382 }
21383 }
21384 }
21385
21386 const char *MSConstexprAttr::getSpelling() const {
21387 switch (getAttributeSpellingListIndex()) {
21388 default:
21389 llvm_unreachable("Unknown attribute spelling!");
21390 return "(No spelling)";
21391 case 0:
21392 return "constexpr";
21393 }
21394 }
21395
21396
21397 // MSInheritanceAttr implementation
21398
21399 MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, bool BestCase, const AttributeCommonInfo &CommonInfo) {
21400 auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo, BestCase);
21401 A->setImplicit(true);
21402 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21403 A->setAttributeSpellingListIndex(0);
21404 return A;
21405 }
21406
21407 MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, bool BestCase, const AttributeCommonInfo &CommonInfo) {
21408 auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo, BestCase);
21409 return A;
21410 }
21411
21412 MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, bool BestCase, SourceRange Range, Spelling S) {
21413 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21414 switch (S) {
21415 case Keyword_single_inheritance:
21416 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_single_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21417 case Keyword_multiple_inheritance:
21418 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_multiple_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21419 case Keyword_virtual_inheritance:
21420 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_virtual_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21421 case Keyword_unspecified_inheritance:
21422 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_unspecified_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21423 default:
21424 llvm_unreachable("Unknown attribute spelling!");
21425 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21426 }
21427 }());
21428 return CreateImplicit(Ctx, BestCase, I);
21429 }
21430
21431 MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, bool BestCase, SourceRange Range, Spelling S) {
21432 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21433 switch (S) {
21434 case Keyword_single_inheritance:
21435 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_single_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21436 case Keyword_multiple_inheritance:
21437 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_multiple_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21438 case Keyword_virtual_inheritance:
21439 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_virtual_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21440 case Keyword_unspecified_inheritance:
21441 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_unspecified_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21442 default:
21443 llvm_unreachable("Unknown attribute spelling!");
21444 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21445 }
21446 }());
21447 return Create(Ctx, BestCase, I);
21448 }
21449
21450 MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21451 auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo);
21452 A->setImplicit(true);
21453 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21454 A->setAttributeSpellingListIndex(0);
21455 return A;
21456 }
21457
21458 MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21459 auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo);
21460 return A;
21461 }
21462
21463 MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
21464 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21465 switch (S) {
21466 case Keyword_single_inheritance:
21467 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_single_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21468 case Keyword_multiple_inheritance:
21469 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_multiple_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21470 case Keyword_virtual_inheritance:
21471 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_virtual_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21472 case Keyword_unspecified_inheritance:
21473 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_unspecified_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21474 default:
21475 llvm_unreachable("Unknown attribute spelling!");
21476 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21477 }
21478 }());
21479 return CreateImplicit(Ctx, I);
21480 }
21481
21482 MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
21483 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21484 switch (S) {
21485 case Keyword_single_inheritance:
21486 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_single_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21487 case Keyword_multiple_inheritance:
21488 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_multiple_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21489 case Keyword_virtual_inheritance:
21490 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_virtual_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21491 case Keyword_unspecified_inheritance:
21492 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_unspecified_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21493 default:
21494 llvm_unreachable("Unknown attribute spelling!");
21495 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21496 }
21497 }());
21498 return Create(Ctx, I);
21499 }
21500
21501 MSInheritanceAttr::MSInheritanceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21502 , bool BestCase
21503 )
21504 : InheritableAttr(Ctx, CommonInfo, attr::MSInheritance, /*IsLateParsed=*/false, false)
21505 , bestCase(BestCase)
21506 {
21507 }
21508
21509 MSInheritanceAttr::MSInheritanceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21510 )
21511 : InheritableAttr(Ctx, CommonInfo, attr::MSInheritance, /*IsLateParsed=*/false, false)
21512 , bestCase()
21513 {
21514 }
21515
21516 MSInheritanceAttr::Spelling MSInheritanceAttr::getSemanticSpelling() const {
21517 switch (getAttributeSpellingListIndex()) {
21518 default: llvm_unreachable("Unknown spelling list index");
21519 case 0: return Keyword_single_inheritance;
21520 case 1: return Keyword_multiple_inheritance;
21521 case 2: return Keyword_virtual_inheritance;
21522 case 3: return Keyword_unspecified_inheritance;
21523 }
21524 }
21525
21526
21527 MSInheritanceAttr *MSInheritanceAttr::clone(ASTContext &C) const {
21528 auto *A = new (C) MSInheritanceAttr(C, *this, bestCase);
21529 A->Inherited = Inherited;
21530 A->IsPackExpansion = IsPackExpansion;
21531 A->setImplicit(Implicit);
21532 return A;
21533 }
21534
21535 void MSInheritanceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21536 bool IsFirstArgument = true; (void)IsFirstArgument;
21537 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
21538 switch (getAttributeSpellingListIndex()) {
21539 default:
21540 llvm_unreachable("Unknown attribute spelling!");
21541 break;
21542 case 0 : {
21543 OS << "__single_inheritance";
21544 OS << "";
21545 break;
21546 }
21547 case 1 : {
21548 OS << "__multiple_inheritance";
21549 OS << "";
21550 break;
21551 }
21552 case 2 : {
21553 OS << "__virtual_inheritance";
21554 OS << "";
21555 break;
21556 }
21557 case 3 : {
21558 OS << "__unspecified_inheritance";
21559 OS << "";
21560 break;
21561 }
21562 }
21563 }
21564
21565 const char *MSInheritanceAttr::getSpelling() const {
21566 switch (getAttributeSpellingListIndex()) {
21567 default:
21568 llvm_unreachable("Unknown attribute spelling!");
21569 return "(No spelling)";
21570 case 0:
21571 return "__single_inheritance";
21572 case 1:
21573 return "__multiple_inheritance";
21574 case 2:
21575 return "__virtual_inheritance";
21576 case 3:
21577 return "__unspecified_inheritance";
21578 }
21579 }
21580
21581
21582 // MSNoVTableAttr implementation
21583
21584 MSNoVTableAttr *MSNoVTableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21585 auto *A = new (Ctx) MSNoVTableAttr(Ctx, CommonInfo);
21586 A->setImplicit(true);
21587 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21588 A->setAttributeSpellingListIndex(0);
21589 return A;
21590 }
21591
21592 MSNoVTableAttr *MSNoVTableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21593 auto *A = new (Ctx) MSNoVTableAttr(Ctx, CommonInfo);
21594 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21595 A->setAttributeSpellingListIndex(0);
21596 return A;
21597 }
21598
21599 MSNoVTableAttr *MSNoVTableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
21600 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
21601 return CreateImplicit(Ctx, I);
21602 }
21603
21604 MSNoVTableAttr *MSNoVTableAttr::Create(ASTContext &Ctx, SourceRange Range) {
21605 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
21606 return Create(Ctx, I);
21607 }
21608
21609 MSNoVTableAttr::MSNoVTableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21610 )
21611 : InheritableAttr(Ctx, CommonInfo, attr::MSNoVTable, /*IsLateParsed=*/false, false)
21612 {
21613 }
21614
21615 MSNoVTableAttr *MSNoVTableAttr::clone(ASTContext &C) const {
21616 auto *A = new (C) MSNoVTableAttr(C, *this);
21617 A->Inherited = Inherited;
21618 A->IsPackExpansion = IsPackExpansion;
21619 A->setImplicit(Implicit);
21620 return A;
21621 }
21622
21623 void MSNoVTableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21624 bool IsFirstArgument = true; (void)IsFirstArgument;
21625 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
21626 switch (getAttributeSpellingListIndex()) {
21627 default:
21628 llvm_unreachable("Unknown attribute spelling!");
21629 break;
21630 case 0 : {
21631 OS << "__declspec(novtable";
21632 OS << ")";
21633 break;
21634 }
21635 }
21636 }
21637
21638 const char *MSNoVTableAttr::getSpelling() const {
21639 switch (getAttributeSpellingListIndex()) {
21640 default:
21641 llvm_unreachable("Unknown attribute spelling!");
21642 return "(No spelling)";
21643 case 0:
21644 return "novtable";
21645 }
21646 }
21647
21648
21649 // MSP430InterruptAttr implementation
21650
21651 MSP430InterruptAttr *MSP430InterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) {
21652 auto *A = new (Ctx) MSP430InterruptAttr(Ctx, CommonInfo, Number);
21653 A->setImplicit(true);
21654 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21655 A->setAttributeSpellingListIndex(0);
21656 return A;
21657 }
21658
21659 MSP430InterruptAttr *MSP430InterruptAttr::Create(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) {
21660 auto *A = new (Ctx) MSP430InterruptAttr(Ctx, CommonInfo, Number);
21661 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21662 A->setAttributeSpellingListIndex(0);
21663 return A;
21664 }
21665
21666 MSP430InterruptAttr *MSP430InterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, SourceRange Range, Spelling S) {
21667 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21668 switch (S) {
21669 case GNU_interrupt:
21670 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21671 case CXX11_gnu_interrupt:
21672 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21673 case C23_gnu_interrupt:
21674 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21675 default:
21676 llvm_unreachable("Unknown attribute spelling!");
21677 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21678 }
21679 }());
21680 return CreateImplicit(Ctx, Number, I);
21681 }
21682
21683 MSP430InterruptAttr *MSP430InterruptAttr::Create(ASTContext &Ctx, unsigned Number, SourceRange Range, Spelling S) {
21684 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21685 switch (S) {
21686 case GNU_interrupt:
21687 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21688 case CXX11_gnu_interrupt:
21689 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21690 case C23_gnu_interrupt:
21691 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21692 default:
21693 llvm_unreachable("Unknown attribute spelling!");
21694 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21695 }
21696 }());
21697 return Create(Ctx, Number, I);
21698 }
21699
21700 MSP430InterruptAttr::MSP430InterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21701 , unsigned Number
21702 )
21703 : InheritableAttr(Ctx, CommonInfo, attr::MSP430Interrupt, /*IsLateParsed=*/false, false)
21704 , number(Number)
21705 {
21706 }
21707
21708
21709
21710 MSP430InterruptAttr *MSP430InterruptAttr::clone(ASTContext &C) const {
21711 auto *A = new (C) MSP430InterruptAttr(C, *this, number);
21712 A->Inherited = Inherited;
21713 A->IsPackExpansion = IsPackExpansion;
21714 A->setImplicit(Implicit);
21715 return A;
21716 }
21717
21718 void MSP430InterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21719 bool IsFirstArgument = true; (void)IsFirstArgument;
21720 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
21721 switch (getAttributeSpellingListIndex()) {
21722 default:
21723 llvm_unreachable("Unknown attribute spelling!");
21724 break;
21725 case 0 : {
21726 OS << "__attribute__((interrupt";
21727 DelimitAttributeArgument(OS, IsFirstArgument);
21728 OS << "" << getNumber() << "";
21729 if (!IsFirstArgument)
21730 OS << ")";
21731 OS << "))";
21732 break;
21733 }
21734 case 1 : {
21735 OS << "[[gnu::interrupt";
21736 DelimitAttributeArgument(OS, IsFirstArgument);
21737 OS << "" << getNumber() << "";
21738 if (!IsFirstArgument)
21739 OS << ")";
21740 OS << "]]";
21741 break;
21742 }
21743 case 2 : {
21744 OS << "[[gnu::interrupt";
21745 DelimitAttributeArgument(OS, IsFirstArgument);
21746 OS << "" << getNumber() << "";
21747 if (!IsFirstArgument)
21748 OS << ")";
21749 OS << "]]";
21750 break;
21751 }
21752 }
21753 }
21754
21755 const char *MSP430InterruptAttr::getSpelling() const {
21756 switch (getAttributeSpellingListIndex()) {
21757 default:
21758 llvm_unreachable("Unknown attribute spelling!");
21759 return "(No spelling)";
21760 case 0:
21761 return "interrupt";
21762 case 1:
21763 return "interrupt";
21764 case 2:
21765 return "interrupt";
21766 }
21767 }
21768
21769
21770 // MSStructAttr implementation
21771
21772 MSStructAttr *MSStructAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21773 auto *A = new (Ctx) MSStructAttr(Ctx, CommonInfo);
21774 A->setImplicit(true);
21775 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21776 A->setAttributeSpellingListIndex(0);
21777 return A;
21778 }
21779
21780 MSStructAttr *MSStructAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21781 auto *A = new (Ctx) MSStructAttr(Ctx, CommonInfo);
21782 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21783 A->setAttributeSpellingListIndex(0);
21784 return A;
21785 }
21786
21787 MSStructAttr *MSStructAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
21788 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21789 switch (S) {
21790 case GNU_ms_struct:
21791 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21792 case CXX11_gnu_ms_struct:
21793 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21794 case C23_gnu_ms_struct:
21795 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21796 default:
21797 llvm_unreachable("Unknown attribute spelling!");
21798 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21799 }
21800 }());
21801 return CreateImplicit(Ctx, I);
21802 }
21803
21804 MSStructAttr *MSStructAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
21805 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
21806 switch (S) {
21807 case GNU_ms_struct:
21808 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21809 case CXX11_gnu_ms_struct:
21810 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21811 case C23_gnu_ms_struct:
21812 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21813 default:
21814 llvm_unreachable("Unknown attribute spelling!");
21815 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
21816 }
21817 }());
21818 return Create(Ctx, I);
21819 }
21820
21821 MSStructAttr::MSStructAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21822 )
21823 : InheritableAttr(Ctx, CommonInfo, attr::MSStruct, /*IsLateParsed=*/false, false)
21824 {
21825 }
21826
21827 MSStructAttr *MSStructAttr::clone(ASTContext &C) const {
21828 auto *A = new (C) MSStructAttr(C, *this);
21829 A->Inherited = Inherited;
21830 A->IsPackExpansion = IsPackExpansion;
21831 A->setImplicit(Implicit);
21832 return A;
21833 }
21834
21835 void MSStructAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21836 bool IsFirstArgument = true; (void)IsFirstArgument;
21837 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
21838 switch (getAttributeSpellingListIndex()) {
21839 default:
21840 llvm_unreachable("Unknown attribute spelling!");
21841 break;
21842 case 0 : {
21843 OS << "__attribute__((ms_struct";
21844 OS << "))";
21845 break;
21846 }
21847 case 1 : {
21848 OS << "[[gnu::ms_struct";
21849 OS << "]]";
21850 break;
21851 }
21852 case 2 : {
21853 OS << "[[gnu::ms_struct";
21854 OS << "]]";
21855 break;
21856 }
21857 }
21858 }
21859
21860 const char *MSStructAttr::getSpelling() const {
21861 switch (getAttributeSpellingListIndex()) {
21862 default:
21863 llvm_unreachable("Unknown attribute spelling!");
21864 return "(No spelling)";
21865 case 0:
21866 return "ms_struct";
21867 case 1:
21868 return "ms_struct";
21869 case 2:
21870 return "ms_struct";
21871 }
21872 }
21873
21874
21875 // MSVtorDispAttr implementation
21876
21877 MSVtorDispAttr *MSVtorDispAttr::CreateImplicit(ASTContext &Ctx, unsigned Vdm, const AttributeCommonInfo &CommonInfo) {
21878 auto *A = new (Ctx) MSVtorDispAttr(Ctx, CommonInfo, Vdm);
21879 A->setImplicit(true);
21880 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21881 A->setAttributeSpellingListIndex(0);
21882 return A;
21883 }
21884
21885 MSVtorDispAttr *MSVtorDispAttr::Create(ASTContext &Ctx, unsigned Vdm, const AttributeCommonInfo &CommonInfo) {
21886 auto *A = new (Ctx) MSVtorDispAttr(Ctx, CommonInfo, Vdm);
21887 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21888 A->setAttributeSpellingListIndex(0);
21889 return A;
21890 }
21891
21892 MSVtorDispAttr *MSVtorDispAttr::CreateImplicit(ASTContext &Ctx, unsigned Vdm, SourceRange Range) {
21893 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
21894 return CreateImplicit(Ctx, Vdm, I);
21895 }
21896
21897 MSVtorDispAttr *MSVtorDispAttr::Create(ASTContext &Ctx, unsigned Vdm, SourceRange Range) {
21898 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
21899 return Create(Ctx, Vdm, I);
21900 }
21901
21902 MSVtorDispAttr::MSVtorDispAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21903 , unsigned Vdm
21904 )
21905 : InheritableAttr(Ctx, CommonInfo, attr::MSVtorDisp, /*IsLateParsed=*/false, false)
21906 , vdm(Vdm)
21907 {
21908 }
21909
21910
21911
21912 MSVtorDispAttr *MSVtorDispAttr::clone(ASTContext &C) const {
21913 auto *A = new (C) MSVtorDispAttr(C, *this, vdm);
21914 A->Inherited = Inherited;
21915 A->IsPackExpansion = IsPackExpansion;
21916 A->setImplicit(Implicit);
21917 return A;
21918 }
21919
21920 void MSVtorDispAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21921 }
21922
21923 const char *MSVtorDispAttr::getSpelling() const {
21924 return "(No spelling)";
21925 }
21926
21927
21928 // MaxFieldAlignmentAttr implementation
21929
21930 MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::CreateImplicit(ASTContext &Ctx, unsigned Alignment, const AttributeCommonInfo &CommonInfo) {
21931 auto *A = new (Ctx) MaxFieldAlignmentAttr(Ctx, CommonInfo, Alignment);
21932 A->setImplicit(true);
21933 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21934 A->setAttributeSpellingListIndex(0);
21935 return A;
21936 }
21937
21938 MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::Create(ASTContext &Ctx, unsigned Alignment, const AttributeCommonInfo &CommonInfo) {
21939 auto *A = new (Ctx) MaxFieldAlignmentAttr(Ctx, CommonInfo, Alignment);
21940 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21941 A->setAttributeSpellingListIndex(0);
21942 return A;
21943 }
21944
21945 MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::CreateImplicit(ASTContext &Ctx, unsigned Alignment, SourceRange Range) {
21946 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
21947 return CreateImplicit(Ctx, Alignment, I);
21948 }
21949
21950 MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::Create(ASTContext &Ctx, unsigned Alignment, SourceRange Range) {
21951 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
21952 return Create(Ctx, Alignment, I);
21953 }
21954
21955 MaxFieldAlignmentAttr::MaxFieldAlignmentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
21956 , unsigned Alignment
21957 )
21958 : InheritableAttr(Ctx, CommonInfo, attr::MaxFieldAlignment, /*IsLateParsed=*/false, false)
21959 , alignment(Alignment)
21960 {
21961 }
21962
21963
21964
21965 MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::clone(ASTContext &C) const {
21966 auto *A = new (C) MaxFieldAlignmentAttr(C, *this, alignment);
21967 A->Inherited = Inherited;
21968 A->IsPackExpansion = IsPackExpansion;
21969 A->setImplicit(Implicit);
21970 return A;
21971 }
21972
21973 void MaxFieldAlignmentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
21974 }
21975
21976 const char *MaxFieldAlignmentAttr::getSpelling() const {
21977 return "(No spelling)";
21978 }
21979
21980
21981 // MayAliasAttr implementation
21982
21983 MayAliasAttr *MayAliasAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21984 auto *A = new (Ctx) MayAliasAttr(Ctx, CommonInfo);
21985 A->setImplicit(true);
21986 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21987 A->setAttributeSpellingListIndex(0);
21988 return A;
21989 }
21990
21991 MayAliasAttr *MayAliasAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
21992 auto *A = new (Ctx) MayAliasAttr(Ctx, CommonInfo);
21993 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
21994 A->setAttributeSpellingListIndex(0);
21995 return A;
21996 }
21997
21998 MayAliasAttr *MayAliasAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
21999 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22000 switch (S) {
22001 case GNU_may_alias:
22002 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22003 case CXX11_gnu_may_alias:
22004 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22005 case C23_gnu_may_alias:
22006 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22007 default:
22008 llvm_unreachable("Unknown attribute spelling!");
22009 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22010 }
22011 }());
22012 return CreateImplicit(Ctx, I);
22013 }
22014
22015 MayAliasAttr *MayAliasAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
22016 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22017 switch (S) {
22018 case GNU_may_alias:
22019 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22020 case CXX11_gnu_may_alias:
22021 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22022 case C23_gnu_may_alias:
22023 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22024 default:
22025 llvm_unreachable("Unknown attribute spelling!");
22026 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22027 }
22028 }());
22029 return Create(Ctx, I);
22030 }
22031
22032 MayAliasAttr::MayAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
22033 )
22034 : InheritableAttr(Ctx, CommonInfo, attr::MayAlias, /*IsLateParsed=*/false, false)
22035 {
22036 }
22037
22038 MayAliasAttr *MayAliasAttr::clone(ASTContext &C) const {
22039 auto *A = new (C) MayAliasAttr(C, *this);
22040 A->Inherited = Inherited;
22041 A->IsPackExpansion = IsPackExpansion;
22042 A->setImplicit(Implicit);
22043 return A;
22044 }
22045
22046 void MayAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
22047 bool IsFirstArgument = true; (void)IsFirstArgument;
22048 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
22049 switch (getAttributeSpellingListIndex()) {
22050 default:
22051 llvm_unreachable("Unknown attribute spelling!");
22052 break;
22053 case 0 : {
22054 OS << "__attribute__((may_alias";
22055 OS << "))";
22056 break;
22057 }
22058 case 1 : {
22059 OS << "[[gnu::may_alias";
22060 OS << "]]";
22061 break;
22062 }
22063 case 2 : {
22064 OS << "[[gnu::may_alias";
22065 OS << "]]";
22066 break;
22067 }
22068 }
22069 }
22070
22071 const char *MayAliasAttr::getSpelling() const {
22072 switch (getAttributeSpellingListIndex()) {
22073 default:
22074 llvm_unreachable("Unknown attribute spelling!");
22075 return "(No spelling)";
22076 case 0:
22077 return "may_alias";
22078 case 1:
22079 return "may_alias";
22080 case 2:
22081 return "may_alias";
22082 }
22083 }
22084
22085
22086 // MaybeUndefAttr implementation
22087
22088 MaybeUndefAttr *MaybeUndefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22089 auto *A = new (Ctx) MaybeUndefAttr(Ctx, CommonInfo);
22090 A->setImplicit(true);
22091 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22092 A->setAttributeSpellingListIndex(0);
22093 return A;
22094 }
22095
22096 MaybeUndefAttr *MaybeUndefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22097 auto *A = new (Ctx) MaybeUndefAttr(Ctx, CommonInfo);
22098 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22099 A->setAttributeSpellingListIndex(0);
22100 return A;
22101 }
22102
22103 MaybeUndefAttr *MaybeUndefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
22104 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22105 switch (S) {
22106 case GNU_maybe_undef:
22107 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22108 case CXX11_clang_maybe_undef:
22109 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22110 case C23_clang_maybe_undef:
22111 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22112 default:
22113 llvm_unreachable("Unknown attribute spelling!");
22114 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22115 }
22116 }());
22117 return CreateImplicit(Ctx, I);
22118 }
22119
22120 MaybeUndefAttr *MaybeUndefAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
22121 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22122 switch (S) {
22123 case GNU_maybe_undef:
22124 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22125 case CXX11_clang_maybe_undef:
22126 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22127 case C23_clang_maybe_undef:
22128 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22129 default:
22130 llvm_unreachable("Unknown attribute spelling!");
22131 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22132 }
22133 }());
22134 return Create(Ctx, I);
22135 }
22136
22137 MaybeUndefAttr::MaybeUndefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
22138 )
22139 : InheritableAttr(Ctx, CommonInfo, attr::MaybeUndef, /*IsLateParsed=*/false, false)
22140 {
22141 }
22142
22143 MaybeUndefAttr *MaybeUndefAttr::clone(ASTContext &C) const {
22144 auto *A = new (C) MaybeUndefAttr(C, *this);
22145 A->Inherited = Inherited;
22146 A->IsPackExpansion = IsPackExpansion;
22147 A->setImplicit(Implicit);
22148 return A;
22149 }
22150
22151 void MaybeUndefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
22152 bool IsFirstArgument = true; (void)IsFirstArgument;
22153 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
22154 switch (getAttributeSpellingListIndex()) {
22155 default:
22156 llvm_unreachable("Unknown attribute spelling!");
22157 break;
22158 case 0 : {
22159 OS << "__attribute__((maybe_undef";
22160 OS << "))";
22161 break;
22162 }
22163 case 1 : {
22164 OS << "[[clang::maybe_undef";
22165 OS << "]]";
22166 break;
22167 }
22168 case 2 : {
22169 OS << "[[clang::maybe_undef";
22170 OS << "]]";
22171 break;
22172 }
22173 }
22174 }
22175
22176 const char *MaybeUndefAttr::getSpelling() const {
22177 switch (getAttributeSpellingListIndex()) {
22178 default:
22179 llvm_unreachable("Unknown attribute spelling!");
22180 return "(No spelling)";
22181 case 0:
22182 return "maybe_undef";
22183 case 1:
22184 return "maybe_undef";
22185 case 2:
22186 return "maybe_undef";
22187 }
22188 }
22189
22190
22191 // MicroMipsAttr implementation
22192
22193 MicroMipsAttr *MicroMipsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22194 auto *A = new (Ctx) MicroMipsAttr(Ctx, CommonInfo);
22195 A->setImplicit(true);
22196 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22197 A->setAttributeSpellingListIndex(0);
22198 return A;
22199 }
22200
22201 MicroMipsAttr *MicroMipsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22202 auto *A = new (Ctx) MicroMipsAttr(Ctx, CommonInfo);
22203 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22204 A->setAttributeSpellingListIndex(0);
22205 return A;
22206 }
22207
22208 MicroMipsAttr *MicroMipsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
22209 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22210 switch (S) {
22211 case GNU_micromips:
22212 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22213 case CXX11_gnu_micromips:
22214 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22215 case C23_gnu_micromips:
22216 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22217 default:
22218 llvm_unreachable("Unknown attribute spelling!");
22219 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22220 }
22221 }());
22222 return CreateImplicit(Ctx, I);
22223 }
22224
22225 MicroMipsAttr *MicroMipsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
22226 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22227 switch (S) {
22228 case GNU_micromips:
22229 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22230 case CXX11_gnu_micromips:
22231 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22232 case C23_gnu_micromips:
22233 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22234 default:
22235 llvm_unreachable("Unknown attribute spelling!");
22236 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22237 }
22238 }());
22239 return Create(Ctx, I);
22240 }
22241
22242 MicroMipsAttr::MicroMipsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
22243 )
22244 : InheritableAttr(Ctx, CommonInfo, attr::MicroMips, /*IsLateParsed=*/false, false)
22245 {
22246 }
22247
22248 MicroMipsAttr *MicroMipsAttr::clone(ASTContext &C) const {
22249 auto *A = new (C) MicroMipsAttr(C, *this);
22250 A->Inherited = Inherited;
22251 A->IsPackExpansion = IsPackExpansion;
22252 A->setImplicit(Implicit);
22253 return A;
22254 }
22255
22256 void MicroMipsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
22257 bool IsFirstArgument = true; (void)IsFirstArgument;
22258 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
22259 switch (getAttributeSpellingListIndex()) {
22260 default:
22261 llvm_unreachable("Unknown attribute spelling!");
22262 break;
22263 case 0 : {
22264 OS << "__attribute__((micromips";
22265 OS << "))";
22266 break;
22267 }
22268 case 1 : {
22269 OS << "[[gnu::micromips";
22270 OS << "]]";
22271 break;
22272 }
22273 case 2 : {
22274 OS << "[[gnu::micromips";
22275 OS << "]]";
22276 break;
22277 }
22278 }
22279 }
22280
22281 const char *MicroMipsAttr::getSpelling() const {
22282 switch (getAttributeSpellingListIndex()) {
22283 default:
22284 llvm_unreachable("Unknown attribute spelling!");
22285 return "(No spelling)";
22286 case 0:
22287 return "micromips";
22288 case 1:
22289 return "micromips";
22290 case 2:
22291 return "micromips";
22292 }
22293 }
22294
22295
22296 // MinSizeAttr implementation
22297
22298 MinSizeAttr *MinSizeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22299 auto *A = new (Ctx) MinSizeAttr(Ctx, CommonInfo);
22300 A->setImplicit(true);
22301 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22302 A->setAttributeSpellingListIndex(0);
22303 return A;
22304 }
22305
22306 MinSizeAttr *MinSizeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22307 auto *A = new (Ctx) MinSizeAttr(Ctx, CommonInfo);
22308 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22309 A->setAttributeSpellingListIndex(0);
22310 return A;
22311 }
22312
22313 MinSizeAttr *MinSizeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
22314 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22315 switch (S) {
22316 case GNU_minsize:
22317 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22318 case CXX11_clang_minsize:
22319 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22320 case C23_clang_minsize:
22321 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22322 default:
22323 llvm_unreachable("Unknown attribute spelling!");
22324 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22325 }
22326 }());
22327 return CreateImplicit(Ctx, I);
22328 }
22329
22330 MinSizeAttr *MinSizeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
22331 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22332 switch (S) {
22333 case GNU_minsize:
22334 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22335 case CXX11_clang_minsize:
22336 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22337 case C23_clang_minsize:
22338 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22339 default:
22340 llvm_unreachable("Unknown attribute spelling!");
22341 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22342 }
22343 }());
22344 return Create(Ctx, I);
22345 }
22346
22347 MinSizeAttr::MinSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
22348 )
22349 : InheritableAttr(Ctx, CommonInfo, attr::MinSize, /*IsLateParsed=*/false, false)
22350 {
22351 }
22352
22353 MinSizeAttr *MinSizeAttr::clone(ASTContext &C) const {
22354 auto *A = new (C) MinSizeAttr(C, *this);
22355 A->Inherited = Inherited;
22356 A->IsPackExpansion = IsPackExpansion;
22357 A->setImplicit(Implicit);
22358 return A;
22359 }
22360
22361 void MinSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
22362 bool IsFirstArgument = true; (void)IsFirstArgument;
22363 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
22364 switch (getAttributeSpellingListIndex()) {
22365 default:
22366 llvm_unreachable("Unknown attribute spelling!");
22367 break;
22368 case 0 : {
22369 OS << "__attribute__((minsize";
22370 OS << "))";
22371 break;
22372 }
22373 case 1 : {
22374 OS << "[[clang::minsize";
22375 OS << "]]";
22376 break;
22377 }
22378 case 2 : {
22379 OS << "[[clang::minsize";
22380 OS << "]]";
22381 break;
22382 }
22383 }
22384 }
22385
22386 const char *MinSizeAttr::getSpelling() const {
22387 switch (getAttributeSpellingListIndex()) {
22388 default:
22389 llvm_unreachable("Unknown attribute spelling!");
22390 return "(No spelling)";
22391 case 0:
22392 return "minsize";
22393 case 1:
22394 return "minsize";
22395 case 2:
22396 return "minsize";
22397 }
22398 }
22399
22400
22401 // MinVectorWidthAttr implementation
22402
22403 MinVectorWidthAttr *MinVectorWidthAttr::CreateImplicit(ASTContext &Ctx, unsigned VectorWidth, const AttributeCommonInfo &CommonInfo) {
22404 auto *A = new (Ctx) MinVectorWidthAttr(Ctx, CommonInfo, VectorWidth);
22405 A->setImplicit(true);
22406 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22407 A->setAttributeSpellingListIndex(0);
22408 return A;
22409 }
22410
22411 MinVectorWidthAttr *MinVectorWidthAttr::Create(ASTContext &Ctx, unsigned VectorWidth, const AttributeCommonInfo &CommonInfo) {
22412 auto *A = new (Ctx) MinVectorWidthAttr(Ctx, CommonInfo, VectorWidth);
22413 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22414 A->setAttributeSpellingListIndex(0);
22415 return A;
22416 }
22417
22418 MinVectorWidthAttr *MinVectorWidthAttr::CreateImplicit(ASTContext &Ctx, unsigned VectorWidth, SourceRange Range, Spelling S) {
22419 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22420 switch (S) {
22421 case GNU_min_vector_width:
22422 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22423 case CXX11_clang_min_vector_width:
22424 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22425 case C23_clang_min_vector_width:
22426 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22427 default:
22428 llvm_unreachable("Unknown attribute spelling!");
22429 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22430 }
22431 }());
22432 return CreateImplicit(Ctx, VectorWidth, I);
22433 }
22434
22435 MinVectorWidthAttr *MinVectorWidthAttr::Create(ASTContext &Ctx, unsigned VectorWidth, SourceRange Range, Spelling S) {
22436 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22437 switch (S) {
22438 case GNU_min_vector_width:
22439 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22440 case CXX11_clang_min_vector_width:
22441 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22442 case C23_clang_min_vector_width:
22443 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22444 default:
22445 llvm_unreachable("Unknown attribute spelling!");
22446 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22447 }
22448 }());
22449 return Create(Ctx, VectorWidth, I);
22450 }
22451
22452 MinVectorWidthAttr::MinVectorWidthAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
22453 , unsigned VectorWidth
22454 )
22455 : InheritableAttr(Ctx, CommonInfo, attr::MinVectorWidth, /*IsLateParsed=*/false, false)
22456 , vectorWidth(VectorWidth)
22457 {
22458 }
22459
22460
22461
22462 MinVectorWidthAttr *MinVectorWidthAttr::clone(ASTContext &C) const {
22463 auto *A = new (C) MinVectorWidthAttr(C, *this, vectorWidth);
22464 A->Inherited = Inherited;
22465 A->IsPackExpansion = IsPackExpansion;
22466 A->setImplicit(Implicit);
22467 return A;
22468 }
22469
22470 void MinVectorWidthAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
22471 bool IsFirstArgument = true; (void)IsFirstArgument;
22472 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
22473 switch (getAttributeSpellingListIndex()) {
22474 default:
22475 llvm_unreachable("Unknown attribute spelling!");
22476 break;
22477 case 0 : {
22478 OS << "__attribute__((min_vector_width";
22479 DelimitAttributeArgument(OS, IsFirstArgument);
22480 OS << "" << getVectorWidth() << "";
22481 if (!IsFirstArgument)
22482 OS << ")";
22483 OS << "))";
22484 break;
22485 }
22486 case 1 : {
22487 OS << "[[clang::min_vector_width";
22488 DelimitAttributeArgument(OS, IsFirstArgument);
22489 OS << "" << getVectorWidth() << "";
22490 if (!IsFirstArgument)
22491 OS << ")";
22492 OS << "]]";
22493 break;
22494 }
22495 case 2 : {
22496 OS << "[[clang::min_vector_width";
22497 DelimitAttributeArgument(OS, IsFirstArgument);
22498 OS << "" << getVectorWidth() << "";
22499 if (!IsFirstArgument)
22500 OS << ")";
22501 OS << "]]";
22502 break;
22503 }
22504 }
22505 }
22506
22507 const char *MinVectorWidthAttr::getSpelling() const {
22508 switch (getAttributeSpellingListIndex()) {
22509 default:
22510 llvm_unreachable("Unknown attribute spelling!");
22511 return "(No spelling)";
22512 case 0:
22513 return "min_vector_width";
22514 case 1:
22515 return "min_vector_width";
22516 case 2:
22517 return "min_vector_width";
22518 }
22519 }
22520
22521
22522 // Mips16Attr implementation
22523
22524 Mips16Attr *Mips16Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22525 auto *A = new (Ctx) Mips16Attr(Ctx, CommonInfo);
22526 A->setImplicit(true);
22527 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22528 A->setAttributeSpellingListIndex(0);
22529 return A;
22530 }
22531
22532 Mips16Attr *Mips16Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22533 auto *A = new (Ctx) Mips16Attr(Ctx, CommonInfo);
22534 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22535 A->setAttributeSpellingListIndex(0);
22536 return A;
22537 }
22538
22539 Mips16Attr *Mips16Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
22540 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22541 switch (S) {
22542 case GNU_mips16:
22543 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22544 case CXX11_gnu_mips16:
22545 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22546 case C23_gnu_mips16:
22547 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22548 default:
22549 llvm_unreachable("Unknown attribute spelling!");
22550 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22551 }
22552 }());
22553 return CreateImplicit(Ctx, I);
22554 }
22555
22556 Mips16Attr *Mips16Attr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
22557 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22558 switch (S) {
22559 case GNU_mips16:
22560 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22561 case CXX11_gnu_mips16:
22562 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22563 case C23_gnu_mips16:
22564 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22565 default:
22566 llvm_unreachable("Unknown attribute spelling!");
22567 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22568 }
22569 }());
22570 return Create(Ctx, I);
22571 }
22572
22573 Mips16Attr::Mips16Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
22574 )
22575 : InheritableAttr(Ctx, CommonInfo, attr::Mips16, /*IsLateParsed=*/false, false)
22576 {
22577 }
22578
22579 Mips16Attr *Mips16Attr::clone(ASTContext &C) const {
22580 auto *A = new (C) Mips16Attr(C, *this);
22581 A->Inherited = Inherited;
22582 A->IsPackExpansion = IsPackExpansion;
22583 A->setImplicit(Implicit);
22584 return A;
22585 }
22586
22587 void Mips16Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
22588 bool IsFirstArgument = true; (void)IsFirstArgument;
22589 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
22590 switch (getAttributeSpellingListIndex()) {
22591 default:
22592 llvm_unreachable("Unknown attribute spelling!");
22593 break;
22594 case 0 : {
22595 OS << "__attribute__((mips16";
22596 OS << "))";
22597 break;
22598 }
22599 case 1 : {
22600 OS << "[[gnu::mips16";
22601 OS << "]]";
22602 break;
22603 }
22604 case 2 : {
22605 OS << "[[gnu::mips16";
22606 OS << "]]";
22607 break;
22608 }
22609 }
22610 }
22611
22612 const char *Mips16Attr::getSpelling() const {
22613 switch (getAttributeSpellingListIndex()) {
22614 default:
22615 llvm_unreachable("Unknown attribute spelling!");
22616 return "(No spelling)";
22617 case 0:
22618 return "mips16";
22619 case 1:
22620 return "mips16";
22621 case 2:
22622 return "mips16";
22623 }
22624 }
22625
22626
22627 // MipsInterruptAttr implementation
22628
22629 MipsInterruptAttr *MipsInterruptAttr::CreateImplicit(ASTContext &Ctx, MipsInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) {
22630 auto *A = new (Ctx) MipsInterruptAttr(Ctx, CommonInfo, Interrupt);
22631 A->setImplicit(true);
22632 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22633 A->setAttributeSpellingListIndex(0);
22634 return A;
22635 }
22636
22637 MipsInterruptAttr *MipsInterruptAttr::Create(ASTContext &Ctx, MipsInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) {
22638 auto *A = new (Ctx) MipsInterruptAttr(Ctx, CommonInfo, Interrupt);
22639 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22640 A->setAttributeSpellingListIndex(0);
22641 return A;
22642 }
22643
22644 MipsInterruptAttr *MipsInterruptAttr::CreateImplicit(ASTContext &Ctx, MipsInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) {
22645 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22646 switch (S) {
22647 case GNU_interrupt:
22648 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22649 case CXX11_gnu_interrupt:
22650 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22651 case C23_gnu_interrupt:
22652 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22653 default:
22654 llvm_unreachable("Unknown attribute spelling!");
22655 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22656 }
22657 }());
22658 return CreateImplicit(Ctx, Interrupt, I);
22659 }
22660
22661 MipsInterruptAttr *MipsInterruptAttr::Create(ASTContext &Ctx, MipsInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) {
22662 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22663 switch (S) {
22664 case GNU_interrupt:
22665 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22666 case CXX11_gnu_interrupt:
22667 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22668 case C23_gnu_interrupt:
22669 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22670 default:
22671 llvm_unreachable("Unknown attribute spelling!");
22672 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22673 }
22674 }());
22675 return Create(Ctx, Interrupt, I);
22676 }
22677
22678 MipsInterruptAttr::MipsInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
22679 , MipsInterruptAttr::InterruptType Interrupt
22680 )
22681 : InheritableAttr(Ctx, CommonInfo, attr::MipsInterrupt, /*IsLateParsed=*/false, false)
22682 , interrupt(Interrupt)
22683 {
22684 }
22685
22686
22687
22688 bool MipsInterruptAttr::ConvertStrToInterruptType(StringRef Val, MipsInterruptAttr::InterruptType &Out) {
22689 std::optional<MipsInterruptAttr::InterruptType> R = llvm::StringSwitch<std::optional<MipsInterruptAttr::InterruptType>>(Val)
22690 .Case("vector=sw0", MipsInterruptAttr::InterruptType::sw0)
22691 .Case("vector=sw1", MipsInterruptAttr::InterruptType::sw1)
22692 .Case("vector=hw0", MipsInterruptAttr::InterruptType::hw0)
22693 .Case("vector=hw1", MipsInterruptAttr::InterruptType::hw1)
22694 .Case("vector=hw2", MipsInterruptAttr::InterruptType::hw2)
22695 .Case("vector=hw3", MipsInterruptAttr::InterruptType::hw3)
22696 .Case("vector=hw4", MipsInterruptAttr::InterruptType::hw4)
22697 .Case("vector=hw5", MipsInterruptAttr::InterruptType::hw5)
22698 .Case("eic", MipsInterruptAttr::InterruptType::eic)
22699 .Case("", MipsInterruptAttr::InterruptType::eic)
22700 .Default(std::optional<MipsInterruptAttr::InterruptType>());
22701 if (R) {
22702 Out = *R;
22703 return true;
22704 }
22705 return false;
22706 }
22707
22708 const char *MipsInterruptAttr::ConvertInterruptTypeToStr(MipsInterruptAttr::InterruptType Val) {
22709 switch(Val) {
22710 case MipsInterruptAttr::InterruptType::sw0: return "vector=sw0";
22711 case MipsInterruptAttr::InterruptType::sw1: return "vector=sw1";
22712 case MipsInterruptAttr::InterruptType::hw0: return "vector=hw0";
22713 case MipsInterruptAttr::InterruptType::hw1: return "vector=hw1";
22714 case MipsInterruptAttr::InterruptType::hw2: return "vector=hw2";
22715 case MipsInterruptAttr::InterruptType::hw3: return "vector=hw3";
22716 case MipsInterruptAttr::InterruptType::hw4: return "vector=hw4";
22717 case MipsInterruptAttr::InterruptType::hw5: return "vector=hw5";
22718 case MipsInterruptAttr::InterruptType::eic: return "eic";
22719 }
22720 llvm_unreachable("No enumerator with that value");
22721 }
22722 MipsInterruptAttr *MipsInterruptAttr::clone(ASTContext &C) const {
22723 auto *A = new (C) MipsInterruptAttr(C, *this, interrupt);
22724 A->Inherited = Inherited;
22725 A->IsPackExpansion = IsPackExpansion;
22726 A->setImplicit(Implicit);
22727 return A;
22728 }
22729
22730 void MipsInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
22731 bool IsFirstArgument = true; (void)IsFirstArgument;
22732 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
22733 switch (getAttributeSpellingListIndex()) {
22734 default:
22735 llvm_unreachable("Unknown attribute spelling!");
22736 break;
22737 case 0 : {
22738 OS << "__attribute__((interrupt";
22739 DelimitAttributeArgument(OS, IsFirstArgument);
22740 OS << "\"" << MipsInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\"";
22741 if (!IsFirstArgument)
22742 OS << ")";
22743 OS << "))";
22744 break;
22745 }
22746 case 1 : {
22747 OS << "[[gnu::interrupt";
22748 DelimitAttributeArgument(OS, IsFirstArgument);
22749 OS << "\"" << MipsInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\"";
22750 if (!IsFirstArgument)
22751 OS << ")";
22752 OS << "]]";
22753 break;
22754 }
22755 case 2 : {
22756 OS << "[[gnu::interrupt";
22757 DelimitAttributeArgument(OS, IsFirstArgument);
22758 OS << "\"" << MipsInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\"";
22759 if (!IsFirstArgument)
22760 OS << ")";
22761 OS << "]]";
22762 break;
22763 }
22764 }
22765 }
22766
22767 const char *MipsInterruptAttr::getSpelling() const {
22768 switch (getAttributeSpellingListIndex()) {
22769 default:
22770 llvm_unreachable("Unknown attribute spelling!");
22771 return "(No spelling)";
22772 case 0:
22773 return "interrupt";
22774 case 1:
22775 return "interrupt";
22776 case 2:
22777 return "interrupt";
22778 }
22779 }
22780
22781
22782 // MipsLongCallAttr implementation
22783
22784 MipsLongCallAttr *MipsLongCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22785 auto *A = new (Ctx) MipsLongCallAttr(Ctx, CommonInfo);
22786 A->setImplicit(true);
22787 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22788 A->setAttributeSpellingListIndex(0);
22789 return A;
22790 }
22791
22792 MipsLongCallAttr *MipsLongCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22793 auto *A = new (Ctx) MipsLongCallAttr(Ctx, CommonInfo);
22794 return A;
22795 }
22796
22797 MipsLongCallAttr *MipsLongCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
22798 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22799 switch (S) {
22800 case GNU_long_call:
22801 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22802 case CXX11_gnu_long_call:
22803 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22804 case C23_gnu_long_call:
22805 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22806 case GNU_far:
22807 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22808 case CXX11_gnu_far:
22809 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22810 case C23_gnu_far:
22811 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22812 default:
22813 llvm_unreachable("Unknown attribute spelling!");
22814 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22815 }
22816 }());
22817 return CreateImplicit(Ctx, I);
22818 }
22819
22820 MipsLongCallAttr *MipsLongCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
22821 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22822 switch (S) {
22823 case GNU_long_call:
22824 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22825 case CXX11_gnu_long_call:
22826 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22827 case C23_gnu_long_call:
22828 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22829 case GNU_far:
22830 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22831 case CXX11_gnu_far:
22832 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22833 case C23_gnu_far:
22834 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22835 default:
22836 llvm_unreachable("Unknown attribute spelling!");
22837 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22838 }
22839 }());
22840 return Create(Ctx, I);
22841 }
22842
22843 MipsLongCallAttr::MipsLongCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
22844 )
22845 : InheritableAttr(Ctx, CommonInfo, attr::MipsLongCall, /*IsLateParsed=*/false, false)
22846 {
22847 }
22848
22849 MipsLongCallAttr::Spelling MipsLongCallAttr::getSemanticSpelling() const {
22850 switch (getAttributeSpellingListIndex()) {
22851 default: llvm_unreachable("Unknown spelling list index");
22852 case 0: return GNU_long_call;
22853 case 1: return CXX11_gnu_long_call;
22854 case 2: return C23_gnu_long_call;
22855 case 3: return GNU_far;
22856 case 4: return CXX11_gnu_far;
22857 case 5: return C23_gnu_far;
22858 }
22859 }
22860 MipsLongCallAttr *MipsLongCallAttr::clone(ASTContext &C) const {
22861 auto *A = new (C) MipsLongCallAttr(C, *this);
22862 A->Inherited = Inherited;
22863 A->IsPackExpansion = IsPackExpansion;
22864 A->setImplicit(Implicit);
22865 return A;
22866 }
22867
22868 void MipsLongCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
22869 bool IsFirstArgument = true; (void)IsFirstArgument;
22870 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
22871 switch (getAttributeSpellingListIndex()) {
22872 default:
22873 llvm_unreachable("Unknown attribute spelling!");
22874 break;
22875 case 0 : {
22876 OS << "__attribute__((long_call";
22877 OS << "))";
22878 break;
22879 }
22880 case 1 : {
22881 OS << "[[gnu::long_call";
22882 OS << "]]";
22883 break;
22884 }
22885 case 2 : {
22886 OS << "[[gnu::long_call";
22887 OS << "]]";
22888 break;
22889 }
22890 case 3 : {
22891 OS << "__attribute__((far";
22892 OS << "))";
22893 break;
22894 }
22895 case 4 : {
22896 OS << "[[gnu::far";
22897 OS << "]]";
22898 break;
22899 }
22900 case 5 : {
22901 OS << "[[gnu::far";
22902 OS << "]]";
22903 break;
22904 }
22905 }
22906 }
22907
22908 const char *MipsLongCallAttr::getSpelling() const {
22909 switch (getAttributeSpellingListIndex()) {
22910 default:
22911 llvm_unreachable("Unknown attribute spelling!");
22912 return "(No spelling)";
22913 case 0:
22914 return "long_call";
22915 case 1:
22916 return "long_call";
22917 case 2:
22918 return "long_call";
22919 case 3:
22920 return "far";
22921 case 4:
22922 return "far";
22923 case 5:
22924 return "far";
22925 }
22926 }
22927
22928
22929 // MipsShortCallAttr implementation
22930
22931 MipsShortCallAttr *MipsShortCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22932 auto *A = new (Ctx) MipsShortCallAttr(Ctx, CommonInfo);
22933 A->setImplicit(true);
22934 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
22935 A->setAttributeSpellingListIndex(0);
22936 return A;
22937 }
22938
22939 MipsShortCallAttr *MipsShortCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
22940 auto *A = new (Ctx) MipsShortCallAttr(Ctx, CommonInfo);
22941 return A;
22942 }
22943
22944 MipsShortCallAttr *MipsShortCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
22945 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22946 switch (S) {
22947 case GNU_short_call:
22948 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22949 case CXX11_gnu_short_call:
22950 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22951 case C23_gnu_short_call:
22952 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22953 case GNU_near:
22954 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22955 case CXX11_gnu_near:
22956 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22957 case C23_gnu_near:
22958 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22959 default:
22960 llvm_unreachable("Unknown attribute spelling!");
22961 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22962 }
22963 }());
22964 return CreateImplicit(Ctx, I);
22965 }
22966
22967 MipsShortCallAttr *MipsShortCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
22968 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
22969 switch (S) {
22970 case GNU_short_call:
22971 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22972 case CXX11_gnu_short_call:
22973 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22974 case C23_gnu_short_call:
22975 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22976 case GNU_near:
22977 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22978 case CXX11_gnu_near:
22979 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22980 case C23_gnu_near:
22981 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22982 default:
22983 llvm_unreachable("Unknown attribute spelling!");
22984 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
22985 }
22986 }());
22987 return Create(Ctx, I);
22988 }
22989
22990 MipsShortCallAttr::MipsShortCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
22991 )
22992 : InheritableAttr(Ctx, CommonInfo, attr::MipsShortCall, /*IsLateParsed=*/false, false)
22993 {
22994 }
22995
22996 MipsShortCallAttr::Spelling MipsShortCallAttr::getSemanticSpelling() const {
22997 switch (getAttributeSpellingListIndex()) {
22998 default: llvm_unreachable("Unknown spelling list index");
22999 case 0: return GNU_short_call;
23000 case 1: return CXX11_gnu_short_call;
23001 case 2: return C23_gnu_short_call;
23002 case 3: return GNU_near;
23003 case 4: return CXX11_gnu_near;
23004 case 5: return C23_gnu_near;
23005 }
23006 }
23007 MipsShortCallAttr *MipsShortCallAttr::clone(ASTContext &C) const {
23008 auto *A = new (C) MipsShortCallAttr(C, *this);
23009 A->Inherited = Inherited;
23010 A->IsPackExpansion = IsPackExpansion;
23011 A->setImplicit(Implicit);
23012 return A;
23013 }
23014
23015 void MipsShortCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23016 bool IsFirstArgument = true; (void)IsFirstArgument;
23017 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23018 switch (getAttributeSpellingListIndex()) {
23019 default:
23020 llvm_unreachable("Unknown attribute spelling!");
23021 break;
23022 case 0 : {
23023 OS << "__attribute__((short_call";
23024 OS << "))";
23025 break;
23026 }
23027 case 1 : {
23028 OS << "[[gnu::short_call";
23029 OS << "]]";
23030 break;
23031 }
23032 case 2 : {
23033 OS << "[[gnu::short_call";
23034 OS << "]]";
23035 break;
23036 }
23037 case 3 : {
23038 OS << "__attribute__((near";
23039 OS << "))";
23040 break;
23041 }
23042 case 4 : {
23043 OS << "[[gnu::near";
23044 OS << "]]";
23045 break;
23046 }
23047 case 5 : {
23048 OS << "[[gnu::near";
23049 OS << "]]";
23050 break;
23051 }
23052 }
23053 }
23054
23055 const char *MipsShortCallAttr::getSpelling() const {
23056 switch (getAttributeSpellingListIndex()) {
23057 default:
23058 llvm_unreachable("Unknown attribute spelling!");
23059 return "(No spelling)";
23060 case 0:
23061 return "short_call";
23062 case 1:
23063 return "short_call";
23064 case 2:
23065 return "short_call";
23066 case 3:
23067 return "near";
23068 case 4:
23069 return "near";
23070 case 5:
23071 return "near";
23072 }
23073 }
23074
23075
23076 // ModeAttr implementation
23077
23078 ModeAttr *ModeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Mode, const AttributeCommonInfo &CommonInfo) {
23079 auto *A = new (Ctx) ModeAttr(Ctx, CommonInfo, Mode);
23080 A->setImplicit(true);
23081 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23082 A->setAttributeSpellingListIndex(0);
23083 return A;
23084 }
23085
23086 ModeAttr *ModeAttr::Create(ASTContext &Ctx, IdentifierInfo * Mode, const AttributeCommonInfo &CommonInfo) {
23087 auto *A = new (Ctx) ModeAttr(Ctx, CommonInfo, Mode);
23088 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23089 A->setAttributeSpellingListIndex(0);
23090 return A;
23091 }
23092
23093 ModeAttr *ModeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Mode, SourceRange Range, Spelling S) {
23094 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23095 switch (S) {
23096 case GNU_mode:
23097 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23098 case CXX11_gnu_mode:
23099 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23100 case C23_gnu_mode:
23101 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23102 default:
23103 llvm_unreachable("Unknown attribute spelling!");
23104 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23105 }
23106 }());
23107 return CreateImplicit(Ctx, Mode, I);
23108 }
23109
23110 ModeAttr *ModeAttr::Create(ASTContext &Ctx, IdentifierInfo * Mode, SourceRange Range, Spelling S) {
23111 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23112 switch (S) {
23113 case GNU_mode:
23114 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23115 case CXX11_gnu_mode:
23116 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23117 case C23_gnu_mode:
23118 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23119 default:
23120 llvm_unreachable("Unknown attribute spelling!");
23121 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23122 }
23123 }());
23124 return Create(Ctx, Mode, I);
23125 }
23126
23127 ModeAttr::ModeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
23128 , IdentifierInfo * Mode
23129 )
23130 : Attr(Ctx, CommonInfo, attr::Mode, /*IsLateParsed=*/false)
23131 , mode(Mode)
23132 {
23133 }
23134
23135
23136
23137 ModeAttr *ModeAttr::clone(ASTContext &C) const {
23138 auto *A = new (C) ModeAttr(C, *this, mode);
23139 A->Inherited = Inherited;
23140 A->IsPackExpansion = IsPackExpansion;
23141 A->setImplicit(Implicit);
23142 return A;
23143 }
23144
23145 void ModeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23146 bool IsFirstArgument = true; (void)IsFirstArgument;
23147 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23148 switch (getAttributeSpellingListIndex()) {
23149 default:
23150 llvm_unreachable("Unknown attribute spelling!");
23151 break;
23152 case 0 : {
23153 OS << "__attribute__((mode";
23154 DelimitAttributeArgument(OS, IsFirstArgument);
23155 OS << "" << (getMode() ? getMode()->getName() : "") << "";
23156 if (!IsFirstArgument)
23157 OS << ")";
23158 OS << "))";
23159 break;
23160 }
23161 case 1 : {
23162 OS << "[[gnu::mode";
23163 DelimitAttributeArgument(OS, IsFirstArgument);
23164 OS << "" << (getMode() ? getMode()->getName() : "") << "";
23165 if (!IsFirstArgument)
23166 OS << ")";
23167 OS << "]]";
23168 break;
23169 }
23170 case 2 : {
23171 OS << "[[gnu::mode";
23172 DelimitAttributeArgument(OS, IsFirstArgument);
23173 OS << "" << (getMode() ? getMode()->getName() : "") << "";
23174 if (!IsFirstArgument)
23175 OS << ")";
23176 OS << "]]";
23177 break;
23178 }
23179 }
23180 }
23181
23182 const char *ModeAttr::getSpelling() const {
23183 switch (getAttributeSpellingListIndex()) {
23184 default:
23185 llvm_unreachable("Unknown attribute spelling!");
23186 return "(No spelling)";
23187 case 0:
23188 return "mode";
23189 case 1:
23190 return "mode";
23191 case 2:
23192 return "mode";
23193 }
23194 }
23195
23196
23197 // MustTailAttr implementation
23198
23199 MustTailAttr *MustTailAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23200 auto *A = new (Ctx) MustTailAttr(Ctx, CommonInfo);
23201 A->setImplicit(true);
23202 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23203 A->setAttributeSpellingListIndex(0);
23204 return A;
23205 }
23206
23207 MustTailAttr *MustTailAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23208 auto *A = new (Ctx) MustTailAttr(Ctx, CommonInfo);
23209 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23210 A->setAttributeSpellingListIndex(0);
23211 return A;
23212 }
23213
23214 MustTailAttr *MustTailAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
23215 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23216 switch (S) {
23217 case GNU_musttail:
23218 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23219 case CXX11_clang_musttail:
23220 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23221 case C23_clang_musttail:
23222 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23223 default:
23224 llvm_unreachable("Unknown attribute spelling!");
23225 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23226 }
23227 }());
23228 return CreateImplicit(Ctx, I);
23229 }
23230
23231 MustTailAttr *MustTailAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
23232 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23233 switch (S) {
23234 case GNU_musttail:
23235 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23236 case CXX11_clang_musttail:
23237 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23238 case C23_clang_musttail:
23239 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23240 default:
23241 llvm_unreachable("Unknown attribute spelling!");
23242 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23243 }
23244 }());
23245 return Create(Ctx, I);
23246 }
23247
23248 MustTailAttr::MustTailAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
23249 )
23250 : StmtAttr(Ctx, CommonInfo, attr::MustTail, /*IsLateParsed=*/false)
23251 {
23252 }
23253
23254 MustTailAttr *MustTailAttr::clone(ASTContext &C) const {
23255 auto *A = new (C) MustTailAttr(C, *this);
23256 A->Inherited = Inherited;
23257 A->IsPackExpansion = IsPackExpansion;
23258 A->setImplicit(Implicit);
23259 return A;
23260 }
23261
23262 void MustTailAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23263 bool IsFirstArgument = true; (void)IsFirstArgument;
23264 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23265 switch (getAttributeSpellingListIndex()) {
23266 default:
23267 llvm_unreachable("Unknown attribute spelling!");
23268 break;
23269 case 0 : {
23270 OS << "__attribute__((musttail";
23271 OS << "))";
23272 break;
23273 }
23274 case 1 : {
23275 OS << "[[clang::musttail";
23276 OS << "]]";
23277 break;
23278 }
23279 case 2 : {
23280 OS << "[[clang::musttail";
23281 OS << "]]";
23282 break;
23283 }
23284 }
23285 }
23286
23287 const char *MustTailAttr::getSpelling() const {
23288 switch (getAttributeSpellingListIndex()) {
23289 default:
23290 llvm_unreachable("Unknown attribute spelling!");
23291 return "(No spelling)";
23292 case 0:
23293 return "musttail";
23294 case 1:
23295 return "musttail";
23296 case 2:
23297 return "musttail";
23298 }
23299 }
23300
23301
23302 // NSConsumedAttr implementation
23303
23304 NSConsumedAttr *NSConsumedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23305 auto *A = new (Ctx) NSConsumedAttr(Ctx, CommonInfo);
23306 A->setImplicit(true);
23307 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23308 A->setAttributeSpellingListIndex(0);
23309 return A;
23310 }
23311
23312 NSConsumedAttr *NSConsumedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23313 auto *A = new (Ctx) NSConsumedAttr(Ctx, CommonInfo);
23314 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23315 A->setAttributeSpellingListIndex(0);
23316 return A;
23317 }
23318
23319 NSConsumedAttr *NSConsumedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
23320 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23321 switch (S) {
23322 case GNU_ns_consumed:
23323 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23324 case CXX11_clang_ns_consumed:
23325 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23326 case C23_clang_ns_consumed:
23327 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23328 default:
23329 llvm_unreachable("Unknown attribute spelling!");
23330 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23331 }
23332 }());
23333 return CreateImplicit(Ctx, I);
23334 }
23335
23336 NSConsumedAttr *NSConsumedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
23337 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23338 switch (S) {
23339 case GNU_ns_consumed:
23340 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23341 case CXX11_clang_ns_consumed:
23342 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23343 case C23_clang_ns_consumed:
23344 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23345 default:
23346 llvm_unreachable("Unknown attribute spelling!");
23347 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23348 }
23349 }());
23350 return Create(Ctx, I);
23351 }
23352
23353 NSConsumedAttr::NSConsumedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
23354 )
23355 : InheritableParamAttr(Ctx, CommonInfo, attr::NSConsumed, /*IsLateParsed=*/false, false)
23356 {
23357 }
23358
23359 NSConsumedAttr *NSConsumedAttr::clone(ASTContext &C) const {
23360 auto *A = new (C) NSConsumedAttr(C, *this);
23361 A->Inherited = Inherited;
23362 A->IsPackExpansion = IsPackExpansion;
23363 A->setImplicit(Implicit);
23364 return A;
23365 }
23366
23367 void NSConsumedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23368 bool IsFirstArgument = true; (void)IsFirstArgument;
23369 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23370 switch (getAttributeSpellingListIndex()) {
23371 default:
23372 llvm_unreachable("Unknown attribute spelling!");
23373 break;
23374 case 0 : {
23375 OS << "__attribute__((ns_consumed";
23376 OS << "))";
23377 break;
23378 }
23379 case 1 : {
23380 OS << "[[clang::ns_consumed";
23381 OS << "]]";
23382 break;
23383 }
23384 case 2 : {
23385 OS << "[[clang::ns_consumed";
23386 OS << "]]";
23387 break;
23388 }
23389 }
23390 }
23391
23392 const char *NSConsumedAttr::getSpelling() const {
23393 switch (getAttributeSpellingListIndex()) {
23394 default:
23395 llvm_unreachable("Unknown attribute spelling!");
23396 return "(No spelling)";
23397 case 0:
23398 return "ns_consumed";
23399 case 1:
23400 return "ns_consumed";
23401 case 2:
23402 return "ns_consumed";
23403 }
23404 }
23405
23406
23407 // NSConsumesSelfAttr implementation
23408
23409 NSConsumesSelfAttr *NSConsumesSelfAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23410 auto *A = new (Ctx) NSConsumesSelfAttr(Ctx, CommonInfo);
23411 A->setImplicit(true);
23412 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23413 A->setAttributeSpellingListIndex(0);
23414 return A;
23415 }
23416
23417 NSConsumesSelfAttr *NSConsumesSelfAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23418 auto *A = new (Ctx) NSConsumesSelfAttr(Ctx, CommonInfo);
23419 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23420 A->setAttributeSpellingListIndex(0);
23421 return A;
23422 }
23423
23424 NSConsumesSelfAttr *NSConsumesSelfAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
23425 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23426 switch (S) {
23427 case GNU_ns_consumes_self:
23428 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23429 case CXX11_clang_ns_consumes_self:
23430 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23431 case C23_clang_ns_consumes_self:
23432 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23433 default:
23434 llvm_unreachable("Unknown attribute spelling!");
23435 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23436 }
23437 }());
23438 return CreateImplicit(Ctx, I);
23439 }
23440
23441 NSConsumesSelfAttr *NSConsumesSelfAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
23442 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23443 switch (S) {
23444 case GNU_ns_consumes_self:
23445 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23446 case CXX11_clang_ns_consumes_self:
23447 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23448 case C23_clang_ns_consumes_self:
23449 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23450 default:
23451 llvm_unreachable("Unknown attribute spelling!");
23452 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23453 }
23454 }());
23455 return Create(Ctx, I);
23456 }
23457
23458 NSConsumesSelfAttr::NSConsumesSelfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
23459 )
23460 : InheritableAttr(Ctx, CommonInfo, attr::NSConsumesSelf, /*IsLateParsed=*/false, false)
23461 {
23462 }
23463
23464 NSConsumesSelfAttr *NSConsumesSelfAttr::clone(ASTContext &C) const {
23465 auto *A = new (C) NSConsumesSelfAttr(C, *this);
23466 A->Inherited = Inherited;
23467 A->IsPackExpansion = IsPackExpansion;
23468 A->setImplicit(Implicit);
23469 return A;
23470 }
23471
23472 void NSConsumesSelfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23473 bool IsFirstArgument = true; (void)IsFirstArgument;
23474 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23475 switch (getAttributeSpellingListIndex()) {
23476 default:
23477 llvm_unreachable("Unknown attribute spelling!");
23478 break;
23479 case 0 : {
23480 OS << "__attribute__((ns_consumes_self";
23481 OS << "))";
23482 break;
23483 }
23484 case 1 : {
23485 OS << "[[clang::ns_consumes_self";
23486 OS << "]]";
23487 break;
23488 }
23489 case 2 : {
23490 OS << "[[clang::ns_consumes_self";
23491 OS << "]]";
23492 break;
23493 }
23494 }
23495 }
23496
23497 const char *NSConsumesSelfAttr::getSpelling() const {
23498 switch (getAttributeSpellingListIndex()) {
23499 default:
23500 llvm_unreachable("Unknown attribute spelling!");
23501 return "(No spelling)";
23502 case 0:
23503 return "ns_consumes_self";
23504 case 1:
23505 return "ns_consumes_self";
23506 case 2:
23507 return "ns_consumes_self";
23508 }
23509 }
23510
23511
23512 // NSErrorDomainAttr implementation
23513
23514 NSErrorDomainAttr *NSErrorDomainAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ErrorDomain, const AttributeCommonInfo &CommonInfo) {
23515 auto *A = new (Ctx) NSErrorDomainAttr(Ctx, CommonInfo, ErrorDomain);
23516 A->setImplicit(true);
23517 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23518 A->setAttributeSpellingListIndex(0);
23519 return A;
23520 }
23521
23522 NSErrorDomainAttr *NSErrorDomainAttr::Create(ASTContext &Ctx, IdentifierInfo * ErrorDomain, const AttributeCommonInfo &CommonInfo) {
23523 auto *A = new (Ctx) NSErrorDomainAttr(Ctx, CommonInfo, ErrorDomain);
23524 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23525 A->setAttributeSpellingListIndex(0);
23526 return A;
23527 }
23528
23529 NSErrorDomainAttr *NSErrorDomainAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ErrorDomain, SourceRange Range) {
23530 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
23531 return CreateImplicit(Ctx, ErrorDomain, I);
23532 }
23533
23534 NSErrorDomainAttr *NSErrorDomainAttr::Create(ASTContext &Ctx, IdentifierInfo * ErrorDomain, SourceRange Range) {
23535 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
23536 return Create(Ctx, ErrorDomain, I);
23537 }
23538
23539 NSErrorDomainAttr::NSErrorDomainAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
23540 , IdentifierInfo * ErrorDomain
23541 )
23542 : InheritableAttr(Ctx, CommonInfo, attr::NSErrorDomain, /*IsLateParsed=*/false, false)
23543 , errorDomain(ErrorDomain)
23544 {
23545 }
23546
23547
23548
23549 NSErrorDomainAttr *NSErrorDomainAttr::clone(ASTContext &C) const {
23550 auto *A = new (C) NSErrorDomainAttr(C, *this, errorDomain);
23551 A->Inherited = Inherited;
23552 A->IsPackExpansion = IsPackExpansion;
23553 A->setImplicit(Implicit);
23554 return A;
23555 }
23556
23557 void NSErrorDomainAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23558 bool IsFirstArgument = true; (void)IsFirstArgument;
23559 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23560 switch (getAttributeSpellingListIndex()) {
23561 default:
23562 llvm_unreachable("Unknown attribute spelling!");
23563 break;
23564 case 0 : {
23565 OS << "__attribute__((ns_error_domain";
23566 DelimitAttributeArgument(OS, IsFirstArgument);
23567 OS << "" << (getErrorDomain() ? getErrorDomain()->getName() : "") << "";
23568 if (!IsFirstArgument)
23569 OS << ")";
23570 OS << "))";
23571 break;
23572 }
23573 }
23574 }
23575
23576 const char *NSErrorDomainAttr::getSpelling() const {
23577 switch (getAttributeSpellingListIndex()) {
23578 default:
23579 llvm_unreachable("Unknown attribute spelling!");
23580 return "(No spelling)";
23581 case 0:
23582 return "ns_error_domain";
23583 }
23584 }
23585
23586
23587 // NSReturnsAutoreleasedAttr implementation
23588
23589 NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23590 auto *A = new (Ctx) NSReturnsAutoreleasedAttr(Ctx, CommonInfo);
23591 A->setImplicit(true);
23592 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23593 A->setAttributeSpellingListIndex(0);
23594 return A;
23595 }
23596
23597 NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23598 auto *A = new (Ctx) NSReturnsAutoreleasedAttr(Ctx, CommonInfo);
23599 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23600 A->setAttributeSpellingListIndex(0);
23601 return A;
23602 }
23603
23604 NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
23605 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23606 switch (S) {
23607 case GNU_ns_returns_autoreleased:
23608 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23609 case CXX11_clang_ns_returns_autoreleased:
23610 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23611 case C23_clang_ns_returns_autoreleased:
23612 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23613 default:
23614 llvm_unreachable("Unknown attribute spelling!");
23615 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23616 }
23617 }());
23618 return CreateImplicit(Ctx, I);
23619 }
23620
23621 NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
23622 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23623 switch (S) {
23624 case GNU_ns_returns_autoreleased:
23625 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23626 case CXX11_clang_ns_returns_autoreleased:
23627 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23628 case C23_clang_ns_returns_autoreleased:
23629 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23630 default:
23631 llvm_unreachable("Unknown attribute spelling!");
23632 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23633 }
23634 }());
23635 return Create(Ctx, I);
23636 }
23637
23638 NSReturnsAutoreleasedAttr::NSReturnsAutoreleasedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
23639 )
23640 : InheritableAttr(Ctx, CommonInfo, attr::NSReturnsAutoreleased, /*IsLateParsed=*/false, false)
23641 {
23642 }
23643
23644 NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::clone(ASTContext &C) const {
23645 auto *A = new (C) NSReturnsAutoreleasedAttr(C, *this);
23646 A->Inherited = Inherited;
23647 A->IsPackExpansion = IsPackExpansion;
23648 A->setImplicit(Implicit);
23649 return A;
23650 }
23651
23652 void NSReturnsAutoreleasedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23653 bool IsFirstArgument = true; (void)IsFirstArgument;
23654 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23655 switch (getAttributeSpellingListIndex()) {
23656 default:
23657 llvm_unreachable("Unknown attribute spelling!");
23658 break;
23659 case 0 : {
23660 OS << "__attribute__((ns_returns_autoreleased";
23661 OS << "))";
23662 break;
23663 }
23664 case 1 : {
23665 OS << "[[clang::ns_returns_autoreleased";
23666 OS << "]]";
23667 break;
23668 }
23669 case 2 : {
23670 OS << "[[clang::ns_returns_autoreleased";
23671 OS << "]]";
23672 break;
23673 }
23674 }
23675 }
23676
23677 const char *NSReturnsAutoreleasedAttr::getSpelling() const {
23678 switch (getAttributeSpellingListIndex()) {
23679 default:
23680 llvm_unreachable("Unknown attribute spelling!");
23681 return "(No spelling)";
23682 case 0:
23683 return "ns_returns_autoreleased";
23684 case 1:
23685 return "ns_returns_autoreleased";
23686 case 2:
23687 return "ns_returns_autoreleased";
23688 }
23689 }
23690
23691
23692 // NSReturnsNotRetainedAttr implementation
23693
23694 NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23695 auto *A = new (Ctx) NSReturnsNotRetainedAttr(Ctx, CommonInfo);
23696 A->setImplicit(true);
23697 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23698 A->setAttributeSpellingListIndex(0);
23699 return A;
23700 }
23701
23702 NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23703 auto *A = new (Ctx) NSReturnsNotRetainedAttr(Ctx, CommonInfo);
23704 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23705 A->setAttributeSpellingListIndex(0);
23706 return A;
23707 }
23708
23709 NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
23710 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23711 switch (S) {
23712 case GNU_ns_returns_not_retained:
23713 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23714 case CXX11_clang_ns_returns_not_retained:
23715 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23716 case C23_clang_ns_returns_not_retained:
23717 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23718 default:
23719 llvm_unreachable("Unknown attribute spelling!");
23720 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23721 }
23722 }());
23723 return CreateImplicit(Ctx, I);
23724 }
23725
23726 NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
23727 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23728 switch (S) {
23729 case GNU_ns_returns_not_retained:
23730 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23731 case CXX11_clang_ns_returns_not_retained:
23732 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23733 case C23_clang_ns_returns_not_retained:
23734 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23735 default:
23736 llvm_unreachable("Unknown attribute spelling!");
23737 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23738 }
23739 }());
23740 return Create(Ctx, I);
23741 }
23742
23743 NSReturnsNotRetainedAttr::NSReturnsNotRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
23744 )
23745 : InheritableAttr(Ctx, CommonInfo, attr::NSReturnsNotRetained, /*IsLateParsed=*/false, false)
23746 {
23747 }
23748
23749 NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::clone(ASTContext &C) const {
23750 auto *A = new (C) NSReturnsNotRetainedAttr(C, *this);
23751 A->Inherited = Inherited;
23752 A->IsPackExpansion = IsPackExpansion;
23753 A->setImplicit(Implicit);
23754 return A;
23755 }
23756
23757 void NSReturnsNotRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23758 bool IsFirstArgument = true; (void)IsFirstArgument;
23759 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23760 switch (getAttributeSpellingListIndex()) {
23761 default:
23762 llvm_unreachable("Unknown attribute spelling!");
23763 break;
23764 case 0 : {
23765 OS << "__attribute__((ns_returns_not_retained";
23766 OS << "))";
23767 break;
23768 }
23769 case 1 : {
23770 OS << "[[clang::ns_returns_not_retained";
23771 OS << "]]";
23772 break;
23773 }
23774 case 2 : {
23775 OS << "[[clang::ns_returns_not_retained";
23776 OS << "]]";
23777 break;
23778 }
23779 }
23780 }
23781
23782 const char *NSReturnsNotRetainedAttr::getSpelling() const {
23783 switch (getAttributeSpellingListIndex()) {
23784 default:
23785 llvm_unreachable("Unknown attribute spelling!");
23786 return "(No spelling)";
23787 case 0:
23788 return "ns_returns_not_retained";
23789 case 1:
23790 return "ns_returns_not_retained";
23791 case 2:
23792 return "ns_returns_not_retained";
23793 }
23794 }
23795
23796
23797 // NSReturnsRetainedAttr implementation
23798
23799 NSReturnsRetainedAttr *NSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23800 auto *A = new (Ctx) NSReturnsRetainedAttr(Ctx, CommonInfo);
23801 A->setImplicit(true);
23802 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23803 A->setAttributeSpellingListIndex(0);
23804 return A;
23805 }
23806
23807 NSReturnsRetainedAttr *NSReturnsRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23808 auto *A = new (Ctx) NSReturnsRetainedAttr(Ctx, CommonInfo);
23809 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23810 A->setAttributeSpellingListIndex(0);
23811 return A;
23812 }
23813
23814 NSReturnsRetainedAttr *NSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
23815 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23816 switch (S) {
23817 case GNU_ns_returns_retained:
23818 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23819 case CXX11_clang_ns_returns_retained:
23820 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23821 case C23_clang_ns_returns_retained:
23822 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23823 default:
23824 llvm_unreachable("Unknown attribute spelling!");
23825 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23826 }
23827 }());
23828 return CreateImplicit(Ctx, I);
23829 }
23830
23831 NSReturnsRetainedAttr *NSReturnsRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
23832 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23833 switch (S) {
23834 case GNU_ns_returns_retained:
23835 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23836 case CXX11_clang_ns_returns_retained:
23837 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23838 case C23_clang_ns_returns_retained:
23839 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23840 default:
23841 llvm_unreachable("Unknown attribute spelling!");
23842 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23843 }
23844 }());
23845 return Create(Ctx, I);
23846 }
23847
23848 NSReturnsRetainedAttr::NSReturnsRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
23849 )
23850 : InheritableAttr(Ctx, CommonInfo, attr::NSReturnsRetained, /*IsLateParsed=*/false, false)
23851 {
23852 }
23853
23854 NSReturnsRetainedAttr *NSReturnsRetainedAttr::clone(ASTContext &C) const {
23855 auto *A = new (C) NSReturnsRetainedAttr(C, *this);
23856 A->Inherited = Inherited;
23857 A->IsPackExpansion = IsPackExpansion;
23858 A->setImplicit(Implicit);
23859 return A;
23860 }
23861
23862 void NSReturnsRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23863 bool IsFirstArgument = true; (void)IsFirstArgument;
23864 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23865 switch (getAttributeSpellingListIndex()) {
23866 default:
23867 llvm_unreachable("Unknown attribute spelling!");
23868 break;
23869 case 0 : {
23870 OS << "__attribute__((ns_returns_retained";
23871 OS << "))";
23872 break;
23873 }
23874 case 1 : {
23875 OS << "[[clang::ns_returns_retained";
23876 OS << "]]";
23877 break;
23878 }
23879 case 2 : {
23880 OS << "[[clang::ns_returns_retained";
23881 OS << "]]";
23882 break;
23883 }
23884 }
23885 }
23886
23887 const char *NSReturnsRetainedAttr::getSpelling() const {
23888 switch (getAttributeSpellingListIndex()) {
23889 default:
23890 llvm_unreachable("Unknown attribute spelling!");
23891 return "(No spelling)";
23892 case 0:
23893 return "ns_returns_retained";
23894 case 1:
23895 return "ns_returns_retained";
23896 case 2:
23897 return "ns_returns_retained";
23898 }
23899 }
23900
23901
23902 // NVPTXKernelAttr implementation
23903
23904 NVPTXKernelAttr *NVPTXKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23905 auto *A = new (Ctx) NVPTXKernelAttr(Ctx, CommonInfo);
23906 A->setImplicit(true);
23907 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23908 A->setAttributeSpellingListIndex(0);
23909 return A;
23910 }
23911
23912 NVPTXKernelAttr *NVPTXKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
23913 auto *A = new (Ctx) NVPTXKernelAttr(Ctx, CommonInfo);
23914 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
23915 A->setAttributeSpellingListIndex(0);
23916 return A;
23917 }
23918
23919 NVPTXKernelAttr *NVPTXKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
23920 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23921 switch (S) {
23922 case GNU_nvptx_kernel:
23923 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23924 case CXX11_clang_nvptx_kernel:
23925 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23926 case C23_clang_nvptx_kernel:
23927 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23928 default:
23929 llvm_unreachable("Unknown attribute spelling!");
23930 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23931 }
23932 }());
23933 return CreateImplicit(Ctx, I);
23934 }
23935
23936 NVPTXKernelAttr *NVPTXKernelAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
23937 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
23938 switch (S) {
23939 case GNU_nvptx_kernel:
23940 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23941 case CXX11_clang_nvptx_kernel:
23942 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23943 case C23_clang_nvptx_kernel:
23944 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23945 default:
23946 llvm_unreachable("Unknown attribute spelling!");
23947 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
23948 }
23949 }());
23950 return Create(Ctx, I);
23951 }
23952
23953 NVPTXKernelAttr::NVPTXKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
23954 )
23955 : InheritableAttr(Ctx, CommonInfo, attr::NVPTXKernel, /*IsLateParsed=*/false, false)
23956 {
23957 }
23958
23959 NVPTXKernelAttr *NVPTXKernelAttr::clone(ASTContext &C) const {
23960 auto *A = new (C) NVPTXKernelAttr(C, *this);
23961 A->Inherited = Inherited;
23962 A->IsPackExpansion = IsPackExpansion;
23963 A->setImplicit(Implicit);
23964 return A;
23965 }
23966
23967 void NVPTXKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
23968 bool IsFirstArgument = true; (void)IsFirstArgument;
23969 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
23970 switch (getAttributeSpellingListIndex()) {
23971 default:
23972 llvm_unreachable("Unknown attribute spelling!");
23973 break;
23974 case 0 : {
23975 OS << "__attribute__((nvptx_kernel";
23976 OS << "))";
23977 break;
23978 }
23979 case 1 : {
23980 OS << "[[clang::nvptx_kernel";
23981 OS << "]]";
23982 break;
23983 }
23984 case 2 : {
23985 OS << "[[clang::nvptx_kernel";
23986 OS << "]]";
23987 break;
23988 }
23989 }
23990 }
23991
23992 const char *NVPTXKernelAttr::getSpelling() const {
23993 switch (getAttributeSpellingListIndex()) {
23994 default:
23995 llvm_unreachable("Unknown attribute spelling!");
23996 return "(No spelling)";
23997 case 0:
23998 return "nvptx_kernel";
23999 case 1:
24000 return "nvptx_kernel";
24001 case 2:
24002 return "nvptx_kernel";
24003 }
24004 }
24005
24006
24007 // NakedAttr implementation
24008
24009 NakedAttr *NakedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24010 auto *A = new (Ctx) NakedAttr(Ctx, CommonInfo);
24011 A->setImplicit(true);
24012 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24013 A->setAttributeSpellingListIndex(0);
24014 return A;
24015 }
24016
24017 NakedAttr *NakedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24018 auto *A = new (Ctx) NakedAttr(Ctx, CommonInfo);
24019 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24020 A->setAttributeSpellingListIndex(0);
24021 return A;
24022 }
24023
24024 NakedAttr *NakedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
24025 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24026 switch (S) {
24027 case GNU_naked:
24028 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24029 case CXX11_gnu_naked:
24030 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24031 case C23_gnu_naked:
24032 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24033 case Declspec_naked:
24034 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24035 default:
24036 llvm_unreachable("Unknown attribute spelling!");
24037 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24038 }
24039 }());
24040 return CreateImplicit(Ctx, I);
24041 }
24042
24043 NakedAttr *NakedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
24044 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24045 switch (S) {
24046 case GNU_naked:
24047 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24048 case CXX11_gnu_naked:
24049 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24050 case C23_gnu_naked:
24051 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24052 case Declspec_naked:
24053 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24054 default:
24055 llvm_unreachable("Unknown attribute spelling!");
24056 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24057 }
24058 }());
24059 return Create(Ctx, I);
24060 }
24061
24062 NakedAttr::NakedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24063 )
24064 : InheritableAttr(Ctx, CommonInfo, attr::Naked, /*IsLateParsed=*/false, false)
24065 {
24066 }
24067
24068 NakedAttr *NakedAttr::clone(ASTContext &C) const {
24069 auto *A = new (C) NakedAttr(C, *this);
24070 A->Inherited = Inherited;
24071 A->IsPackExpansion = IsPackExpansion;
24072 A->setImplicit(Implicit);
24073 return A;
24074 }
24075
24076 void NakedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
24077 bool IsFirstArgument = true; (void)IsFirstArgument;
24078 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
24079 switch (getAttributeSpellingListIndex()) {
24080 default:
24081 llvm_unreachable("Unknown attribute spelling!");
24082 break;
24083 case 0 : {
24084 OS << "__attribute__((naked";
24085 OS << "))";
24086 break;
24087 }
24088 case 1 : {
24089 OS << "[[gnu::naked";
24090 OS << "]]";
24091 break;
24092 }
24093 case 2 : {
24094 OS << "[[gnu::naked";
24095 OS << "]]";
24096 break;
24097 }
24098 case 3 : {
24099 OS << "__declspec(naked";
24100 OS << ")";
24101 break;
24102 }
24103 }
24104 }
24105
24106 const char *NakedAttr::getSpelling() const {
24107 switch (getAttributeSpellingListIndex()) {
24108 default:
24109 llvm_unreachable("Unknown attribute spelling!");
24110 return "(No spelling)";
24111 case 0:
24112 return "naked";
24113 case 1:
24114 return "naked";
24115 case 2:
24116 return "naked";
24117 case 3:
24118 return "naked";
24119 }
24120 }
24121
24122
24123 // NoAliasAttr implementation
24124
24125 NoAliasAttr *NoAliasAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24126 auto *A = new (Ctx) NoAliasAttr(Ctx, CommonInfo);
24127 A->setImplicit(true);
24128 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24129 A->setAttributeSpellingListIndex(0);
24130 return A;
24131 }
24132
24133 NoAliasAttr *NoAliasAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24134 auto *A = new (Ctx) NoAliasAttr(Ctx, CommonInfo);
24135 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24136 A->setAttributeSpellingListIndex(0);
24137 return A;
24138 }
24139
24140 NoAliasAttr *NoAliasAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
24141 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
24142 return CreateImplicit(Ctx, I);
24143 }
24144
24145 NoAliasAttr *NoAliasAttr::Create(ASTContext &Ctx, SourceRange Range) {
24146 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
24147 return Create(Ctx, I);
24148 }
24149
24150 NoAliasAttr::NoAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24151 )
24152 : InheritableAttr(Ctx, CommonInfo, attr::NoAlias, /*IsLateParsed=*/false, false)
24153 {
24154 }
24155
24156 NoAliasAttr *NoAliasAttr::clone(ASTContext &C) const {
24157 auto *A = new (C) NoAliasAttr(C, *this);
24158 A->Inherited = Inherited;
24159 A->IsPackExpansion = IsPackExpansion;
24160 A->setImplicit(Implicit);
24161 return A;
24162 }
24163
24164 void NoAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
24165 bool IsFirstArgument = true; (void)IsFirstArgument;
24166 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
24167 switch (getAttributeSpellingListIndex()) {
24168 default:
24169 llvm_unreachable("Unknown attribute spelling!");
24170 break;
24171 case 0 : {
24172 OS << "__declspec(noalias";
24173 OS << ")";
24174 break;
24175 }
24176 }
24177 }
24178
24179 const char *NoAliasAttr::getSpelling() const {
24180 switch (getAttributeSpellingListIndex()) {
24181 default:
24182 llvm_unreachable("Unknown attribute spelling!");
24183 return "(No spelling)";
24184 case 0:
24185 return "noalias";
24186 }
24187 }
24188
24189
24190 // NoBuiltinAttr implementation
24191
24192 NoBuiltinAttr *NoBuiltinAttr::CreateImplicit(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, const AttributeCommonInfo &CommonInfo) {
24193 auto *A = new (Ctx) NoBuiltinAttr(Ctx, CommonInfo, BuiltinNames, BuiltinNamesSize);
24194 A->setImplicit(true);
24195 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24196 A->setAttributeSpellingListIndex(0);
24197 return A;
24198 }
24199
24200 NoBuiltinAttr *NoBuiltinAttr::Create(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, const AttributeCommonInfo &CommonInfo) {
24201 auto *A = new (Ctx) NoBuiltinAttr(Ctx, CommonInfo, BuiltinNames, BuiltinNamesSize);
24202 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24203 A->setAttributeSpellingListIndex(0);
24204 return A;
24205 }
24206
24207 NoBuiltinAttr *NoBuiltinAttr::CreateImplicit(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, SourceRange Range, Spelling S) {
24208 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24209 switch (S) {
24210 case GNU_no_builtin:
24211 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24212 case CXX11_clang_no_builtin:
24213 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24214 case C23_clang_no_builtin:
24215 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24216 default:
24217 llvm_unreachable("Unknown attribute spelling!");
24218 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24219 }
24220 }());
24221 return CreateImplicit(Ctx, BuiltinNames, BuiltinNamesSize, I);
24222 }
24223
24224 NoBuiltinAttr *NoBuiltinAttr::Create(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, SourceRange Range, Spelling S) {
24225 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24226 switch (S) {
24227 case GNU_no_builtin:
24228 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24229 case CXX11_clang_no_builtin:
24230 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24231 case C23_clang_no_builtin:
24232 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24233 default:
24234 llvm_unreachable("Unknown attribute spelling!");
24235 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24236 }
24237 }());
24238 return Create(Ctx, BuiltinNames, BuiltinNamesSize, I);
24239 }
24240
24241 NoBuiltinAttr::NoBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24242 , StringRef *BuiltinNames, unsigned BuiltinNamesSize
24243 )
24244 : Attr(Ctx, CommonInfo, attr::NoBuiltin, /*IsLateParsed=*/false)
24245 , builtinNames_Size(BuiltinNamesSize), builtinNames_(new (Ctx, 16) StringRef[builtinNames_Size])
24246 {
24247 for (size_t I = 0, E = builtinNames_Size; I != E;
24248 ++I) {
24249 StringRef Ref = BuiltinNames[I];
24250 if (!Ref.empty()) {
24251 char *Mem = new (Ctx, 1) char[Ref.size()];
24252 std::memcpy(Mem, Ref.data(), Ref.size());
24253 builtinNames_[I] = StringRef(Mem, Ref.size());
24254 }
24255 }
24256 }
24257
24258 NoBuiltinAttr::NoBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24259 )
24260 : Attr(Ctx, CommonInfo, attr::NoBuiltin, /*IsLateParsed=*/false)
24261 , builtinNames_Size(0), builtinNames_(nullptr)
24262 {
24263 }
24264
24265
24266
24267 NoBuiltinAttr *NoBuiltinAttr::clone(ASTContext &C) const {
24268 auto *A = new (C) NoBuiltinAttr(C, *this, builtinNames_, builtinNames_Size);
24269 A->Inherited = Inherited;
24270 A->IsPackExpansion = IsPackExpansion;
24271 A->setImplicit(Implicit);
24272 return A;
24273 }
24274
24275 void NoBuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
24276 bool IsFirstArgument = true; (void)IsFirstArgument;
24277 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
24278 switch (getAttributeSpellingListIndex()) {
24279 default:
24280 llvm_unreachable("Unknown attribute spelling!");
24281 break;
24282 case 0 : {
24283 OS << "__attribute__((no_builtin";
24284 OS << "";
24285 for (const auto &Val : builtinNames()) {
24286 DelimitAttributeArgument(OS, IsFirstArgument);
24287 OS << "\"" << Val << "\"";
24288 }
24289 OS << "";
24290 if (!IsFirstArgument)
24291 OS << ")";
24292 OS << "))";
24293 break;
24294 }
24295 case 1 : {
24296 OS << "[[clang::no_builtin";
24297 OS << "";
24298 for (const auto &Val : builtinNames()) {
24299 DelimitAttributeArgument(OS, IsFirstArgument);
24300 OS << "\"" << Val << "\"";
24301 }
24302 OS << "";
24303 if (!IsFirstArgument)
24304 OS << ")";
24305 OS << "]]";
24306 break;
24307 }
24308 case 2 : {
24309 OS << "[[clang::no_builtin";
24310 OS << "";
24311 for (const auto &Val : builtinNames()) {
24312 DelimitAttributeArgument(OS, IsFirstArgument);
24313 OS << "\"" << Val << "\"";
24314 }
24315 OS << "";
24316 if (!IsFirstArgument)
24317 OS << ")";
24318 OS << "]]";
24319 break;
24320 }
24321 }
24322 }
24323
24324 const char *NoBuiltinAttr::getSpelling() const {
24325 switch (getAttributeSpellingListIndex()) {
24326 default:
24327 llvm_unreachable("Unknown attribute spelling!");
24328 return "(No spelling)";
24329 case 0:
24330 return "no_builtin";
24331 case 1:
24332 return "no_builtin";
24333 case 2:
24334 return "no_builtin";
24335 }
24336 }
24337
24338
24339 // NoCommonAttr implementation
24340
24341 NoCommonAttr *NoCommonAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24342 auto *A = new (Ctx) NoCommonAttr(Ctx, CommonInfo);
24343 A->setImplicit(true);
24344 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24345 A->setAttributeSpellingListIndex(0);
24346 return A;
24347 }
24348
24349 NoCommonAttr *NoCommonAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24350 auto *A = new (Ctx) NoCommonAttr(Ctx, CommonInfo);
24351 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24352 A->setAttributeSpellingListIndex(0);
24353 return A;
24354 }
24355
24356 NoCommonAttr *NoCommonAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
24357 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24358 switch (S) {
24359 case GNU_nocommon:
24360 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24361 case CXX11_gnu_nocommon:
24362 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24363 case C23_gnu_nocommon:
24364 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24365 default:
24366 llvm_unreachable("Unknown attribute spelling!");
24367 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24368 }
24369 }());
24370 return CreateImplicit(Ctx, I);
24371 }
24372
24373 NoCommonAttr *NoCommonAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
24374 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24375 switch (S) {
24376 case GNU_nocommon:
24377 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24378 case CXX11_gnu_nocommon:
24379 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24380 case C23_gnu_nocommon:
24381 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24382 default:
24383 llvm_unreachable("Unknown attribute spelling!");
24384 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24385 }
24386 }());
24387 return Create(Ctx, I);
24388 }
24389
24390 NoCommonAttr::NoCommonAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24391 )
24392 : InheritableAttr(Ctx, CommonInfo, attr::NoCommon, /*IsLateParsed=*/false, false)
24393 {
24394 }
24395
24396 NoCommonAttr *NoCommonAttr::clone(ASTContext &C) const {
24397 auto *A = new (C) NoCommonAttr(C, *this);
24398 A->Inherited = Inherited;
24399 A->IsPackExpansion = IsPackExpansion;
24400 A->setImplicit(Implicit);
24401 return A;
24402 }
24403
24404 void NoCommonAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
24405 bool IsFirstArgument = true; (void)IsFirstArgument;
24406 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
24407 switch (getAttributeSpellingListIndex()) {
24408 default:
24409 llvm_unreachable("Unknown attribute spelling!");
24410 break;
24411 case 0 : {
24412 OS << "__attribute__((nocommon";
24413 OS << "))";
24414 break;
24415 }
24416 case 1 : {
24417 OS << "[[gnu::nocommon";
24418 OS << "]]";
24419 break;
24420 }
24421 case 2 : {
24422 OS << "[[gnu::nocommon";
24423 OS << "]]";
24424 break;
24425 }
24426 }
24427 }
24428
24429 const char *NoCommonAttr::getSpelling() const {
24430 switch (getAttributeSpellingListIndex()) {
24431 default:
24432 llvm_unreachable("Unknown attribute spelling!");
24433 return "(No spelling)";
24434 case 0:
24435 return "nocommon";
24436 case 1:
24437 return "nocommon";
24438 case 2:
24439 return "nocommon";
24440 }
24441 }
24442
24443
24444 // NoConvergentAttr implementation
24445
24446 NoConvergentAttr *NoConvergentAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24447 auto *A = new (Ctx) NoConvergentAttr(Ctx, CommonInfo);
24448 A->setImplicit(true);
24449 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24450 A->setAttributeSpellingListIndex(0);
24451 return A;
24452 }
24453
24454 NoConvergentAttr *NoConvergentAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24455 auto *A = new (Ctx) NoConvergentAttr(Ctx, CommonInfo);
24456 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24457 A->setAttributeSpellingListIndex(0);
24458 return A;
24459 }
24460
24461 NoConvergentAttr *NoConvergentAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
24462 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24463 switch (S) {
24464 case GNU_noconvergent:
24465 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24466 case CXX11_clang_noconvergent:
24467 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24468 case C23_clang_noconvergent:
24469 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24470 case Declspec_noconvergent:
24471 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24472 default:
24473 llvm_unreachable("Unknown attribute spelling!");
24474 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24475 }
24476 }());
24477 return CreateImplicit(Ctx, I);
24478 }
24479
24480 NoConvergentAttr *NoConvergentAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
24481 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24482 switch (S) {
24483 case GNU_noconvergent:
24484 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24485 case CXX11_clang_noconvergent:
24486 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24487 case C23_clang_noconvergent:
24488 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24489 case Declspec_noconvergent:
24490 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24491 default:
24492 llvm_unreachable("Unknown attribute spelling!");
24493 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24494 }
24495 }());
24496 return Create(Ctx, I);
24497 }
24498
24499 NoConvergentAttr::NoConvergentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24500 )
24501 : InheritableAttr(Ctx, CommonInfo, attr::NoConvergent, /*IsLateParsed=*/false, false)
24502 {
24503 }
24504
24505 NoConvergentAttr *NoConvergentAttr::clone(ASTContext &C) const {
24506 auto *A = new (C) NoConvergentAttr(C, *this);
24507 A->Inherited = Inherited;
24508 A->IsPackExpansion = IsPackExpansion;
24509 A->setImplicit(Implicit);
24510 return A;
24511 }
24512
24513 void NoConvergentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
24514 bool IsFirstArgument = true; (void)IsFirstArgument;
24515 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
24516 switch (getAttributeSpellingListIndex()) {
24517 default:
24518 llvm_unreachable("Unknown attribute spelling!");
24519 break;
24520 case 0 : {
24521 OS << "__attribute__((noconvergent";
24522 OS << "))";
24523 break;
24524 }
24525 case 1 : {
24526 OS << "[[clang::noconvergent";
24527 OS << "]]";
24528 break;
24529 }
24530 case 2 : {
24531 OS << "[[clang::noconvergent";
24532 OS << "]]";
24533 break;
24534 }
24535 case 3 : {
24536 OS << "__declspec(noconvergent";
24537 OS << ")";
24538 break;
24539 }
24540 }
24541 }
24542
24543 const char *NoConvergentAttr::getSpelling() const {
24544 switch (getAttributeSpellingListIndex()) {
24545 default:
24546 llvm_unreachable("Unknown attribute spelling!");
24547 return "(No spelling)";
24548 case 0:
24549 return "noconvergent";
24550 case 1:
24551 return "noconvergent";
24552 case 2:
24553 return "noconvergent";
24554 case 3:
24555 return "noconvergent";
24556 }
24557 }
24558
24559
24560 // NoDebugAttr implementation
24561
24562 NoDebugAttr *NoDebugAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24563 auto *A = new (Ctx) NoDebugAttr(Ctx, CommonInfo);
24564 A->setImplicit(true);
24565 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24566 A->setAttributeSpellingListIndex(0);
24567 return A;
24568 }
24569
24570 NoDebugAttr *NoDebugAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24571 auto *A = new (Ctx) NoDebugAttr(Ctx, CommonInfo);
24572 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24573 A->setAttributeSpellingListIndex(0);
24574 return A;
24575 }
24576
24577 NoDebugAttr *NoDebugAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
24578 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24579 switch (S) {
24580 case GNU_nodebug:
24581 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24582 case CXX11_gnu_nodebug:
24583 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24584 case C23_gnu_nodebug:
24585 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24586 default:
24587 llvm_unreachable("Unknown attribute spelling!");
24588 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24589 }
24590 }());
24591 return CreateImplicit(Ctx, I);
24592 }
24593
24594 NoDebugAttr *NoDebugAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
24595 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24596 switch (S) {
24597 case GNU_nodebug:
24598 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24599 case CXX11_gnu_nodebug:
24600 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24601 case C23_gnu_nodebug:
24602 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24603 default:
24604 llvm_unreachable("Unknown attribute spelling!");
24605 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24606 }
24607 }());
24608 return Create(Ctx, I);
24609 }
24610
24611 NoDebugAttr::NoDebugAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24612 )
24613 : InheritableAttr(Ctx, CommonInfo, attr::NoDebug, /*IsLateParsed=*/false, false)
24614 {
24615 }
24616
24617 NoDebugAttr *NoDebugAttr::clone(ASTContext &C) const {
24618 auto *A = new (C) NoDebugAttr(C, *this);
24619 A->Inherited = Inherited;
24620 A->IsPackExpansion = IsPackExpansion;
24621 A->setImplicit(Implicit);
24622 return A;
24623 }
24624
24625 void NoDebugAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
24626 bool IsFirstArgument = true; (void)IsFirstArgument;
24627 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
24628 switch (getAttributeSpellingListIndex()) {
24629 default:
24630 llvm_unreachable("Unknown attribute spelling!");
24631 break;
24632 case 0 : {
24633 OS << "__attribute__((nodebug";
24634 OS << "))";
24635 break;
24636 }
24637 case 1 : {
24638 OS << "[[gnu::nodebug";
24639 OS << "]]";
24640 break;
24641 }
24642 case 2 : {
24643 OS << "[[gnu::nodebug";
24644 OS << "]]";
24645 break;
24646 }
24647 }
24648 }
24649
24650 const char *NoDebugAttr::getSpelling() const {
24651 switch (getAttributeSpellingListIndex()) {
24652 default:
24653 llvm_unreachable("Unknown attribute spelling!");
24654 return "(No spelling)";
24655 case 0:
24656 return "nodebug";
24657 case 1:
24658 return "nodebug";
24659 case 2:
24660 return "nodebug";
24661 }
24662 }
24663
24664
24665 // NoDerefAttr implementation
24666
24667 NoDerefAttr *NoDerefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24668 auto *A = new (Ctx) NoDerefAttr(Ctx, CommonInfo);
24669 A->setImplicit(true);
24670 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24671 A->setAttributeSpellingListIndex(0);
24672 return A;
24673 }
24674
24675 NoDerefAttr *NoDerefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24676 auto *A = new (Ctx) NoDerefAttr(Ctx, CommonInfo);
24677 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24678 A->setAttributeSpellingListIndex(0);
24679 return A;
24680 }
24681
24682 NoDerefAttr *NoDerefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
24683 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24684 switch (S) {
24685 case GNU_noderef:
24686 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24687 case CXX11_clang_noderef:
24688 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24689 case C23_clang_noderef:
24690 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24691 default:
24692 llvm_unreachable("Unknown attribute spelling!");
24693 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24694 }
24695 }());
24696 return CreateImplicit(Ctx, I);
24697 }
24698
24699 NoDerefAttr *NoDerefAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
24700 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24701 switch (S) {
24702 case GNU_noderef:
24703 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24704 case CXX11_clang_noderef:
24705 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24706 case C23_clang_noderef:
24707 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24708 default:
24709 llvm_unreachable("Unknown attribute spelling!");
24710 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24711 }
24712 }());
24713 return Create(Ctx, I);
24714 }
24715
24716 NoDerefAttr::NoDerefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24717 )
24718 : TypeAttr(Ctx, CommonInfo, attr::NoDeref, /*IsLateParsed=*/false)
24719 {
24720 }
24721
24722 NoDerefAttr *NoDerefAttr::clone(ASTContext &C) const {
24723 auto *A = new (C) NoDerefAttr(C, *this);
24724 A->Inherited = Inherited;
24725 A->IsPackExpansion = IsPackExpansion;
24726 A->setImplicit(Implicit);
24727 return A;
24728 }
24729
24730 void NoDerefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
24731 bool IsFirstArgument = true; (void)IsFirstArgument;
24732 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
24733 switch (getAttributeSpellingListIndex()) {
24734 default:
24735 llvm_unreachable("Unknown attribute spelling!");
24736 break;
24737 case 0 : {
24738 OS << "__attribute__((noderef";
24739 OS << "))";
24740 break;
24741 }
24742 case 1 : {
24743 OS << "[[clang::noderef";
24744 OS << "]]";
24745 break;
24746 }
24747 case 2 : {
24748 OS << "[[clang::noderef";
24749 OS << "]]";
24750 break;
24751 }
24752 }
24753 }
24754
24755 const char *NoDerefAttr::getSpelling() const {
24756 switch (getAttributeSpellingListIndex()) {
24757 default:
24758 llvm_unreachable("Unknown attribute spelling!");
24759 return "(No spelling)";
24760 case 0:
24761 return "noderef";
24762 case 1:
24763 return "noderef";
24764 case 2:
24765 return "noderef";
24766 }
24767 }
24768
24769
24770 // NoDestroyAttr implementation
24771
24772 NoDestroyAttr *NoDestroyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24773 auto *A = new (Ctx) NoDestroyAttr(Ctx, CommonInfo);
24774 A->setImplicit(true);
24775 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24776 A->setAttributeSpellingListIndex(0);
24777 return A;
24778 }
24779
24780 NoDestroyAttr *NoDestroyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24781 auto *A = new (Ctx) NoDestroyAttr(Ctx, CommonInfo);
24782 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24783 A->setAttributeSpellingListIndex(0);
24784 return A;
24785 }
24786
24787 NoDestroyAttr *NoDestroyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
24788 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24789 switch (S) {
24790 case GNU_no_destroy:
24791 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24792 case CXX11_clang_no_destroy:
24793 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24794 default:
24795 llvm_unreachable("Unknown attribute spelling!");
24796 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24797 }
24798 }());
24799 return CreateImplicit(Ctx, I);
24800 }
24801
24802 NoDestroyAttr *NoDestroyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
24803 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24804 switch (S) {
24805 case GNU_no_destroy:
24806 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24807 case CXX11_clang_no_destroy:
24808 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24809 default:
24810 llvm_unreachable("Unknown attribute spelling!");
24811 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24812 }
24813 }());
24814 return Create(Ctx, I);
24815 }
24816
24817 NoDestroyAttr::NoDestroyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24818 )
24819 : InheritableAttr(Ctx, CommonInfo, attr::NoDestroy, /*IsLateParsed=*/false, false)
24820 {
24821 }
24822
24823 NoDestroyAttr *NoDestroyAttr::clone(ASTContext &C) const {
24824 auto *A = new (C) NoDestroyAttr(C, *this);
24825 A->Inherited = Inherited;
24826 A->IsPackExpansion = IsPackExpansion;
24827 A->setImplicit(Implicit);
24828 return A;
24829 }
24830
24831 void NoDestroyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
24832 bool IsFirstArgument = true; (void)IsFirstArgument;
24833 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
24834 switch (getAttributeSpellingListIndex()) {
24835 default:
24836 llvm_unreachable("Unknown attribute spelling!");
24837 break;
24838 case 0 : {
24839 OS << "__attribute__((no_destroy";
24840 OS << "))";
24841 break;
24842 }
24843 case 1 : {
24844 OS << "[[clang::no_destroy";
24845 OS << "]]";
24846 break;
24847 }
24848 }
24849 }
24850
24851 const char *NoDestroyAttr::getSpelling() const {
24852 switch (getAttributeSpellingListIndex()) {
24853 default:
24854 llvm_unreachable("Unknown attribute spelling!");
24855 return "(No spelling)";
24856 case 0:
24857 return "no_destroy";
24858 case 1:
24859 return "no_destroy";
24860 }
24861 }
24862
24863
24864 // NoDuplicateAttr implementation
24865
24866 NoDuplicateAttr *NoDuplicateAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24867 auto *A = new (Ctx) NoDuplicateAttr(Ctx, CommonInfo);
24868 A->setImplicit(true);
24869 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24870 A->setAttributeSpellingListIndex(0);
24871 return A;
24872 }
24873
24874 NoDuplicateAttr *NoDuplicateAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24875 auto *A = new (Ctx) NoDuplicateAttr(Ctx, CommonInfo);
24876 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24877 A->setAttributeSpellingListIndex(0);
24878 return A;
24879 }
24880
24881 NoDuplicateAttr *NoDuplicateAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
24882 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24883 switch (S) {
24884 case GNU_noduplicate:
24885 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24886 case CXX11_clang_noduplicate:
24887 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24888 case C23_clang_noduplicate:
24889 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24890 default:
24891 llvm_unreachable("Unknown attribute spelling!");
24892 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24893 }
24894 }());
24895 return CreateImplicit(Ctx, I);
24896 }
24897
24898 NoDuplicateAttr *NoDuplicateAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
24899 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24900 switch (S) {
24901 case GNU_noduplicate:
24902 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24903 case CXX11_clang_noduplicate:
24904 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24905 case C23_clang_noduplicate:
24906 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24907 default:
24908 llvm_unreachable("Unknown attribute spelling!");
24909 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24910 }
24911 }());
24912 return Create(Ctx, I);
24913 }
24914
24915 NoDuplicateAttr::NoDuplicateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
24916 )
24917 : InheritableAttr(Ctx, CommonInfo, attr::NoDuplicate, /*IsLateParsed=*/false, false)
24918 {
24919 }
24920
24921 NoDuplicateAttr *NoDuplicateAttr::clone(ASTContext &C) const {
24922 auto *A = new (C) NoDuplicateAttr(C, *this);
24923 A->Inherited = Inherited;
24924 A->IsPackExpansion = IsPackExpansion;
24925 A->setImplicit(Implicit);
24926 return A;
24927 }
24928
24929 void NoDuplicateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
24930 bool IsFirstArgument = true; (void)IsFirstArgument;
24931 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
24932 switch (getAttributeSpellingListIndex()) {
24933 default:
24934 llvm_unreachable("Unknown attribute spelling!");
24935 break;
24936 case 0 : {
24937 OS << "__attribute__((noduplicate";
24938 OS << "))";
24939 break;
24940 }
24941 case 1 : {
24942 OS << "[[clang::noduplicate";
24943 OS << "]]";
24944 break;
24945 }
24946 case 2 : {
24947 OS << "[[clang::noduplicate";
24948 OS << "]]";
24949 break;
24950 }
24951 }
24952 }
24953
24954 const char *NoDuplicateAttr::getSpelling() const {
24955 switch (getAttributeSpellingListIndex()) {
24956 default:
24957 llvm_unreachable("Unknown attribute spelling!");
24958 return "(No spelling)";
24959 case 0:
24960 return "noduplicate";
24961 case 1:
24962 return "noduplicate";
24963 case 2:
24964 return "noduplicate";
24965 }
24966 }
24967
24968
24969 // NoEscapeAttr implementation
24970
24971 NoEscapeAttr *NoEscapeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24972 auto *A = new (Ctx) NoEscapeAttr(Ctx, CommonInfo);
24973 A->setImplicit(true);
24974 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24975 A->setAttributeSpellingListIndex(0);
24976 return A;
24977 }
24978
24979 NoEscapeAttr *NoEscapeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
24980 auto *A = new (Ctx) NoEscapeAttr(Ctx, CommonInfo);
24981 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
24982 A->setAttributeSpellingListIndex(0);
24983 return A;
24984 }
24985
24986 NoEscapeAttr *NoEscapeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
24987 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
24988 switch (S) {
24989 case GNU_noescape:
24990 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24991 case CXX11_clang_noescape:
24992 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24993 case C23_clang_noescape:
24994 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24995 default:
24996 llvm_unreachable("Unknown attribute spelling!");
24997 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
24998 }
24999 }());
25000 return CreateImplicit(Ctx, I);
25001 }
25002
25003 NoEscapeAttr *NoEscapeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
25004 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25005 switch (S) {
25006 case GNU_noescape:
25007 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25008 case CXX11_clang_noescape:
25009 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25010 case C23_clang_noescape:
25011 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25012 default:
25013 llvm_unreachable("Unknown attribute spelling!");
25014 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25015 }
25016 }());
25017 return Create(Ctx, I);
25018 }
25019
25020 NoEscapeAttr::NoEscapeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
25021 )
25022 : Attr(Ctx, CommonInfo, attr::NoEscape, /*IsLateParsed=*/false)
25023 {
25024 }
25025
25026 NoEscapeAttr *NoEscapeAttr::clone(ASTContext &C) const {
25027 auto *A = new (C) NoEscapeAttr(C, *this);
25028 A->Inherited = Inherited;
25029 A->IsPackExpansion = IsPackExpansion;
25030 A->setImplicit(Implicit);
25031 return A;
25032 }
25033
25034 void NoEscapeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
25035 bool IsFirstArgument = true; (void)IsFirstArgument;
25036 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
25037 switch (getAttributeSpellingListIndex()) {
25038 default:
25039 llvm_unreachable("Unknown attribute spelling!");
25040 break;
25041 case 0 : {
25042 OS << "__attribute__((noescape";
25043 OS << "))";
25044 break;
25045 }
25046 case 1 : {
25047 OS << "[[clang::noescape";
25048 OS << "]]";
25049 break;
25050 }
25051 case 2 : {
25052 OS << "[[clang::noescape";
25053 OS << "]]";
25054 break;
25055 }
25056 }
25057 }
25058
25059 const char *NoEscapeAttr::getSpelling() const {
25060 switch (getAttributeSpellingListIndex()) {
25061 default:
25062 llvm_unreachable("Unknown attribute spelling!");
25063 return "(No spelling)";
25064 case 0:
25065 return "noescape";
25066 case 1:
25067 return "noescape";
25068 case 2:
25069 return "noescape";
25070 }
25071 }
25072
25073
25074 // NoInlineAttr implementation
25075
25076 NoInlineAttr *NoInlineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25077 auto *A = new (Ctx) NoInlineAttr(Ctx, CommonInfo);
25078 A->setImplicit(true);
25079 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25080 A->setAttributeSpellingListIndex(0);
25081 return A;
25082 }
25083
25084 NoInlineAttr *NoInlineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25085 auto *A = new (Ctx) NoInlineAttr(Ctx, CommonInfo);
25086 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25087 A->setAttributeSpellingListIndex(0);
25088 return A;
25089 }
25090
25091 NoInlineAttr *NoInlineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
25092 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25093 switch (S) {
25094 case Keyword_noinline:
25095 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25096 case GNU_noinline:
25097 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25098 case CXX11_gnu_noinline:
25099 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25100 case C23_gnu_noinline:
25101 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25102 case CXX11_clang_noinline:
25103 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25104 case C23_clang_noinline:
25105 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25106 case CXX11_msvc_noinline:
25107 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_msvc_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25108 case C23_msvc_noinline:
25109 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_msvc_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25110 case Declspec_noinline:
25111 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25112 default:
25113 llvm_unreachable("Unknown attribute spelling!");
25114 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25115 }
25116 }());
25117 return CreateImplicit(Ctx, I);
25118 }
25119
25120 NoInlineAttr *NoInlineAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
25121 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25122 switch (S) {
25123 case Keyword_noinline:
25124 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25125 case GNU_noinline:
25126 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25127 case CXX11_gnu_noinline:
25128 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25129 case C23_gnu_noinline:
25130 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25131 case CXX11_clang_noinline:
25132 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25133 case C23_clang_noinline:
25134 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25135 case CXX11_msvc_noinline:
25136 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_msvc_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25137 case C23_msvc_noinline:
25138 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_msvc_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25139 case Declspec_noinline:
25140 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25141 default:
25142 llvm_unreachable("Unknown attribute spelling!");
25143 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25144 }
25145 }());
25146 return Create(Ctx, I);
25147 }
25148
25149 NoInlineAttr::NoInlineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
25150 )
25151 : DeclOrStmtAttr(Ctx, CommonInfo, attr::NoInline, /*IsLateParsed=*/false, false)
25152 {
25153 }
25154
25155 NoInlineAttr *NoInlineAttr::clone(ASTContext &C) const {
25156 auto *A = new (C) NoInlineAttr(C, *this);
25157 A->Inherited = Inherited;
25158 A->IsPackExpansion = IsPackExpansion;
25159 A->setImplicit(Implicit);
25160 return A;
25161 }
25162
25163 void NoInlineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
25164 bool IsFirstArgument = true; (void)IsFirstArgument;
25165 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
25166 switch (getAttributeSpellingListIndex()) {
25167 default:
25168 llvm_unreachable("Unknown attribute spelling!");
25169 break;
25170 case 0 : {
25171 OS << "__noinline__";
25172 OS << "";
25173 break;
25174 }
25175 case 1 : {
25176 OS << "__attribute__((noinline";
25177 OS << "))";
25178 break;
25179 }
25180 case 2 : {
25181 OS << "[[gnu::noinline";
25182 OS << "]]";
25183 break;
25184 }
25185 case 3 : {
25186 OS << "[[gnu::noinline";
25187 OS << "]]";
25188 break;
25189 }
25190 case 4 : {
25191 OS << "[[clang::noinline";
25192 OS << "]]";
25193 break;
25194 }
25195 case 5 : {
25196 OS << "[[clang::noinline";
25197 OS << "]]";
25198 break;
25199 }
25200 case 6 : {
25201 OS << "[[msvc::noinline";
25202 OS << "]]";
25203 break;
25204 }
25205 case 7 : {
25206 OS << "[[msvc::noinline";
25207 OS << "]]";
25208 break;
25209 }
25210 case 8 : {
25211 OS << "__declspec(noinline";
25212 OS << ")";
25213 break;
25214 }
25215 }
25216 }
25217
25218 const char *NoInlineAttr::getSpelling() const {
25219 switch (getAttributeSpellingListIndex()) {
25220 default:
25221 llvm_unreachable("Unknown attribute spelling!");
25222 return "(No spelling)";
25223 case 0:
25224 return "__noinline__";
25225 case 1:
25226 return "noinline";
25227 case 2:
25228 return "noinline";
25229 case 3:
25230 return "noinline";
25231 case 4:
25232 return "noinline";
25233 case 5:
25234 return "noinline";
25235 case 6:
25236 return "noinline";
25237 case 7:
25238 return "noinline";
25239 case 8:
25240 return "noinline";
25241 }
25242 }
25243
25244
25245 // NoInstrumentFunctionAttr implementation
25246
25247 NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25248 auto *A = new (Ctx) NoInstrumentFunctionAttr(Ctx, CommonInfo);
25249 A->setImplicit(true);
25250 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25251 A->setAttributeSpellingListIndex(0);
25252 return A;
25253 }
25254
25255 NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25256 auto *A = new (Ctx) NoInstrumentFunctionAttr(Ctx, CommonInfo);
25257 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25258 A->setAttributeSpellingListIndex(0);
25259 return A;
25260 }
25261
25262 NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
25263 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25264 switch (S) {
25265 case GNU_no_instrument_function:
25266 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25267 case CXX11_gnu_no_instrument_function:
25268 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25269 case C23_gnu_no_instrument_function:
25270 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25271 default:
25272 llvm_unreachable("Unknown attribute spelling!");
25273 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25274 }
25275 }());
25276 return CreateImplicit(Ctx, I);
25277 }
25278
25279 NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
25280 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25281 switch (S) {
25282 case GNU_no_instrument_function:
25283 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25284 case CXX11_gnu_no_instrument_function:
25285 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25286 case C23_gnu_no_instrument_function:
25287 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25288 default:
25289 llvm_unreachable("Unknown attribute spelling!");
25290 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25291 }
25292 }());
25293 return Create(Ctx, I);
25294 }
25295
25296 NoInstrumentFunctionAttr::NoInstrumentFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
25297 )
25298 : InheritableAttr(Ctx, CommonInfo, attr::NoInstrumentFunction, /*IsLateParsed=*/false, false)
25299 {
25300 }
25301
25302 NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::clone(ASTContext &C) const {
25303 auto *A = new (C) NoInstrumentFunctionAttr(C, *this);
25304 A->Inherited = Inherited;
25305 A->IsPackExpansion = IsPackExpansion;
25306 A->setImplicit(Implicit);
25307 return A;
25308 }
25309
25310 void NoInstrumentFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
25311 bool IsFirstArgument = true; (void)IsFirstArgument;
25312 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
25313 switch (getAttributeSpellingListIndex()) {
25314 default:
25315 llvm_unreachable("Unknown attribute spelling!");
25316 break;
25317 case 0 : {
25318 OS << "__attribute__((no_instrument_function";
25319 OS << "))";
25320 break;
25321 }
25322 case 1 : {
25323 OS << "[[gnu::no_instrument_function";
25324 OS << "]]";
25325 break;
25326 }
25327 case 2 : {
25328 OS << "[[gnu::no_instrument_function";
25329 OS << "]]";
25330 break;
25331 }
25332 }
25333 }
25334
25335 const char *NoInstrumentFunctionAttr::getSpelling() const {
25336 switch (getAttributeSpellingListIndex()) {
25337 default:
25338 llvm_unreachable("Unknown attribute spelling!");
25339 return "(No spelling)";
25340 case 0:
25341 return "no_instrument_function";
25342 case 1:
25343 return "no_instrument_function";
25344 case 2:
25345 return "no_instrument_function";
25346 }
25347 }
25348
25349
25350 // NoMergeAttr implementation
25351
25352 NoMergeAttr *NoMergeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25353 auto *A = new (Ctx) NoMergeAttr(Ctx, CommonInfo);
25354 A->setImplicit(true);
25355 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25356 A->setAttributeSpellingListIndex(0);
25357 return A;
25358 }
25359
25360 NoMergeAttr *NoMergeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25361 auto *A = new (Ctx) NoMergeAttr(Ctx, CommonInfo);
25362 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25363 A->setAttributeSpellingListIndex(0);
25364 return A;
25365 }
25366
25367 NoMergeAttr *NoMergeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
25368 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25369 switch (S) {
25370 case GNU_nomerge:
25371 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25372 case CXX11_clang_nomerge:
25373 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25374 case C23_clang_nomerge:
25375 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25376 default:
25377 llvm_unreachable("Unknown attribute spelling!");
25378 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25379 }
25380 }());
25381 return CreateImplicit(Ctx, I);
25382 }
25383
25384 NoMergeAttr *NoMergeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
25385 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25386 switch (S) {
25387 case GNU_nomerge:
25388 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25389 case CXX11_clang_nomerge:
25390 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25391 case C23_clang_nomerge:
25392 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25393 default:
25394 llvm_unreachable("Unknown attribute spelling!");
25395 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25396 }
25397 }());
25398 return Create(Ctx, I);
25399 }
25400
25401 NoMergeAttr::NoMergeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
25402 )
25403 : DeclOrStmtAttr(Ctx, CommonInfo, attr::NoMerge, /*IsLateParsed=*/false, false)
25404 {
25405 }
25406
25407 NoMergeAttr *NoMergeAttr::clone(ASTContext &C) const {
25408 auto *A = new (C) NoMergeAttr(C, *this);
25409 A->Inherited = Inherited;
25410 A->IsPackExpansion = IsPackExpansion;
25411 A->setImplicit(Implicit);
25412 return A;
25413 }
25414
25415 void NoMergeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
25416 bool IsFirstArgument = true; (void)IsFirstArgument;
25417 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
25418 switch (getAttributeSpellingListIndex()) {
25419 default:
25420 llvm_unreachable("Unknown attribute spelling!");
25421 break;
25422 case 0 : {
25423 OS << "__attribute__((nomerge";
25424 OS << "))";
25425 break;
25426 }
25427 case 1 : {
25428 OS << "[[clang::nomerge";
25429 OS << "]]";
25430 break;
25431 }
25432 case 2 : {
25433 OS << "[[clang::nomerge";
25434 OS << "]]";
25435 break;
25436 }
25437 }
25438 }
25439
25440 const char *NoMergeAttr::getSpelling() const {
25441 switch (getAttributeSpellingListIndex()) {
25442 default:
25443 llvm_unreachable("Unknown attribute spelling!");
25444 return "(No spelling)";
25445 case 0:
25446 return "nomerge";
25447 case 1:
25448 return "nomerge";
25449 case 2:
25450 return "nomerge";
25451 }
25452 }
25453
25454
25455 // NoMicroMipsAttr implementation
25456
25457 NoMicroMipsAttr *NoMicroMipsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25458 auto *A = new (Ctx) NoMicroMipsAttr(Ctx, CommonInfo);
25459 A->setImplicit(true);
25460 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25461 A->setAttributeSpellingListIndex(0);
25462 return A;
25463 }
25464
25465 NoMicroMipsAttr *NoMicroMipsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25466 auto *A = new (Ctx) NoMicroMipsAttr(Ctx, CommonInfo);
25467 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25468 A->setAttributeSpellingListIndex(0);
25469 return A;
25470 }
25471
25472 NoMicroMipsAttr *NoMicroMipsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
25473 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25474 switch (S) {
25475 case GNU_nomicromips:
25476 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25477 case CXX11_gnu_nomicromips:
25478 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25479 case C23_gnu_nomicromips:
25480 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25481 default:
25482 llvm_unreachable("Unknown attribute spelling!");
25483 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25484 }
25485 }());
25486 return CreateImplicit(Ctx, I);
25487 }
25488
25489 NoMicroMipsAttr *NoMicroMipsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
25490 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25491 switch (S) {
25492 case GNU_nomicromips:
25493 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25494 case CXX11_gnu_nomicromips:
25495 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25496 case C23_gnu_nomicromips:
25497 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25498 default:
25499 llvm_unreachable("Unknown attribute spelling!");
25500 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25501 }
25502 }());
25503 return Create(Ctx, I);
25504 }
25505
25506 NoMicroMipsAttr::NoMicroMipsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
25507 )
25508 : InheritableAttr(Ctx, CommonInfo, attr::NoMicroMips, /*IsLateParsed=*/false, false)
25509 {
25510 }
25511
25512 NoMicroMipsAttr *NoMicroMipsAttr::clone(ASTContext &C) const {
25513 auto *A = new (C) NoMicroMipsAttr(C, *this);
25514 A->Inherited = Inherited;
25515 A->IsPackExpansion = IsPackExpansion;
25516 A->setImplicit(Implicit);
25517 return A;
25518 }
25519
25520 void NoMicroMipsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
25521 bool IsFirstArgument = true; (void)IsFirstArgument;
25522 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
25523 switch (getAttributeSpellingListIndex()) {
25524 default:
25525 llvm_unreachable("Unknown attribute spelling!");
25526 break;
25527 case 0 : {
25528 OS << "__attribute__((nomicromips";
25529 OS << "))";
25530 break;
25531 }
25532 case 1 : {
25533 OS << "[[gnu::nomicromips";
25534 OS << "]]";
25535 break;
25536 }
25537 case 2 : {
25538 OS << "[[gnu::nomicromips";
25539 OS << "]]";
25540 break;
25541 }
25542 }
25543 }
25544
25545 const char *NoMicroMipsAttr::getSpelling() const {
25546 switch (getAttributeSpellingListIndex()) {
25547 default:
25548 llvm_unreachable("Unknown attribute spelling!");
25549 return "(No spelling)";
25550 case 0:
25551 return "nomicromips";
25552 case 1:
25553 return "nomicromips";
25554 case 2:
25555 return "nomicromips";
25556 }
25557 }
25558
25559
25560 // NoMips16Attr implementation
25561
25562 NoMips16Attr *NoMips16Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25563 auto *A = new (Ctx) NoMips16Attr(Ctx, CommonInfo);
25564 A->setImplicit(true);
25565 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25566 A->setAttributeSpellingListIndex(0);
25567 return A;
25568 }
25569
25570 NoMips16Attr *NoMips16Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25571 auto *A = new (Ctx) NoMips16Attr(Ctx, CommonInfo);
25572 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25573 A->setAttributeSpellingListIndex(0);
25574 return A;
25575 }
25576
25577 NoMips16Attr *NoMips16Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
25578 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25579 switch (S) {
25580 case GNU_nomips16:
25581 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25582 case CXX11_gnu_nomips16:
25583 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25584 case C23_gnu_nomips16:
25585 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25586 default:
25587 llvm_unreachable("Unknown attribute spelling!");
25588 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25589 }
25590 }());
25591 return CreateImplicit(Ctx, I);
25592 }
25593
25594 NoMips16Attr *NoMips16Attr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
25595 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25596 switch (S) {
25597 case GNU_nomips16:
25598 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25599 case CXX11_gnu_nomips16:
25600 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25601 case C23_gnu_nomips16:
25602 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25603 default:
25604 llvm_unreachable("Unknown attribute spelling!");
25605 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25606 }
25607 }());
25608 return Create(Ctx, I);
25609 }
25610
25611 NoMips16Attr::NoMips16Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
25612 )
25613 : InheritableAttr(Ctx, CommonInfo, attr::NoMips16, /*IsLateParsed=*/false, false)
25614 {
25615 }
25616
25617 NoMips16Attr *NoMips16Attr::clone(ASTContext &C) const {
25618 auto *A = new (C) NoMips16Attr(C, *this);
25619 A->Inherited = Inherited;
25620 A->IsPackExpansion = IsPackExpansion;
25621 A->setImplicit(Implicit);
25622 return A;
25623 }
25624
25625 void NoMips16Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
25626 bool IsFirstArgument = true; (void)IsFirstArgument;
25627 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
25628 switch (getAttributeSpellingListIndex()) {
25629 default:
25630 llvm_unreachable("Unknown attribute spelling!");
25631 break;
25632 case 0 : {
25633 OS << "__attribute__((nomips16";
25634 OS << "))";
25635 break;
25636 }
25637 case 1 : {
25638 OS << "[[gnu::nomips16";
25639 OS << "]]";
25640 break;
25641 }
25642 case 2 : {
25643 OS << "[[gnu::nomips16";
25644 OS << "]]";
25645 break;
25646 }
25647 }
25648 }
25649
25650 const char *NoMips16Attr::getSpelling() const {
25651 switch (getAttributeSpellingListIndex()) {
25652 default:
25653 llvm_unreachable("Unknown attribute spelling!");
25654 return "(No spelling)";
25655 case 0:
25656 return "nomips16";
25657 case 1:
25658 return "nomips16";
25659 case 2:
25660 return "nomips16";
25661 }
25662 }
25663
25664
25665 // NoProfileFunctionAttr implementation
25666
25667 NoProfileFunctionAttr *NoProfileFunctionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25668 auto *A = new (Ctx) NoProfileFunctionAttr(Ctx, CommonInfo);
25669 A->setImplicit(true);
25670 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25671 A->setAttributeSpellingListIndex(0);
25672 return A;
25673 }
25674
25675 NoProfileFunctionAttr *NoProfileFunctionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25676 auto *A = new (Ctx) NoProfileFunctionAttr(Ctx, CommonInfo);
25677 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25678 A->setAttributeSpellingListIndex(0);
25679 return A;
25680 }
25681
25682 NoProfileFunctionAttr *NoProfileFunctionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
25683 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25684 switch (S) {
25685 case GNU_no_profile_instrument_function:
25686 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25687 case CXX11_gnu_no_profile_instrument_function:
25688 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25689 case C23_gnu_no_profile_instrument_function:
25690 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25691 default:
25692 llvm_unreachable("Unknown attribute spelling!");
25693 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25694 }
25695 }());
25696 return CreateImplicit(Ctx, I);
25697 }
25698
25699 NoProfileFunctionAttr *NoProfileFunctionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
25700 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25701 switch (S) {
25702 case GNU_no_profile_instrument_function:
25703 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25704 case CXX11_gnu_no_profile_instrument_function:
25705 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25706 case C23_gnu_no_profile_instrument_function:
25707 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25708 default:
25709 llvm_unreachable("Unknown attribute spelling!");
25710 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25711 }
25712 }());
25713 return Create(Ctx, I);
25714 }
25715
25716 NoProfileFunctionAttr::NoProfileFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
25717 )
25718 : InheritableAttr(Ctx, CommonInfo, attr::NoProfileFunction, /*IsLateParsed=*/false, false)
25719 {
25720 }
25721
25722 NoProfileFunctionAttr *NoProfileFunctionAttr::clone(ASTContext &C) const {
25723 auto *A = new (C) NoProfileFunctionAttr(C, *this);
25724 A->Inherited = Inherited;
25725 A->IsPackExpansion = IsPackExpansion;
25726 A->setImplicit(Implicit);
25727 return A;
25728 }
25729
25730 void NoProfileFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
25731 bool IsFirstArgument = true; (void)IsFirstArgument;
25732 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
25733 switch (getAttributeSpellingListIndex()) {
25734 default:
25735 llvm_unreachable("Unknown attribute spelling!");
25736 break;
25737 case 0 : {
25738 OS << "__attribute__((no_profile_instrument_function";
25739 OS << "))";
25740 break;
25741 }
25742 case 1 : {
25743 OS << "[[gnu::no_profile_instrument_function";
25744 OS << "]]";
25745 break;
25746 }
25747 case 2 : {
25748 OS << "[[gnu::no_profile_instrument_function";
25749 OS << "]]";
25750 break;
25751 }
25752 }
25753 }
25754
25755 const char *NoProfileFunctionAttr::getSpelling() const {
25756 switch (getAttributeSpellingListIndex()) {
25757 default:
25758 llvm_unreachable("Unknown attribute spelling!");
25759 return "(No spelling)";
25760 case 0:
25761 return "no_profile_instrument_function";
25762 case 1:
25763 return "no_profile_instrument_function";
25764 case 2:
25765 return "no_profile_instrument_function";
25766 }
25767 }
25768
25769
25770 // NoRandomizeLayoutAttr implementation
25771
25772 NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25773 auto *A = new (Ctx) NoRandomizeLayoutAttr(Ctx, CommonInfo);
25774 A->setImplicit(true);
25775 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25776 A->setAttributeSpellingListIndex(0);
25777 return A;
25778 }
25779
25780 NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25781 auto *A = new (Ctx) NoRandomizeLayoutAttr(Ctx, CommonInfo);
25782 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25783 A->setAttributeSpellingListIndex(0);
25784 return A;
25785 }
25786
25787 NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
25788 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25789 switch (S) {
25790 case GNU_no_randomize_layout:
25791 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25792 case CXX11_gnu_no_randomize_layout:
25793 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25794 case C23_gnu_no_randomize_layout:
25795 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25796 default:
25797 llvm_unreachable("Unknown attribute spelling!");
25798 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25799 }
25800 }());
25801 return CreateImplicit(Ctx, I);
25802 }
25803
25804 NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
25805 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25806 switch (S) {
25807 case GNU_no_randomize_layout:
25808 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25809 case CXX11_gnu_no_randomize_layout:
25810 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25811 case C23_gnu_no_randomize_layout:
25812 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25813 default:
25814 llvm_unreachable("Unknown attribute spelling!");
25815 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25816 }
25817 }());
25818 return Create(Ctx, I);
25819 }
25820
25821 NoRandomizeLayoutAttr::NoRandomizeLayoutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
25822 )
25823 : InheritableAttr(Ctx, CommonInfo, attr::NoRandomizeLayout, /*IsLateParsed=*/false, false)
25824 {
25825 }
25826
25827 NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::clone(ASTContext &C) const {
25828 auto *A = new (C) NoRandomizeLayoutAttr(C, *this);
25829 A->Inherited = Inherited;
25830 A->IsPackExpansion = IsPackExpansion;
25831 A->setImplicit(Implicit);
25832 return A;
25833 }
25834
25835 void NoRandomizeLayoutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
25836 bool IsFirstArgument = true; (void)IsFirstArgument;
25837 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
25838 switch (getAttributeSpellingListIndex()) {
25839 default:
25840 llvm_unreachable("Unknown attribute spelling!");
25841 break;
25842 case 0 : {
25843 OS << "__attribute__((no_randomize_layout";
25844 OS << "))";
25845 break;
25846 }
25847 case 1 : {
25848 OS << "[[gnu::no_randomize_layout";
25849 OS << "]]";
25850 break;
25851 }
25852 case 2 : {
25853 OS << "[[gnu::no_randomize_layout";
25854 OS << "]]";
25855 break;
25856 }
25857 }
25858 }
25859
25860 const char *NoRandomizeLayoutAttr::getSpelling() const {
25861 switch (getAttributeSpellingListIndex()) {
25862 default:
25863 llvm_unreachable("Unknown attribute spelling!");
25864 return "(No spelling)";
25865 case 0:
25866 return "no_randomize_layout";
25867 case 1:
25868 return "no_randomize_layout";
25869 case 2:
25870 return "no_randomize_layout";
25871 }
25872 }
25873
25874
25875 // NoReturnAttr implementation
25876
25877 NoReturnAttr *NoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25878 auto *A = new (Ctx) NoReturnAttr(Ctx, CommonInfo);
25879 A->setImplicit(true);
25880 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25881 A->setAttributeSpellingListIndex(0);
25882 return A;
25883 }
25884
25885 NoReturnAttr *NoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
25886 auto *A = new (Ctx) NoReturnAttr(Ctx, CommonInfo);
25887 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25888 A->setAttributeSpellingListIndex(0);
25889 return A;
25890 }
25891
25892 NoReturnAttr *NoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
25893 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25894 switch (S) {
25895 case GNU_noreturn:
25896 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25897 case CXX11_gnu_noreturn:
25898 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25899 case C23_gnu_noreturn:
25900 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25901 case Declspec_noreturn:
25902 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25903 default:
25904 llvm_unreachable("Unknown attribute spelling!");
25905 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25906 }
25907 }());
25908 return CreateImplicit(Ctx, I);
25909 }
25910
25911 NoReturnAttr *NoReturnAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
25912 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
25913 switch (S) {
25914 case GNU_noreturn:
25915 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25916 case CXX11_gnu_noreturn:
25917 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25918 case C23_gnu_noreturn:
25919 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25920 case Declspec_noreturn:
25921 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25922 default:
25923 llvm_unreachable("Unknown attribute spelling!");
25924 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
25925 }
25926 }());
25927 return Create(Ctx, I);
25928 }
25929
25930 NoReturnAttr::NoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
25931 )
25932 : InheritableAttr(Ctx, CommonInfo, attr::NoReturn, /*IsLateParsed=*/false, false)
25933 {
25934 }
25935
25936 NoReturnAttr *NoReturnAttr::clone(ASTContext &C) const {
25937 auto *A = new (C) NoReturnAttr(C, *this);
25938 A->Inherited = Inherited;
25939 A->IsPackExpansion = IsPackExpansion;
25940 A->setImplicit(Implicit);
25941 return A;
25942 }
25943
25944 void NoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
25945 bool IsFirstArgument = true; (void)IsFirstArgument;
25946 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
25947 switch (getAttributeSpellingListIndex()) {
25948 default:
25949 llvm_unreachable("Unknown attribute spelling!");
25950 break;
25951 case 0 : {
25952 OS << "__attribute__((noreturn";
25953 OS << "))";
25954 break;
25955 }
25956 case 1 : {
25957 OS << "[[gnu::noreturn";
25958 OS << "]]";
25959 break;
25960 }
25961 case 2 : {
25962 OS << "[[gnu::noreturn";
25963 OS << "]]";
25964 break;
25965 }
25966 case 3 : {
25967 OS << "__declspec(noreturn";
25968 OS << ")";
25969 break;
25970 }
25971 }
25972 }
25973
25974 const char *NoReturnAttr::getSpelling() const {
25975 switch (getAttributeSpellingListIndex()) {
25976 default:
25977 llvm_unreachable("Unknown attribute spelling!");
25978 return "(No spelling)";
25979 case 0:
25980 return "noreturn";
25981 case 1:
25982 return "noreturn";
25983 case 2:
25984 return "noreturn";
25985 case 3:
25986 return "noreturn";
25987 }
25988 }
25989
25990
25991 // NoSanitizeAttr implementation
25992
25993 NoSanitizeAttr *NoSanitizeAttr::CreateImplicit(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, const AttributeCommonInfo &CommonInfo) {
25994 auto *A = new (Ctx) NoSanitizeAttr(Ctx, CommonInfo, Sanitizers, SanitizersSize);
25995 A->setImplicit(true);
25996 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
25997 A->setAttributeSpellingListIndex(0);
25998 return A;
25999 }
26000
26001 NoSanitizeAttr *NoSanitizeAttr::Create(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, const AttributeCommonInfo &CommonInfo) {
26002 auto *A = new (Ctx) NoSanitizeAttr(Ctx, CommonInfo, Sanitizers, SanitizersSize);
26003 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26004 A->setAttributeSpellingListIndex(0);
26005 return A;
26006 }
26007
26008 NoSanitizeAttr *NoSanitizeAttr::CreateImplicit(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, SourceRange Range, Spelling S) {
26009 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26010 switch (S) {
26011 case GNU_no_sanitize:
26012 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26013 case CXX11_clang_no_sanitize:
26014 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26015 case C23_clang_no_sanitize:
26016 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26017 default:
26018 llvm_unreachable("Unknown attribute spelling!");
26019 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26020 }
26021 }());
26022 return CreateImplicit(Ctx, Sanitizers, SanitizersSize, I);
26023 }
26024
26025 NoSanitizeAttr *NoSanitizeAttr::Create(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, SourceRange Range, Spelling S) {
26026 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26027 switch (S) {
26028 case GNU_no_sanitize:
26029 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26030 case CXX11_clang_no_sanitize:
26031 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26032 case C23_clang_no_sanitize:
26033 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26034 default:
26035 llvm_unreachable("Unknown attribute spelling!");
26036 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26037 }
26038 }());
26039 return Create(Ctx, Sanitizers, SanitizersSize, I);
26040 }
26041
26042 NoSanitizeAttr::NoSanitizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26043 , StringRef *Sanitizers, unsigned SanitizersSize
26044 )
26045 : InheritableAttr(Ctx, CommonInfo, attr::NoSanitize, /*IsLateParsed=*/false, false)
26046 , sanitizers_Size(SanitizersSize), sanitizers_(new (Ctx, 16) StringRef[sanitizers_Size])
26047 {
26048 for (size_t I = 0, E = sanitizers_Size; I != E;
26049 ++I) {
26050 StringRef Ref = Sanitizers[I];
26051 if (!Ref.empty()) {
26052 char *Mem = new (Ctx, 1) char[Ref.size()];
26053 std::memcpy(Mem, Ref.data(), Ref.size());
26054 sanitizers_[I] = StringRef(Mem, Ref.size());
26055 }
26056 }
26057 }
26058
26059 NoSanitizeAttr::NoSanitizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26060 )
26061 : InheritableAttr(Ctx, CommonInfo, attr::NoSanitize, /*IsLateParsed=*/false, false)
26062 , sanitizers_Size(0), sanitizers_(nullptr)
26063 {
26064 }
26065
26066
26067
26068 NoSanitizeAttr *NoSanitizeAttr::clone(ASTContext &C) const {
26069 auto *A = new (C) NoSanitizeAttr(C, *this, sanitizers_, sanitizers_Size);
26070 A->Inherited = Inherited;
26071 A->IsPackExpansion = IsPackExpansion;
26072 A->setImplicit(Implicit);
26073 return A;
26074 }
26075
26076 void NoSanitizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
26077 bool IsFirstArgument = true; (void)IsFirstArgument;
26078 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
26079 switch (getAttributeSpellingListIndex()) {
26080 default:
26081 llvm_unreachable("Unknown attribute spelling!");
26082 break;
26083 case 0 : {
26084 OS << "__attribute__((no_sanitize";
26085 OS << "";
26086 for (const auto &Val : sanitizers()) {
26087 DelimitAttributeArgument(OS, IsFirstArgument);
26088 OS << "\"" << Val << "\"";
26089 }
26090 OS << "";
26091 if (!IsFirstArgument)
26092 OS << ")";
26093 OS << "))";
26094 break;
26095 }
26096 case 1 : {
26097 OS << "[[clang::no_sanitize";
26098 OS << "";
26099 for (const auto &Val : sanitizers()) {
26100 DelimitAttributeArgument(OS, IsFirstArgument);
26101 OS << "\"" << Val << "\"";
26102 }
26103 OS << "";
26104 if (!IsFirstArgument)
26105 OS << ")";
26106 OS << "]]";
26107 break;
26108 }
26109 case 2 : {
26110 OS << "[[clang::no_sanitize";
26111 OS << "";
26112 for (const auto &Val : sanitizers()) {
26113 DelimitAttributeArgument(OS, IsFirstArgument);
26114 OS << "\"" << Val << "\"";
26115 }
26116 OS << "";
26117 if (!IsFirstArgument)
26118 OS << ")";
26119 OS << "]]";
26120 break;
26121 }
26122 }
26123 }
26124
26125 const char *NoSanitizeAttr::getSpelling() const {
26126 switch (getAttributeSpellingListIndex()) {
26127 default:
26128 llvm_unreachable("Unknown attribute spelling!");
26129 return "(No spelling)";
26130 case 0:
26131 return "no_sanitize";
26132 case 1:
26133 return "no_sanitize";
26134 case 2:
26135 return "no_sanitize";
26136 }
26137 }
26138
26139
26140 // NoSpecializationsAttr implementation
26141
26142 NoSpecializationsAttr *NoSpecializationsAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) {
26143 auto *A = new (Ctx) NoSpecializationsAttr(Ctx, CommonInfo, Message);
26144 A->setImplicit(true);
26145 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26146 A->setAttributeSpellingListIndex(0);
26147 return A;
26148 }
26149
26150 NoSpecializationsAttr *NoSpecializationsAttr::Create(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) {
26151 auto *A = new (Ctx) NoSpecializationsAttr(Ctx, CommonInfo, Message);
26152 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26153 A->setAttributeSpellingListIndex(0);
26154 return A;
26155 }
26156
26157 NoSpecializationsAttr *NoSpecializationsAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) {
26158 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26159 switch (S) {
26160 case GNU_no_specializations:
26161 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_specializations, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26162 case CXX11_clang_no_specializations:
26163 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_specializations, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26164 default:
26165 llvm_unreachable("Unknown attribute spelling!");
26166 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26167 }
26168 }());
26169 return CreateImplicit(Ctx, Message, I);
26170 }
26171
26172 NoSpecializationsAttr *NoSpecializationsAttr::Create(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) {
26173 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26174 switch (S) {
26175 case GNU_no_specializations:
26176 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_specializations, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26177 case CXX11_clang_no_specializations:
26178 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_specializations, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26179 default:
26180 llvm_unreachable("Unknown attribute spelling!");
26181 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26182 }
26183 }());
26184 return Create(Ctx, Message, I);
26185 }
26186
26187 NoSpecializationsAttr::NoSpecializationsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26188 , llvm::StringRef Message
26189 )
26190 : InheritableAttr(Ctx, CommonInfo, attr::NoSpecializations, /*IsLateParsed=*/false, false)
26191 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
26192 {
26193 if (!Message.empty())
26194 std::memcpy(message, Message.data(), messageLength);
26195 }
26196
26197 NoSpecializationsAttr::NoSpecializationsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26198 )
26199 : InheritableAttr(Ctx, CommonInfo, attr::NoSpecializations, /*IsLateParsed=*/false, false)
26200 , messageLength(0),message(nullptr)
26201 {
26202 }
26203
26204
26205
26206 NoSpecializationsAttr *NoSpecializationsAttr::clone(ASTContext &C) const {
26207 auto *A = new (C) NoSpecializationsAttr(C, *this, getMessage());
26208 A->Inherited = Inherited;
26209 A->IsPackExpansion = IsPackExpansion;
26210 A->setImplicit(Implicit);
26211 return A;
26212 }
26213
26214 void NoSpecializationsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
26215 bool IsFirstArgument = true; (void)IsFirstArgument;
26216 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
26217 switch (getAttributeSpellingListIndex()) {
26218 default:
26219 llvm_unreachable("Unknown attribute spelling!");
26220 break;
26221 case 0 : {
26222 OS << "__attribute__((no_specializations";
26223 DelimitAttributeArgument(OS, IsFirstArgument);
26224 OS << "\"" << getMessage() << "\"";
26225 if (!IsFirstArgument)
26226 OS << ")";
26227 OS << "))";
26228 break;
26229 }
26230 case 1 : {
26231 OS << "[[clang::no_specializations";
26232 DelimitAttributeArgument(OS, IsFirstArgument);
26233 OS << "\"" << getMessage() << "\"";
26234 if (!IsFirstArgument)
26235 OS << ")";
26236 OS << "]]";
26237 break;
26238 }
26239 }
26240 }
26241
26242 const char *NoSpecializationsAttr::getSpelling() const {
26243 switch (getAttributeSpellingListIndex()) {
26244 default:
26245 llvm_unreachable("Unknown attribute spelling!");
26246 return "(No spelling)";
26247 case 0:
26248 return "no_specializations";
26249 case 1:
26250 return "no_specializations";
26251 }
26252 }
26253
26254
26255 // NoSpeculativeLoadHardeningAttr implementation
26256
26257 NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26258 auto *A = new (Ctx) NoSpeculativeLoadHardeningAttr(Ctx, CommonInfo);
26259 A->setImplicit(true);
26260 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26261 A->setAttributeSpellingListIndex(0);
26262 return A;
26263 }
26264
26265 NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26266 auto *A = new (Ctx) NoSpeculativeLoadHardeningAttr(Ctx, CommonInfo);
26267 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26268 A->setAttributeSpellingListIndex(0);
26269 return A;
26270 }
26271
26272 NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
26273 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26274 switch (S) {
26275 case GNU_no_speculative_load_hardening:
26276 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26277 case CXX11_clang_no_speculative_load_hardening:
26278 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26279 case C23_clang_no_speculative_load_hardening:
26280 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26281 default:
26282 llvm_unreachable("Unknown attribute spelling!");
26283 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26284 }
26285 }());
26286 return CreateImplicit(Ctx, I);
26287 }
26288
26289 NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
26290 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26291 switch (S) {
26292 case GNU_no_speculative_load_hardening:
26293 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26294 case CXX11_clang_no_speculative_load_hardening:
26295 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26296 case C23_clang_no_speculative_load_hardening:
26297 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26298 default:
26299 llvm_unreachable("Unknown attribute spelling!");
26300 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26301 }
26302 }());
26303 return Create(Ctx, I);
26304 }
26305
26306 NoSpeculativeLoadHardeningAttr::NoSpeculativeLoadHardeningAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26307 )
26308 : InheritableAttr(Ctx, CommonInfo, attr::NoSpeculativeLoadHardening, /*IsLateParsed=*/false, false)
26309 {
26310 }
26311
26312 NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::clone(ASTContext &C) const {
26313 auto *A = new (C) NoSpeculativeLoadHardeningAttr(C, *this);
26314 A->Inherited = Inherited;
26315 A->IsPackExpansion = IsPackExpansion;
26316 A->setImplicit(Implicit);
26317 return A;
26318 }
26319
26320 void NoSpeculativeLoadHardeningAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
26321 bool IsFirstArgument = true; (void)IsFirstArgument;
26322 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
26323 switch (getAttributeSpellingListIndex()) {
26324 default:
26325 llvm_unreachable("Unknown attribute spelling!");
26326 break;
26327 case 0 : {
26328 OS << "__attribute__((no_speculative_load_hardening";
26329 OS << "))";
26330 break;
26331 }
26332 case 1 : {
26333 OS << "[[clang::no_speculative_load_hardening";
26334 OS << "]]";
26335 break;
26336 }
26337 case 2 : {
26338 OS << "[[clang::no_speculative_load_hardening";
26339 OS << "]]";
26340 break;
26341 }
26342 }
26343 }
26344
26345 const char *NoSpeculativeLoadHardeningAttr::getSpelling() const {
26346 switch (getAttributeSpellingListIndex()) {
26347 default:
26348 llvm_unreachable("Unknown attribute spelling!");
26349 return "(No spelling)";
26350 case 0:
26351 return "no_speculative_load_hardening";
26352 case 1:
26353 return "no_speculative_load_hardening";
26354 case 2:
26355 return "no_speculative_load_hardening";
26356 }
26357 }
26358
26359
26360 // NoSplitStackAttr implementation
26361
26362 NoSplitStackAttr *NoSplitStackAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26363 auto *A = new (Ctx) NoSplitStackAttr(Ctx, CommonInfo);
26364 A->setImplicit(true);
26365 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26366 A->setAttributeSpellingListIndex(0);
26367 return A;
26368 }
26369
26370 NoSplitStackAttr *NoSplitStackAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26371 auto *A = new (Ctx) NoSplitStackAttr(Ctx, CommonInfo);
26372 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26373 A->setAttributeSpellingListIndex(0);
26374 return A;
26375 }
26376
26377 NoSplitStackAttr *NoSplitStackAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
26378 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26379 switch (S) {
26380 case GNU_no_split_stack:
26381 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26382 case CXX11_gnu_no_split_stack:
26383 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26384 case C23_gnu_no_split_stack:
26385 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26386 default:
26387 llvm_unreachable("Unknown attribute spelling!");
26388 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26389 }
26390 }());
26391 return CreateImplicit(Ctx, I);
26392 }
26393
26394 NoSplitStackAttr *NoSplitStackAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
26395 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26396 switch (S) {
26397 case GNU_no_split_stack:
26398 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26399 case CXX11_gnu_no_split_stack:
26400 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26401 case C23_gnu_no_split_stack:
26402 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26403 default:
26404 llvm_unreachable("Unknown attribute spelling!");
26405 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26406 }
26407 }());
26408 return Create(Ctx, I);
26409 }
26410
26411 NoSplitStackAttr::NoSplitStackAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26412 )
26413 : InheritableAttr(Ctx, CommonInfo, attr::NoSplitStack, /*IsLateParsed=*/false, false)
26414 {
26415 }
26416
26417 NoSplitStackAttr *NoSplitStackAttr::clone(ASTContext &C) const {
26418 auto *A = new (C) NoSplitStackAttr(C, *this);
26419 A->Inherited = Inherited;
26420 A->IsPackExpansion = IsPackExpansion;
26421 A->setImplicit(Implicit);
26422 return A;
26423 }
26424
26425 void NoSplitStackAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
26426 bool IsFirstArgument = true; (void)IsFirstArgument;
26427 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
26428 switch (getAttributeSpellingListIndex()) {
26429 default:
26430 llvm_unreachable("Unknown attribute spelling!");
26431 break;
26432 case 0 : {
26433 OS << "__attribute__((no_split_stack";
26434 OS << "))";
26435 break;
26436 }
26437 case 1 : {
26438 OS << "[[gnu::no_split_stack";
26439 OS << "]]";
26440 break;
26441 }
26442 case 2 : {
26443 OS << "[[gnu::no_split_stack";
26444 OS << "]]";
26445 break;
26446 }
26447 }
26448 }
26449
26450 const char *NoSplitStackAttr::getSpelling() const {
26451 switch (getAttributeSpellingListIndex()) {
26452 default:
26453 llvm_unreachable("Unknown attribute spelling!");
26454 return "(No spelling)";
26455 case 0:
26456 return "no_split_stack";
26457 case 1:
26458 return "no_split_stack";
26459 case 2:
26460 return "no_split_stack";
26461 }
26462 }
26463
26464
26465 // NoStackProtectorAttr implementation
26466
26467 NoStackProtectorAttr *NoStackProtectorAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26468 auto *A = new (Ctx) NoStackProtectorAttr(Ctx, CommonInfo);
26469 A->setImplicit(true);
26470 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26471 A->setAttributeSpellingListIndex(0);
26472 return A;
26473 }
26474
26475 NoStackProtectorAttr *NoStackProtectorAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26476 auto *A = new (Ctx) NoStackProtectorAttr(Ctx, CommonInfo);
26477 return A;
26478 }
26479
26480 NoStackProtectorAttr *NoStackProtectorAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
26481 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26482 switch (S) {
26483 case GNU_no_stack_protector:
26484 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26485 case CXX11_clang_no_stack_protector:
26486 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26487 case C23_clang_no_stack_protector:
26488 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26489 case CXX11_gnu_no_stack_protector:
26490 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26491 case C23_gnu_no_stack_protector:
26492 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26493 case Declspec_safebuffers:
26494 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_safebuffers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26495 default:
26496 llvm_unreachable("Unknown attribute spelling!");
26497 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26498 }
26499 }());
26500 return CreateImplicit(Ctx, I);
26501 }
26502
26503 NoStackProtectorAttr *NoStackProtectorAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
26504 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26505 switch (S) {
26506 case GNU_no_stack_protector:
26507 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26508 case CXX11_clang_no_stack_protector:
26509 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26510 case C23_clang_no_stack_protector:
26511 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26512 case CXX11_gnu_no_stack_protector:
26513 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26514 case C23_gnu_no_stack_protector:
26515 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26516 case Declspec_safebuffers:
26517 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_safebuffers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26518 default:
26519 llvm_unreachable("Unknown attribute spelling!");
26520 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26521 }
26522 }());
26523 return Create(Ctx, I);
26524 }
26525
26526 NoStackProtectorAttr::NoStackProtectorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26527 )
26528 : InheritableAttr(Ctx, CommonInfo, attr::NoStackProtector, /*IsLateParsed=*/false, false)
26529 {
26530 }
26531
26532 NoStackProtectorAttr::Spelling NoStackProtectorAttr::getSemanticSpelling() const {
26533 switch (getAttributeSpellingListIndex()) {
26534 default: llvm_unreachable("Unknown spelling list index");
26535 case 0: return GNU_no_stack_protector;
26536 case 1: return CXX11_clang_no_stack_protector;
26537 case 2: return C23_clang_no_stack_protector;
26538 case 3: return CXX11_gnu_no_stack_protector;
26539 case 4: return C23_gnu_no_stack_protector;
26540 case 5: return Declspec_safebuffers;
26541 }
26542 }
26543 NoStackProtectorAttr *NoStackProtectorAttr::clone(ASTContext &C) const {
26544 auto *A = new (C) NoStackProtectorAttr(C, *this);
26545 A->Inherited = Inherited;
26546 A->IsPackExpansion = IsPackExpansion;
26547 A->setImplicit(Implicit);
26548 return A;
26549 }
26550
26551 void NoStackProtectorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
26552 bool IsFirstArgument = true; (void)IsFirstArgument;
26553 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
26554 switch (getAttributeSpellingListIndex()) {
26555 default:
26556 llvm_unreachable("Unknown attribute spelling!");
26557 break;
26558 case 0 : {
26559 OS << "__attribute__((no_stack_protector";
26560 OS << "))";
26561 break;
26562 }
26563 case 1 : {
26564 OS << "[[clang::no_stack_protector";
26565 OS << "]]";
26566 break;
26567 }
26568 case 2 : {
26569 OS << "[[clang::no_stack_protector";
26570 OS << "]]";
26571 break;
26572 }
26573 case 3 : {
26574 OS << "[[gnu::no_stack_protector";
26575 OS << "]]";
26576 break;
26577 }
26578 case 4 : {
26579 OS << "[[gnu::no_stack_protector";
26580 OS << "]]";
26581 break;
26582 }
26583 case 5 : {
26584 OS << "__declspec(safebuffers";
26585 OS << ")";
26586 break;
26587 }
26588 }
26589 }
26590
26591 const char *NoStackProtectorAttr::getSpelling() const {
26592 switch (getAttributeSpellingListIndex()) {
26593 default:
26594 llvm_unreachable("Unknown attribute spelling!");
26595 return "(No spelling)";
26596 case 0:
26597 return "no_stack_protector";
26598 case 1:
26599 return "no_stack_protector";
26600 case 2:
26601 return "no_stack_protector";
26602 case 3:
26603 return "no_stack_protector";
26604 case 4:
26605 return "no_stack_protector";
26606 case 5:
26607 return "safebuffers";
26608 }
26609 }
26610
26611
26612 // NoThreadSafetyAnalysisAttr implementation
26613
26614 NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26615 auto *A = new (Ctx) NoThreadSafetyAnalysisAttr(Ctx, CommonInfo);
26616 A->setImplicit(true);
26617 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26618 A->setAttributeSpellingListIndex(0);
26619 return A;
26620 }
26621
26622 NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26623 auto *A = new (Ctx) NoThreadSafetyAnalysisAttr(Ctx, CommonInfo);
26624 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26625 A->setAttributeSpellingListIndex(0);
26626 return A;
26627 }
26628
26629 NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
26630 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26631 switch (S) {
26632 case GNU_no_thread_safety_analysis:
26633 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26634 case CXX11_clang_no_thread_safety_analysis:
26635 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26636 case C23_clang_no_thread_safety_analysis:
26637 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26638 default:
26639 llvm_unreachable("Unknown attribute spelling!");
26640 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26641 }
26642 }());
26643 return CreateImplicit(Ctx, I);
26644 }
26645
26646 NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
26647 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26648 switch (S) {
26649 case GNU_no_thread_safety_analysis:
26650 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26651 case CXX11_clang_no_thread_safety_analysis:
26652 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26653 case C23_clang_no_thread_safety_analysis:
26654 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26655 default:
26656 llvm_unreachable("Unknown attribute spelling!");
26657 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26658 }
26659 }());
26660 return Create(Ctx, I);
26661 }
26662
26663 NoThreadSafetyAnalysisAttr::NoThreadSafetyAnalysisAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26664 )
26665 : InheritableAttr(Ctx, CommonInfo, attr::NoThreadSafetyAnalysis, /*IsLateParsed=*/false, false)
26666 {
26667 }
26668
26669 NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::clone(ASTContext &C) const {
26670 auto *A = new (C) NoThreadSafetyAnalysisAttr(C, *this);
26671 A->Inherited = Inherited;
26672 A->IsPackExpansion = IsPackExpansion;
26673 A->setImplicit(Implicit);
26674 return A;
26675 }
26676
26677 void NoThreadSafetyAnalysisAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
26678 bool IsFirstArgument = true; (void)IsFirstArgument;
26679 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
26680 switch (getAttributeSpellingListIndex()) {
26681 default:
26682 llvm_unreachable("Unknown attribute spelling!");
26683 break;
26684 case 0 : {
26685 OS << "__attribute__((no_thread_safety_analysis";
26686 OS << "))";
26687 break;
26688 }
26689 case 1 : {
26690 OS << "[[clang::no_thread_safety_analysis";
26691 OS << "]]";
26692 break;
26693 }
26694 case 2 : {
26695 OS << "[[clang::no_thread_safety_analysis";
26696 OS << "]]";
26697 break;
26698 }
26699 }
26700 }
26701
26702 const char *NoThreadSafetyAnalysisAttr::getSpelling() const {
26703 switch (getAttributeSpellingListIndex()) {
26704 default:
26705 llvm_unreachable("Unknown attribute spelling!");
26706 return "(No spelling)";
26707 case 0:
26708 return "no_thread_safety_analysis";
26709 case 1:
26710 return "no_thread_safety_analysis";
26711 case 2:
26712 return "no_thread_safety_analysis";
26713 }
26714 }
26715
26716
26717 // NoThrowAttr implementation
26718
26719 NoThrowAttr *NoThrowAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26720 auto *A = new (Ctx) NoThrowAttr(Ctx, CommonInfo);
26721 A->setImplicit(true);
26722 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26723 A->setAttributeSpellingListIndex(0);
26724 return A;
26725 }
26726
26727 NoThrowAttr *NoThrowAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26728 auto *A = new (Ctx) NoThrowAttr(Ctx, CommonInfo);
26729 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26730 A->setAttributeSpellingListIndex(0);
26731 return A;
26732 }
26733
26734 NoThrowAttr *NoThrowAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
26735 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26736 switch (S) {
26737 case GNU_nothrow:
26738 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26739 case CXX11_gnu_nothrow:
26740 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26741 case C23_gnu_nothrow:
26742 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26743 case Declspec_nothrow:
26744 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26745 default:
26746 llvm_unreachable("Unknown attribute spelling!");
26747 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26748 }
26749 }());
26750 return CreateImplicit(Ctx, I);
26751 }
26752
26753 NoThrowAttr *NoThrowAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
26754 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26755 switch (S) {
26756 case GNU_nothrow:
26757 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26758 case CXX11_gnu_nothrow:
26759 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26760 case C23_gnu_nothrow:
26761 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26762 case Declspec_nothrow:
26763 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26764 default:
26765 llvm_unreachable("Unknown attribute spelling!");
26766 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26767 }
26768 }());
26769 return Create(Ctx, I);
26770 }
26771
26772 NoThrowAttr::NoThrowAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26773 )
26774 : InheritableAttr(Ctx, CommonInfo, attr::NoThrow, /*IsLateParsed=*/false, false)
26775 {
26776 }
26777
26778 NoThrowAttr *NoThrowAttr::clone(ASTContext &C) const {
26779 auto *A = new (C) NoThrowAttr(C, *this);
26780 A->Inherited = Inherited;
26781 A->IsPackExpansion = IsPackExpansion;
26782 A->setImplicit(Implicit);
26783 return A;
26784 }
26785
26786 void NoThrowAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
26787 bool IsFirstArgument = true; (void)IsFirstArgument;
26788 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
26789 switch (getAttributeSpellingListIndex()) {
26790 default:
26791 llvm_unreachable("Unknown attribute spelling!");
26792 break;
26793 case 0 : {
26794 OS << "__attribute__((nothrow";
26795 OS << "))";
26796 break;
26797 }
26798 case 1 : {
26799 OS << "[[gnu::nothrow";
26800 OS << "]]";
26801 break;
26802 }
26803 case 2 : {
26804 OS << "[[gnu::nothrow";
26805 OS << "]]";
26806 break;
26807 }
26808 case 3 : {
26809 OS << "__declspec(nothrow";
26810 OS << ")";
26811 break;
26812 }
26813 }
26814 }
26815
26816 const char *NoThrowAttr::getSpelling() const {
26817 switch (getAttributeSpellingListIndex()) {
26818 default:
26819 llvm_unreachable("Unknown attribute spelling!");
26820 return "(No spelling)";
26821 case 0:
26822 return "nothrow";
26823 case 1:
26824 return "nothrow";
26825 case 2:
26826 return "nothrow";
26827 case 3:
26828 return "nothrow";
26829 }
26830 }
26831
26832
26833 // NoTrivialAutoVarInitAttr implementation
26834
26835 NoTrivialAutoVarInitAttr *NoTrivialAutoVarInitAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26836 auto *A = new (Ctx) NoTrivialAutoVarInitAttr(Ctx, CommonInfo);
26837 A->setImplicit(true);
26838 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26839 A->setAttributeSpellingListIndex(0);
26840 return A;
26841 }
26842
26843 NoTrivialAutoVarInitAttr *NoTrivialAutoVarInitAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26844 auto *A = new (Ctx) NoTrivialAutoVarInitAttr(Ctx, CommonInfo);
26845 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26846 A->setAttributeSpellingListIndex(0);
26847 return A;
26848 }
26849
26850 NoTrivialAutoVarInitAttr *NoTrivialAutoVarInitAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
26851 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
26852 return CreateImplicit(Ctx, I);
26853 }
26854
26855 NoTrivialAutoVarInitAttr *NoTrivialAutoVarInitAttr::Create(ASTContext &Ctx, SourceRange Range) {
26856 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
26857 return Create(Ctx, I);
26858 }
26859
26860 NoTrivialAutoVarInitAttr::NoTrivialAutoVarInitAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26861 )
26862 : InheritableAttr(Ctx, CommonInfo, attr::NoTrivialAutoVarInit, /*IsLateParsed=*/false, false)
26863 {
26864 }
26865
26866 NoTrivialAutoVarInitAttr *NoTrivialAutoVarInitAttr::clone(ASTContext &C) const {
26867 auto *A = new (C) NoTrivialAutoVarInitAttr(C, *this);
26868 A->Inherited = Inherited;
26869 A->IsPackExpansion = IsPackExpansion;
26870 A->setImplicit(Implicit);
26871 return A;
26872 }
26873
26874 void NoTrivialAutoVarInitAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
26875 bool IsFirstArgument = true; (void)IsFirstArgument;
26876 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
26877 switch (getAttributeSpellingListIndex()) {
26878 default:
26879 llvm_unreachable("Unknown attribute spelling!");
26880 break;
26881 case 0 : {
26882 OS << "__declspec(no_init_all";
26883 OS << ")";
26884 break;
26885 }
26886 }
26887 }
26888
26889 const char *NoTrivialAutoVarInitAttr::getSpelling() const {
26890 switch (getAttributeSpellingListIndex()) {
26891 default:
26892 llvm_unreachable("Unknown attribute spelling!");
26893 return "(No spelling)";
26894 case 0:
26895 return "no_init_all";
26896 }
26897 }
26898
26899
26900 // NoUniqueAddressAttr implementation
26901
26902 NoUniqueAddressAttr *NoUniqueAddressAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26903 auto *A = new (Ctx) NoUniqueAddressAttr(Ctx, CommonInfo);
26904 A->setImplicit(true);
26905 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26906 A->setAttributeSpellingListIndex(0);
26907 return A;
26908 }
26909
26910 NoUniqueAddressAttr *NoUniqueAddressAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26911 auto *A = new (Ctx) NoUniqueAddressAttr(Ctx, CommonInfo);
26912 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
26913 A->setAttributeSpellingListIndex(0);
26914 return A;
26915 }
26916
26917 NoUniqueAddressAttr *NoUniqueAddressAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
26918 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26919 switch (S) {
26920 case CXX11_no_unique_address:
26921 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_no_unique_address, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26922 case CXX11_msvc_no_unique_address:
26923 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_msvc_no_unique_address, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26924 default:
26925 llvm_unreachable("Unknown attribute spelling!");
26926 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26927 }
26928 }());
26929 return CreateImplicit(Ctx, I);
26930 }
26931
26932 NoUniqueAddressAttr *NoUniqueAddressAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
26933 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
26934 switch (S) {
26935 case CXX11_no_unique_address:
26936 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_no_unique_address, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26937 case CXX11_msvc_no_unique_address:
26938 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_msvc_no_unique_address, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26939 default:
26940 llvm_unreachable("Unknown attribute spelling!");
26941 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
26942 }
26943 }());
26944 return Create(Ctx, I);
26945 }
26946
26947 NoUniqueAddressAttr::NoUniqueAddressAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
26948 )
26949 : InheritableAttr(Ctx, CommonInfo, attr::NoUniqueAddress, /*IsLateParsed=*/false, false)
26950 {
26951 }
26952
26953 NoUniqueAddressAttr *NoUniqueAddressAttr::clone(ASTContext &C) const {
26954 auto *A = new (C) NoUniqueAddressAttr(C, *this);
26955 A->Inherited = Inherited;
26956 A->IsPackExpansion = IsPackExpansion;
26957 A->setImplicit(Implicit);
26958 return A;
26959 }
26960
26961 void NoUniqueAddressAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
26962 bool IsFirstArgument = true; (void)IsFirstArgument;
26963 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
26964 switch (getAttributeSpellingListIndex()) {
26965 default:
26966 llvm_unreachable("Unknown attribute spelling!");
26967 break;
26968 case 0 : {
26969 OS << "[[no_unique_address";
26970 OS << "]]";
26971 break;
26972 }
26973 case 1 : {
26974 OS << "[[msvc::no_unique_address";
26975 OS << "]]";
26976 break;
26977 }
26978 }
26979 }
26980
26981 const char *NoUniqueAddressAttr::getSpelling() const {
26982 switch (getAttributeSpellingListIndex()) {
26983 default:
26984 llvm_unreachable("Unknown attribute spelling!");
26985 return "(No spelling)";
26986 case 0:
26987 return "no_unique_address";
26988 case 1:
26989 return "no_unique_address";
26990 }
26991 }
26992
26993
26994 // NoUwtableAttr implementation
26995
26996 NoUwtableAttr *NoUwtableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
26997 auto *A = new (Ctx) NoUwtableAttr(Ctx, CommonInfo);
26998 A->setImplicit(true);
26999 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27000 A->setAttributeSpellingListIndex(0);
27001 return A;
27002 }
27003
27004 NoUwtableAttr *NoUwtableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
27005 auto *A = new (Ctx) NoUwtableAttr(Ctx, CommonInfo);
27006 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27007 A->setAttributeSpellingListIndex(0);
27008 return A;
27009 }
27010
27011 NoUwtableAttr *NoUwtableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
27012 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27013 switch (S) {
27014 case GNU_nouwtable:
27015 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27016 case CXX11_clang_nouwtable:
27017 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27018 case C23_clang_nouwtable:
27019 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27020 default:
27021 llvm_unreachable("Unknown attribute spelling!");
27022 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27023 }
27024 }());
27025 return CreateImplicit(Ctx, I);
27026 }
27027
27028 NoUwtableAttr *NoUwtableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
27029 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27030 switch (S) {
27031 case GNU_nouwtable:
27032 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27033 case CXX11_clang_nouwtable:
27034 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27035 case C23_clang_nouwtable:
27036 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27037 default:
27038 llvm_unreachable("Unknown attribute spelling!");
27039 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27040 }
27041 }());
27042 return Create(Ctx, I);
27043 }
27044
27045 NoUwtableAttr::NoUwtableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27046 )
27047 : InheritableAttr(Ctx, CommonInfo, attr::NoUwtable, /*IsLateParsed=*/false, false)
27048 {
27049 }
27050
27051 NoUwtableAttr *NoUwtableAttr::clone(ASTContext &C) const {
27052 auto *A = new (C) NoUwtableAttr(C, *this);
27053 A->Inherited = Inherited;
27054 A->IsPackExpansion = IsPackExpansion;
27055 A->setImplicit(Implicit);
27056 return A;
27057 }
27058
27059 void NoUwtableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
27060 bool IsFirstArgument = true; (void)IsFirstArgument;
27061 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
27062 switch (getAttributeSpellingListIndex()) {
27063 default:
27064 llvm_unreachable("Unknown attribute spelling!");
27065 break;
27066 case 0 : {
27067 OS << "__attribute__((nouwtable";
27068 OS << "))";
27069 break;
27070 }
27071 case 1 : {
27072 OS << "[[clang::nouwtable";
27073 OS << "]]";
27074 break;
27075 }
27076 case 2 : {
27077 OS << "[[clang::nouwtable";
27078 OS << "]]";
27079 break;
27080 }
27081 }
27082 }
27083
27084 const char *NoUwtableAttr::getSpelling() const {
27085 switch (getAttributeSpellingListIndex()) {
27086 default:
27087 llvm_unreachable("Unknown attribute spelling!");
27088 return "(No spelling)";
27089 case 0:
27090 return "nouwtable";
27091 case 1:
27092 return "nouwtable";
27093 case 2:
27094 return "nouwtable";
27095 }
27096 }
27097
27098
27099 // NonAllocatingAttr implementation
27100
27101 NonAllocatingAttr *NonAllocatingAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, const AttributeCommonInfo &CommonInfo) {
27102 auto *A = new (Ctx) NonAllocatingAttr(Ctx, CommonInfo, Cond);
27103 A->setImplicit(true);
27104 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27105 A->setAttributeSpellingListIndex(0);
27106 return A;
27107 }
27108
27109 NonAllocatingAttr *NonAllocatingAttr::Create(ASTContext &Ctx, Expr * Cond, const AttributeCommonInfo &CommonInfo) {
27110 auto *A = new (Ctx) NonAllocatingAttr(Ctx, CommonInfo, Cond);
27111 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27112 A->setAttributeSpellingListIndex(0);
27113 return A;
27114 }
27115
27116 NonAllocatingAttr *NonAllocatingAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, SourceRange Range, Spelling S) {
27117 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27118 switch (S) {
27119 case GNU_nonallocating:
27120 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27121 case CXX11_clang_nonallocating:
27122 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27123 case C23_clang_nonallocating:
27124 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27125 default:
27126 llvm_unreachable("Unknown attribute spelling!");
27127 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27128 }
27129 }());
27130 return CreateImplicit(Ctx, Cond, I);
27131 }
27132
27133 NonAllocatingAttr *NonAllocatingAttr::Create(ASTContext &Ctx, Expr * Cond, SourceRange Range, Spelling S) {
27134 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27135 switch (S) {
27136 case GNU_nonallocating:
27137 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27138 case CXX11_clang_nonallocating:
27139 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27140 case C23_clang_nonallocating:
27141 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27142 default:
27143 llvm_unreachable("Unknown attribute spelling!");
27144 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27145 }
27146 }());
27147 return Create(Ctx, Cond, I);
27148 }
27149
27150 NonAllocatingAttr::NonAllocatingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27151 , Expr * Cond
27152 )
27153 : TypeAttr(Ctx, CommonInfo, attr::NonAllocating, /*IsLateParsed=*/false)
27154 , cond(Cond)
27155 {
27156 }
27157
27158 NonAllocatingAttr::NonAllocatingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27159 )
27160 : TypeAttr(Ctx, CommonInfo, attr::NonAllocating, /*IsLateParsed=*/false)
27161 , cond()
27162 {
27163 }
27164
27165
27166
27167 NonAllocatingAttr *NonAllocatingAttr::clone(ASTContext &C) const {
27168 auto *A = new (C) NonAllocatingAttr(C, *this, cond);
27169 A->Inherited = Inherited;
27170 A->IsPackExpansion = IsPackExpansion;
27171 A->setImplicit(Implicit);
27172 return A;
27173 }
27174
27175 void NonAllocatingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
27176 bool IsFirstArgument = true; (void)IsFirstArgument;
27177 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
27178 switch (getAttributeSpellingListIndex()) {
27179 default:
27180 llvm_unreachable("Unknown attribute spelling!");
27181 break;
27182 case 0 : {
27183 OS << "__attribute__((nonallocating";
27184 if (!getCond())
27185 ++TrailingOmittedArgs;
27186 if (!(!getCond())) {
27187 DelimitAttributeArgument(OS, IsFirstArgument);
27188 OS << "";
27189 getCond()->printPretty(OS, nullptr, Policy);
27190 OS << "";
27191 }
27192 if (!IsFirstArgument)
27193 OS << ")";
27194 OS << "))";
27195 break;
27196 }
27197 case 1 : {
27198 OS << "[[clang::nonallocating";
27199 if (!getCond())
27200 ++TrailingOmittedArgs;
27201 if (!(!getCond())) {
27202 DelimitAttributeArgument(OS, IsFirstArgument);
27203 OS << "";
27204 getCond()->printPretty(OS, nullptr, Policy);
27205 OS << "";
27206 }
27207 if (!IsFirstArgument)
27208 OS << ")";
27209 OS << "]]";
27210 break;
27211 }
27212 case 2 : {
27213 OS << "[[clang::nonallocating";
27214 if (!getCond())
27215 ++TrailingOmittedArgs;
27216 if (!(!getCond())) {
27217 DelimitAttributeArgument(OS, IsFirstArgument);
27218 OS << "";
27219 getCond()->printPretty(OS, nullptr, Policy);
27220 OS << "";
27221 }
27222 if (!IsFirstArgument)
27223 OS << ")";
27224 OS << "]]";
27225 break;
27226 }
27227 }
27228 }
27229
27230 const char *NonAllocatingAttr::getSpelling() const {
27231 switch (getAttributeSpellingListIndex()) {
27232 default:
27233 llvm_unreachable("Unknown attribute spelling!");
27234 return "(No spelling)";
27235 case 0:
27236 return "nonallocating";
27237 case 1:
27238 return "nonallocating";
27239 case 2:
27240 return "nonallocating";
27241 }
27242 }
27243
27244
27245 // NonBlockingAttr implementation
27246
27247 NonBlockingAttr *NonBlockingAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, const AttributeCommonInfo &CommonInfo) {
27248 auto *A = new (Ctx) NonBlockingAttr(Ctx, CommonInfo, Cond);
27249 A->setImplicit(true);
27250 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27251 A->setAttributeSpellingListIndex(0);
27252 return A;
27253 }
27254
27255 NonBlockingAttr *NonBlockingAttr::Create(ASTContext &Ctx, Expr * Cond, const AttributeCommonInfo &CommonInfo) {
27256 auto *A = new (Ctx) NonBlockingAttr(Ctx, CommonInfo, Cond);
27257 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27258 A->setAttributeSpellingListIndex(0);
27259 return A;
27260 }
27261
27262 NonBlockingAttr *NonBlockingAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, SourceRange Range, Spelling S) {
27263 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27264 switch (S) {
27265 case GNU_nonblocking:
27266 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27267 case CXX11_clang_nonblocking:
27268 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27269 case C23_clang_nonblocking:
27270 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27271 default:
27272 llvm_unreachable("Unknown attribute spelling!");
27273 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27274 }
27275 }());
27276 return CreateImplicit(Ctx, Cond, I);
27277 }
27278
27279 NonBlockingAttr *NonBlockingAttr::Create(ASTContext &Ctx, Expr * Cond, SourceRange Range, Spelling S) {
27280 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27281 switch (S) {
27282 case GNU_nonblocking:
27283 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27284 case CXX11_clang_nonblocking:
27285 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27286 case C23_clang_nonblocking:
27287 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27288 default:
27289 llvm_unreachable("Unknown attribute spelling!");
27290 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27291 }
27292 }());
27293 return Create(Ctx, Cond, I);
27294 }
27295
27296 NonBlockingAttr::NonBlockingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27297 , Expr * Cond
27298 )
27299 : TypeAttr(Ctx, CommonInfo, attr::NonBlocking, /*IsLateParsed=*/false)
27300 , cond(Cond)
27301 {
27302 }
27303
27304 NonBlockingAttr::NonBlockingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27305 )
27306 : TypeAttr(Ctx, CommonInfo, attr::NonBlocking, /*IsLateParsed=*/false)
27307 , cond()
27308 {
27309 }
27310
27311
27312
27313 NonBlockingAttr *NonBlockingAttr::clone(ASTContext &C) const {
27314 auto *A = new (C) NonBlockingAttr(C, *this, cond);
27315 A->Inherited = Inherited;
27316 A->IsPackExpansion = IsPackExpansion;
27317 A->setImplicit(Implicit);
27318 return A;
27319 }
27320
27321 void NonBlockingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
27322 bool IsFirstArgument = true; (void)IsFirstArgument;
27323 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
27324 switch (getAttributeSpellingListIndex()) {
27325 default:
27326 llvm_unreachable("Unknown attribute spelling!");
27327 break;
27328 case 0 : {
27329 OS << "__attribute__((nonblocking";
27330 if (!getCond())
27331 ++TrailingOmittedArgs;
27332 if (!(!getCond())) {
27333 DelimitAttributeArgument(OS, IsFirstArgument);
27334 OS << "";
27335 getCond()->printPretty(OS, nullptr, Policy);
27336 OS << "";
27337 }
27338 if (!IsFirstArgument)
27339 OS << ")";
27340 OS << "))";
27341 break;
27342 }
27343 case 1 : {
27344 OS << "[[clang::nonblocking";
27345 if (!getCond())
27346 ++TrailingOmittedArgs;
27347 if (!(!getCond())) {
27348 DelimitAttributeArgument(OS, IsFirstArgument);
27349 OS << "";
27350 getCond()->printPretty(OS, nullptr, Policy);
27351 OS << "";
27352 }
27353 if (!IsFirstArgument)
27354 OS << ")";
27355 OS << "]]";
27356 break;
27357 }
27358 case 2 : {
27359 OS << "[[clang::nonblocking";
27360 if (!getCond())
27361 ++TrailingOmittedArgs;
27362 if (!(!getCond())) {
27363 DelimitAttributeArgument(OS, IsFirstArgument);
27364 OS << "";
27365 getCond()->printPretty(OS, nullptr, Policy);
27366 OS << "";
27367 }
27368 if (!IsFirstArgument)
27369 OS << ")";
27370 OS << "]]";
27371 break;
27372 }
27373 }
27374 }
27375
27376 const char *NonBlockingAttr::getSpelling() const {
27377 switch (getAttributeSpellingListIndex()) {
27378 default:
27379 llvm_unreachable("Unknown attribute spelling!");
27380 return "(No spelling)";
27381 case 0:
27382 return "nonblocking";
27383 case 1:
27384 return "nonblocking";
27385 case 2:
27386 return "nonblocking";
27387 }
27388 }
27389
27390
27391 // NonNullAttr implementation
27392
27393 NonNullAttr *NonNullAttr::CreateImplicit(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
27394 auto *A = new (Ctx) NonNullAttr(Ctx, CommonInfo, Args, ArgsSize);
27395 A->setImplicit(true);
27396 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27397 A->setAttributeSpellingListIndex(0);
27398 return A;
27399 }
27400
27401 NonNullAttr *NonNullAttr::Create(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
27402 auto *A = new (Ctx) NonNullAttr(Ctx, CommonInfo, Args, ArgsSize);
27403 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27404 A->setAttributeSpellingListIndex(0);
27405 return A;
27406 }
27407
27408 NonNullAttr *NonNullAttr::CreateImplicit(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
27409 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27410 switch (S) {
27411 case GNU_nonnull:
27412 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27413 case CXX11_gnu_nonnull:
27414 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27415 case C23_gnu_nonnull:
27416 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27417 default:
27418 llvm_unreachable("Unknown attribute spelling!");
27419 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27420 }
27421 }());
27422 return CreateImplicit(Ctx, Args, ArgsSize, I);
27423 }
27424
27425 NonNullAttr *NonNullAttr::Create(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
27426 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27427 switch (S) {
27428 case GNU_nonnull:
27429 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27430 case CXX11_gnu_nonnull:
27431 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27432 case C23_gnu_nonnull:
27433 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27434 default:
27435 llvm_unreachable("Unknown attribute spelling!");
27436 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27437 }
27438 }());
27439 return Create(Ctx, Args, ArgsSize, I);
27440 }
27441
27442 NonNullAttr::NonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27443 , ParamIdx *Args, unsigned ArgsSize
27444 )
27445 : InheritableParamAttr(Ctx, CommonInfo, attr::NonNull, /*IsLateParsed=*/false, true)
27446 , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size])
27447 {
27448 std::copy(Args, Args + args_Size, args_);
27449 }
27450
27451 NonNullAttr::NonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27452 )
27453 : InheritableParamAttr(Ctx, CommonInfo, attr::NonNull, /*IsLateParsed=*/false, true)
27454 , args_Size(0), args_(nullptr)
27455 {
27456 }
27457
27458
27459
27460 NonNullAttr *NonNullAttr::clone(ASTContext &C) const {
27461 auto *A = new (C) NonNullAttr(C, *this, args_, args_Size);
27462 A->Inherited = Inherited;
27463 A->IsPackExpansion = IsPackExpansion;
27464 A->setImplicit(Implicit);
27465 return A;
27466 }
27467
27468 void NonNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
27469 bool IsFirstArgument = true; (void)IsFirstArgument;
27470 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
27471 switch (getAttributeSpellingListIndex()) {
27472 default:
27473 llvm_unreachable("Unknown attribute spelling!");
27474 break;
27475 case 0 : {
27476 OS << "__attribute__((nonnull";
27477 OS << "";
27478 for (const auto &Val : args()) {
27479 DelimitAttributeArgument(OS, IsFirstArgument);
27480 OS << Val.getSourceIndex();
27481 }
27482 OS << "";
27483 if (!IsFirstArgument)
27484 OS << ")";
27485 OS << "))";
27486 break;
27487 }
27488 case 1 : {
27489 OS << "[[gnu::nonnull";
27490 OS << "";
27491 for (const auto &Val : args()) {
27492 DelimitAttributeArgument(OS, IsFirstArgument);
27493 OS << Val.getSourceIndex();
27494 }
27495 OS << "";
27496 if (!IsFirstArgument)
27497 OS << ")";
27498 OS << "]]";
27499 break;
27500 }
27501 case 2 : {
27502 OS << "[[gnu::nonnull";
27503 OS << "";
27504 for (const auto &Val : args()) {
27505 DelimitAttributeArgument(OS, IsFirstArgument);
27506 OS << Val.getSourceIndex();
27507 }
27508 OS << "";
27509 if (!IsFirstArgument)
27510 OS << ")";
27511 OS << "]]";
27512 break;
27513 }
27514 }
27515 }
27516
27517 const char *NonNullAttr::getSpelling() const {
27518 switch (getAttributeSpellingListIndex()) {
27519 default:
27520 llvm_unreachable("Unknown attribute spelling!");
27521 return "(No spelling)";
27522 case 0:
27523 return "nonnull";
27524 case 1:
27525 return "nonnull";
27526 case 2:
27527 return "nonnull";
27528 }
27529 }
27530
27531
27532 // NotTailCalledAttr implementation
27533
27534 NotTailCalledAttr *NotTailCalledAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
27535 auto *A = new (Ctx) NotTailCalledAttr(Ctx, CommonInfo);
27536 A->setImplicit(true);
27537 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27538 A->setAttributeSpellingListIndex(0);
27539 return A;
27540 }
27541
27542 NotTailCalledAttr *NotTailCalledAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
27543 auto *A = new (Ctx) NotTailCalledAttr(Ctx, CommonInfo);
27544 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27545 A->setAttributeSpellingListIndex(0);
27546 return A;
27547 }
27548
27549 NotTailCalledAttr *NotTailCalledAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
27550 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27551 switch (S) {
27552 case GNU_not_tail_called:
27553 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27554 case CXX11_clang_not_tail_called:
27555 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27556 case C23_clang_not_tail_called:
27557 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27558 default:
27559 llvm_unreachable("Unknown attribute spelling!");
27560 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27561 }
27562 }());
27563 return CreateImplicit(Ctx, I);
27564 }
27565
27566 NotTailCalledAttr *NotTailCalledAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
27567 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
27568 switch (S) {
27569 case GNU_not_tail_called:
27570 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27571 case CXX11_clang_not_tail_called:
27572 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27573 case C23_clang_not_tail_called:
27574 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27575 default:
27576 llvm_unreachable("Unknown attribute spelling!");
27577 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
27578 }
27579 }());
27580 return Create(Ctx, I);
27581 }
27582
27583 NotTailCalledAttr::NotTailCalledAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27584 )
27585 : InheritableAttr(Ctx, CommonInfo, attr::NotTailCalled, /*IsLateParsed=*/false, false)
27586 {
27587 }
27588
27589 NotTailCalledAttr *NotTailCalledAttr::clone(ASTContext &C) const {
27590 auto *A = new (C) NotTailCalledAttr(C, *this);
27591 A->Inherited = Inherited;
27592 A->IsPackExpansion = IsPackExpansion;
27593 A->setImplicit(Implicit);
27594 return A;
27595 }
27596
27597 void NotTailCalledAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
27598 bool IsFirstArgument = true; (void)IsFirstArgument;
27599 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
27600 switch (getAttributeSpellingListIndex()) {
27601 default:
27602 llvm_unreachable("Unknown attribute spelling!");
27603 break;
27604 case 0 : {
27605 OS << "__attribute__((not_tail_called";
27606 OS << "))";
27607 break;
27608 }
27609 case 1 : {
27610 OS << "[[clang::not_tail_called";
27611 OS << "]]";
27612 break;
27613 }
27614 case 2 : {
27615 OS << "[[clang::not_tail_called";
27616 OS << "]]";
27617 break;
27618 }
27619 }
27620 }
27621
27622 const char *NotTailCalledAttr::getSpelling() const {
27623 switch (getAttributeSpellingListIndex()) {
27624 default:
27625 llvm_unreachable("Unknown attribute spelling!");
27626 return "(No spelling)";
27627 case 0:
27628 return "not_tail_called";
27629 case 1:
27630 return "not_tail_called";
27631 case 2:
27632 return "not_tail_called";
27633 }
27634 }
27635
27636
27637 // OMPAllocateDeclAttr implementation
27638
27639 OMPAllocateDeclAttr *OMPAllocateDeclAttr::CreateImplicit(ASTContext &Ctx, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, const AttributeCommonInfo &CommonInfo) {
27640 auto *A = new (Ctx) OMPAllocateDeclAttr(Ctx, CommonInfo, AllocatorType, Allocator, Alignment);
27641 A->setImplicit(true);
27642 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27643 A->setAttributeSpellingListIndex(0);
27644 return A;
27645 }
27646
27647 OMPAllocateDeclAttr *OMPAllocateDeclAttr::Create(ASTContext &Ctx, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, const AttributeCommonInfo &CommonInfo) {
27648 auto *A = new (Ctx) OMPAllocateDeclAttr(Ctx, CommonInfo, AllocatorType, Allocator, Alignment);
27649 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27650 A->setAttributeSpellingListIndex(0);
27651 return A;
27652 }
27653
27654 OMPAllocateDeclAttr *OMPAllocateDeclAttr::CreateImplicit(ASTContext &Ctx, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, SourceRange Range) {
27655 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
27656 return CreateImplicit(Ctx, AllocatorType, Allocator, Alignment, I);
27657 }
27658
27659 OMPAllocateDeclAttr *OMPAllocateDeclAttr::Create(ASTContext &Ctx, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, SourceRange Range) {
27660 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
27661 return Create(Ctx, AllocatorType, Allocator, Alignment, I);
27662 }
27663
27664 OMPAllocateDeclAttr::OMPAllocateDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27665 , OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType
27666 , Expr * Allocator
27667 , Expr * Alignment
27668 )
27669 : InheritableAttr(Ctx, CommonInfo, attr::OMPAllocateDecl, /*IsLateParsed=*/false, false)
27670 , allocatorType(AllocatorType)
27671 , allocator(Allocator)
27672 , alignment(Alignment)
27673 {
27674 }
27675
27676
27677
27678 bool OMPAllocateDeclAttr::ConvertStrToAllocatorTypeTy(StringRef Val, OMPAllocateDeclAttr::AllocatorTypeTy &Out) {
27679 std::optional<OMPAllocateDeclAttr::AllocatorTypeTy> R = llvm::StringSwitch<std::optional<OMPAllocateDeclAttr::AllocatorTypeTy>>(Val)
27680 .Case("omp_null_allocator", OMPAllocateDeclAttr::AllocatorTypeTy::OMPNullMemAlloc)
27681 .Case("omp_default_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPDefaultMemAlloc)
27682 .Case("omp_large_cap_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPLargeCapMemAlloc)
27683 .Case("omp_const_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPConstMemAlloc)
27684 .Case("omp_high_bw_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPHighBWMemAlloc)
27685 .Case("omp_low_lat_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPLowLatMemAlloc)
27686 .Case("omp_cgroup_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPCGroupMemAlloc)
27687 .Case("omp_pteam_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPPTeamMemAlloc)
27688 .Case("omp_thread_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPThreadMemAlloc)
27689 .Case("", OMPAllocateDeclAttr::AllocatorTypeTy::OMPUserDefinedMemAlloc)
27690 .Default(std::optional<OMPAllocateDeclAttr::AllocatorTypeTy>());
27691 if (R) {
27692 Out = *R;
27693 return true;
27694 }
27695 return false;
27696 }
27697
27698 const char *OMPAllocateDeclAttr::ConvertAllocatorTypeTyToStr(OMPAllocateDeclAttr::AllocatorTypeTy Val) {
27699 switch(Val) {
27700 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPNullMemAlloc: return "omp_null_allocator";
27701 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPDefaultMemAlloc: return "omp_default_mem_alloc";
27702 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPLargeCapMemAlloc: return "omp_large_cap_mem_alloc";
27703 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPConstMemAlloc: return "omp_const_mem_alloc";
27704 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPHighBWMemAlloc: return "omp_high_bw_mem_alloc";
27705 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPLowLatMemAlloc: return "omp_low_lat_mem_alloc";
27706 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPCGroupMemAlloc: return "omp_cgroup_mem_alloc";
27707 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPPTeamMemAlloc: return "omp_pteam_mem_alloc";
27708 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPThreadMemAlloc: return "omp_thread_mem_alloc";
27709 case OMPAllocateDeclAttr::AllocatorTypeTy::OMPUserDefinedMemAlloc: return "";
27710 }
27711 llvm_unreachable("No enumerator with that value");
27712 }
27713
27714
27715
27716
27717 OMPAllocateDeclAttr *OMPAllocateDeclAttr::clone(ASTContext &C) const {
27718 auto *A = new (C) OMPAllocateDeclAttr(C, *this, allocatorType, allocator, alignment);
27719 A->Inherited = Inherited;
27720 A->IsPackExpansion = IsPackExpansion;
27721 A->setImplicit(Implicit);
27722 return A;
27723 }
27724
27725 void OMPAllocateDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
27726 }
27727
27728 const char *OMPAllocateDeclAttr::getSpelling() const {
27729 return "(No spelling)";
27730 }
27731
27732
27733 // OMPAssumeAttr implementation
27734
27735 OMPAssumeAttr *OMPAssumeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Assumption, const AttributeCommonInfo &CommonInfo) {
27736 auto *A = new (Ctx) OMPAssumeAttr(Ctx, CommonInfo, Assumption);
27737 A->setImplicit(true);
27738 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27739 A->setAttributeSpellingListIndex(0);
27740 return A;
27741 }
27742
27743 OMPAssumeAttr *OMPAssumeAttr::Create(ASTContext &Ctx, llvm::StringRef Assumption, const AttributeCommonInfo &CommonInfo) {
27744 auto *A = new (Ctx) OMPAssumeAttr(Ctx, CommonInfo, Assumption);
27745 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27746 A->setAttributeSpellingListIndex(0);
27747 return A;
27748 }
27749
27750 OMPAssumeAttr *OMPAssumeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Assumption, SourceRange Range) {
27751 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
27752 return CreateImplicit(Ctx, Assumption, I);
27753 }
27754
27755 OMPAssumeAttr *OMPAssumeAttr::Create(ASTContext &Ctx, llvm::StringRef Assumption, SourceRange Range) {
27756 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
27757 return Create(Ctx, Assumption, I);
27758 }
27759
27760 OMPAssumeAttr::OMPAssumeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27761 , llvm::StringRef Assumption
27762 )
27763 : InheritableAttr(Ctx, CommonInfo, attr::OMPAssume, /*IsLateParsed=*/false, true)
27764 , assumptionLength(Assumption.size()),assumption(new (Ctx, 1) char[assumptionLength])
27765 {
27766 if (!Assumption.empty())
27767 std::memcpy(assumption, Assumption.data(), assumptionLength);
27768 }
27769
27770
27771
27772 OMPAssumeAttr *OMPAssumeAttr::clone(ASTContext &C) const {
27773 auto *A = new (C) OMPAssumeAttr(C, *this, getAssumption());
27774 A->Inherited = Inherited;
27775 A->IsPackExpansion = IsPackExpansion;
27776 A->setImplicit(Implicit);
27777 return A;
27778 }
27779
27780 void OMPAssumeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
27781 bool IsFirstArgument = true; (void)IsFirstArgument;
27782 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
27783 switch (getAttributeSpellingListIndex()) {
27784 default:
27785 llvm_unreachable("Unknown attribute spelling!");
27786 break;
27787 case 0 : {
27788 OS << "[[omp::assume";
27789 DelimitAttributeArgument(OS, IsFirstArgument);
27790 OS << "\"" << getAssumption() << "\"";
27791 if (!IsFirstArgument)
27792 OS << ")";
27793 OS << "]]";
27794 break;
27795 }
27796 }
27797 }
27798
27799 const char *OMPAssumeAttr::getSpelling() const {
27800 switch (getAttributeSpellingListIndex()) {
27801 default:
27802 llvm_unreachable("Unknown attribute spelling!");
27803 return "(No spelling)";
27804 case 0:
27805 return "assume";
27806 }
27807 }
27808
27809
27810 // OMPCaptureKindAttr implementation
27811
27812 OMPCaptureKindAttr *OMPCaptureKindAttr::CreateImplicit(ASTContext &Ctx, unsigned CaptureKindVal, const AttributeCommonInfo &CommonInfo) {
27813 auto *A = new (Ctx) OMPCaptureKindAttr(Ctx, CommonInfo, CaptureKindVal);
27814 A->setImplicit(true);
27815 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27816 A->setAttributeSpellingListIndex(0);
27817 return A;
27818 }
27819
27820 OMPCaptureKindAttr *OMPCaptureKindAttr::Create(ASTContext &Ctx, unsigned CaptureKindVal, const AttributeCommonInfo &CommonInfo) {
27821 auto *A = new (Ctx) OMPCaptureKindAttr(Ctx, CommonInfo, CaptureKindVal);
27822 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27823 A->setAttributeSpellingListIndex(0);
27824 return A;
27825 }
27826
27827 OMPCaptureKindAttr *OMPCaptureKindAttr::CreateImplicit(ASTContext &Ctx, unsigned CaptureKindVal, SourceRange Range) {
27828 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
27829 return CreateImplicit(Ctx, CaptureKindVal, I);
27830 }
27831
27832 OMPCaptureKindAttr *OMPCaptureKindAttr::Create(ASTContext &Ctx, unsigned CaptureKindVal, SourceRange Range) {
27833 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
27834 return Create(Ctx, CaptureKindVal, I);
27835 }
27836
27837 OMPCaptureKindAttr::OMPCaptureKindAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27838 , unsigned CaptureKindVal
27839 )
27840 : Attr(Ctx, CommonInfo, attr::OMPCaptureKind, /*IsLateParsed=*/false)
27841 , captureKindVal(CaptureKindVal)
27842 {
27843 }
27844
27845
27846
27847 OMPCaptureKindAttr *OMPCaptureKindAttr::clone(ASTContext &C) const {
27848 auto *A = new (C) OMPCaptureKindAttr(C, *this, captureKindVal);
27849 A->Inherited = Inherited;
27850 A->IsPackExpansion = IsPackExpansion;
27851 A->setImplicit(Implicit);
27852 return A;
27853 }
27854
27855 void OMPCaptureKindAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
27856 }
27857
27858 const char *OMPCaptureKindAttr::getSpelling() const {
27859 return "(No spelling)";
27860 }
27861
27862
27863 // OMPCaptureNoInitAttr implementation
27864
27865 OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
27866 auto *A = new (Ctx) OMPCaptureNoInitAttr(Ctx, CommonInfo);
27867 A->setImplicit(true);
27868 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27869 A->setAttributeSpellingListIndex(0);
27870 return A;
27871 }
27872
27873 OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
27874 auto *A = new (Ctx) OMPCaptureNoInitAttr(Ctx, CommonInfo);
27875 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27876 A->setAttributeSpellingListIndex(0);
27877 return A;
27878 }
27879
27880 OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
27881 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
27882 return CreateImplicit(Ctx, I);
27883 }
27884
27885 OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::Create(ASTContext &Ctx, SourceRange Range) {
27886 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
27887 return Create(Ctx, I);
27888 }
27889
27890 OMPCaptureNoInitAttr::OMPCaptureNoInitAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27891 )
27892 : InheritableAttr(Ctx, CommonInfo, attr::OMPCaptureNoInit, /*IsLateParsed=*/false, false)
27893 {
27894 }
27895
27896 OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::clone(ASTContext &C) const {
27897 auto *A = new (C) OMPCaptureNoInitAttr(C, *this);
27898 A->Inherited = Inherited;
27899 A->IsPackExpansion = IsPackExpansion;
27900 A->setImplicit(Implicit);
27901 return A;
27902 }
27903
27904 void OMPCaptureNoInitAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
27905 }
27906
27907 const char *OMPCaptureNoInitAttr::getSpelling() const {
27908 return "(No spelling)";
27909 }
27910
27911
27912 // OMPDeclareSimdDeclAttr implementation
27913
27914 OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::CreateImplicit(ASTContext &Ctx, OMPDeclareSimdDeclAttr::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) {
27915 auto *A = new (Ctx) OMPDeclareSimdDeclAttr(Ctx, CommonInfo, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize);
27916 A->setImplicit(true);
27917 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27918 A->setAttributeSpellingListIndex(0);
27919 return A;
27920 }
27921
27922 OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::Create(ASTContext &Ctx, OMPDeclareSimdDeclAttr::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) {
27923 auto *A = new (Ctx) OMPDeclareSimdDeclAttr(Ctx, CommonInfo, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize);
27924 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
27925 A->setAttributeSpellingListIndex(0);
27926 return A;
27927 }
27928
27929 OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::CreateImplicit(ASTContext &Ctx, OMPDeclareSimdDeclAttr::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) {
27930 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
27931 return CreateImplicit(Ctx, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize, I);
27932 }
27933
27934 OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::Create(ASTContext &Ctx, OMPDeclareSimdDeclAttr::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) {
27935 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
27936 return Create(Ctx, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize, I);
27937 }
27938
27939 OMPDeclareSimdDeclAttr::OMPDeclareSimdDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27940 , OMPDeclareSimdDeclAttr::BranchStateTy BranchState
27941 , Expr * Simdlen
27942 , Expr * *Uniforms, unsigned UniformsSize
27943 , Expr * *Aligneds, unsigned AlignedsSize
27944 , Expr * *Alignments, unsigned AlignmentsSize
27945 , Expr * *Linears, unsigned LinearsSize
27946 , unsigned *Modifiers, unsigned ModifiersSize
27947 , Expr * *Steps, unsigned StepsSize
27948 )
27949 : Attr(Ctx, CommonInfo, attr::OMPDeclareSimdDecl, /*IsLateParsed=*/false)
27950 , branchState(BranchState)
27951 , simdlen(Simdlen)
27952 , uniforms_Size(UniformsSize), uniforms_(new (Ctx, 16) Expr *[uniforms_Size])
27953 , aligneds_Size(AlignedsSize), aligneds_(new (Ctx, 16) Expr *[aligneds_Size])
27954 , alignments_Size(AlignmentsSize), alignments_(new (Ctx, 16) Expr *[alignments_Size])
27955 , linears_Size(LinearsSize), linears_(new (Ctx, 16) Expr *[linears_Size])
27956 , modifiers_Size(ModifiersSize), modifiers_(new (Ctx, 16) unsigned[modifiers_Size])
27957 , steps_Size(StepsSize), steps_(new (Ctx, 16) Expr *[steps_Size])
27958 {
27959 std::copy(Uniforms, Uniforms + uniforms_Size, uniforms_);
27960 std::copy(Aligneds, Aligneds + aligneds_Size, aligneds_);
27961 std::copy(Alignments, Alignments + alignments_Size, alignments_);
27962 std::copy(Linears, Linears + linears_Size, linears_);
27963 std::copy(Modifiers, Modifiers + modifiers_Size, modifiers_);
27964 std::copy(Steps, Steps + steps_Size, steps_);
27965 }
27966
27967 OMPDeclareSimdDeclAttr::OMPDeclareSimdDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
27968 , OMPDeclareSimdDeclAttr::BranchStateTy BranchState
27969 , Expr * Simdlen
27970 )
27971 : Attr(Ctx, CommonInfo, attr::OMPDeclareSimdDecl, /*IsLateParsed=*/false)
27972 , branchState(BranchState)
27973 , simdlen(Simdlen)
27974 , uniforms_Size(0), uniforms_(nullptr)
27975 , aligneds_Size(0), aligneds_(nullptr)
27976 , alignments_Size(0), alignments_(nullptr)
27977 , linears_Size(0), linears_(nullptr)
27978 , modifiers_Size(0), modifiers_(nullptr)
27979 , steps_Size(0), steps_(nullptr)
27980 {
27981 }
27982
27983
27984
27985 bool OMPDeclareSimdDeclAttr::ConvertStrToBranchStateTy(StringRef Val, OMPDeclareSimdDeclAttr::BranchStateTy &Out) {
27986 std::optional<OMPDeclareSimdDeclAttr::BranchStateTy> R = llvm::StringSwitch<std::optional<OMPDeclareSimdDeclAttr::BranchStateTy>>(Val)
27987 .Case("", OMPDeclareSimdDeclAttr::BranchStateTy::BS_Undefined)
27988 .Case("inbranch", OMPDeclareSimdDeclAttr::BranchStateTy::BS_Inbranch)
27989 .Case("notinbranch", OMPDeclareSimdDeclAttr::BranchStateTy::BS_Notinbranch)
27990 .Default(std::optional<OMPDeclareSimdDeclAttr::BranchStateTy>());
27991 if (R) {
27992 Out = *R;
27993 return true;
27994 }
27995 return false;
27996 }
27997
27998 const char *OMPDeclareSimdDeclAttr::ConvertBranchStateTyToStr(OMPDeclareSimdDeclAttr::BranchStateTy Val) {
27999 switch(Val) {
28000 case OMPDeclareSimdDeclAttr::BranchStateTy::BS_Undefined: return "";
28001 case OMPDeclareSimdDeclAttr::BranchStateTy::BS_Inbranch: return "inbranch";
28002 case OMPDeclareSimdDeclAttr::BranchStateTy::BS_Notinbranch: return "notinbranch";
28003 }
28004 llvm_unreachable("No enumerator with that value");
28005 }
28006
28007
28008
28009
28010
28011
28012
28013
28014
28015
28016
28017
28018
28019
28020 OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::clone(ASTContext &C) const {
28021 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);
28022 A->Inherited = Inherited;
28023 A->IsPackExpansion = IsPackExpansion;
28024 A->setImplicit(Implicit);
28025 return A;
28026 }
28027
28028 void OMPDeclareSimdDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28029 bool IsFirstArgument = true; (void)IsFirstArgument;
28030 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
28031 switch (getAttributeSpellingListIndex()) {
28032 default:
28033 llvm_unreachable("Unknown attribute spelling!");
28034 break;
28035 case 0 : {
28036 OS << "#pragma omp declare simd";
28037 printPrettyPragma(OS, Policy);
28038 OS << "\n"; break;
28039 }
28040 }
28041 }
28042
28043 const char *OMPDeclareSimdDeclAttr::getSpelling() const {
28044 switch (getAttributeSpellingListIndex()) {
28045 default:
28046 llvm_unreachable("Unknown attribute spelling!");
28047 return "(No spelling)";
28048 case 0:
28049 return "declare simd";
28050 }
28051 }
28052
28053
28054 // OMPDeclareTargetDeclAttr implementation
28055
28056 OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::CreateImplicit(ASTContext &Ctx, OMPDeclareTargetDeclAttr::MapTypeTy MapType, OMPDeclareTargetDeclAttr::DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, const AttributeCommonInfo &CommonInfo) {
28057 auto *A = new (Ctx) OMPDeclareTargetDeclAttr(Ctx, CommonInfo, MapType, DevType, IndirectExpr, Indirect, Level);
28058 A->setImplicit(true);
28059 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28060 A->setAttributeSpellingListIndex(0);
28061 return A;
28062 }
28063
28064 OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::Create(ASTContext &Ctx, OMPDeclareTargetDeclAttr::MapTypeTy MapType, OMPDeclareTargetDeclAttr::DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, const AttributeCommonInfo &CommonInfo) {
28065 auto *A = new (Ctx) OMPDeclareTargetDeclAttr(Ctx, CommonInfo, MapType, DevType, IndirectExpr, Indirect, Level);
28066 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28067 A->setAttributeSpellingListIndex(0);
28068 return A;
28069 }
28070
28071 OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::CreateImplicit(ASTContext &Ctx, OMPDeclareTargetDeclAttr::MapTypeTy MapType, OMPDeclareTargetDeclAttr::DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, SourceRange Range) {
28072 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
28073 return CreateImplicit(Ctx, MapType, DevType, IndirectExpr, Indirect, Level, I);
28074 }
28075
28076 OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::Create(ASTContext &Ctx, OMPDeclareTargetDeclAttr::MapTypeTy MapType, OMPDeclareTargetDeclAttr::DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, SourceRange Range) {
28077 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
28078 return Create(Ctx, MapType, DevType, IndirectExpr, Indirect, Level, I);
28079 }
28080
28081 OMPDeclareTargetDeclAttr::OMPDeclareTargetDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28082 , OMPDeclareTargetDeclAttr::MapTypeTy MapType
28083 , OMPDeclareTargetDeclAttr::DevTypeTy DevType
28084 , Expr * IndirectExpr
28085 , bool Indirect
28086 , unsigned Level
28087 )
28088 : InheritableAttr(Ctx, CommonInfo, attr::OMPDeclareTargetDecl, /*IsLateParsed=*/false, false)
28089 , mapType(MapType)
28090 , devType(DevType)
28091 , indirectExpr(IndirectExpr)
28092 , indirect(Indirect)
28093 , level(Level)
28094 {
28095 }
28096
28097
28098
28099 bool OMPDeclareTargetDeclAttr::ConvertStrToMapTypeTy(StringRef Val, OMPDeclareTargetDeclAttr::MapTypeTy &Out) {
28100 std::optional<OMPDeclareTargetDeclAttr::MapTypeTy> R = llvm::StringSwitch<std::optional<OMPDeclareTargetDeclAttr::MapTypeTy>>(Val)
28101 .Case("to", OMPDeclareTargetDeclAttr::MapTypeTy::MT_To)
28102 .Case("enter", OMPDeclareTargetDeclAttr::MapTypeTy::MT_Enter)
28103 .Case("link", OMPDeclareTargetDeclAttr::MapTypeTy::MT_Link)
28104 .Default(std::optional<OMPDeclareTargetDeclAttr::MapTypeTy>());
28105 if (R) {
28106 Out = *R;
28107 return true;
28108 }
28109 return false;
28110 }
28111
28112 const char *OMPDeclareTargetDeclAttr::ConvertMapTypeTyToStr(OMPDeclareTargetDeclAttr::MapTypeTy Val) {
28113 switch(Val) {
28114 case OMPDeclareTargetDeclAttr::MapTypeTy::MT_To: return "to";
28115 case OMPDeclareTargetDeclAttr::MapTypeTy::MT_Enter: return "enter";
28116 case OMPDeclareTargetDeclAttr::MapTypeTy::MT_Link: return "link";
28117 }
28118 llvm_unreachable("No enumerator with that value");
28119 }
28120
28121
28122 bool OMPDeclareTargetDeclAttr::ConvertStrToDevTypeTy(StringRef Val, OMPDeclareTargetDeclAttr::DevTypeTy &Out) {
28123 std::optional<OMPDeclareTargetDeclAttr::DevTypeTy> R = llvm::StringSwitch<std::optional<OMPDeclareTargetDeclAttr::DevTypeTy>>(Val)
28124 .Case("host", OMPDeclareTargetDeclAttr::DevTypeTy::DT_Host)
28125 .Case("nohost", OMPDeclareTargetDeclAttr::DevTypeTy::DT_NoHost)
28126 .Case("any", OMPDeclareTargetDeclAttr::DevTypeTy::DT_Any)
28127 .Default(std::optional<OMPDeclareTargetDeclAttr::DevTypeTy>());
28128 if (R) {
28129 Out = *R;
28130 return true;
28131 }
28132 return false;
28133 }
28134
28135 const char *OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(OMPDeclareTargetDeclAttr::DevTypeTy Val) {
28136 switch(Val) {
28137 case OMPDeclareTargetDeclAttr::DevTypeTy::DT_Host: return "host";
28138 case OMPDeclareTargetDeclAttr::DevTypeTy::DT_NoHost: return "nohost";
28139 case OMPDeclareTargetDeclAttr::DevTypeTy::DT_Any: return "any";
28140 }
28141 llvm_unreachable("No enumerator with that value");
28142 }
28143
28144
28145
28146
28147
28148
28149 OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::clone(ASTContext &C) const {
28150 auto *A = new (C) OMPDeclareTargetDeclAttr(C, *this, mapType, devType, indirectExpr, indirect, level);
28151 A->Inherited = Inherited;
28152 A->IsPackExpansion = IsPackExpansion;
28153 A->setImplicit(Implicit);
28154 return A;
28155 }
28156
28157 void OMPDeclareTargetDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28158 bool IsFirstArgument = true; (void)IsFirstArgument;
28159 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
28160 switch (getAttributeSpellingListIndex()) {
28161 default:
28162 llvm_unreachable("Unknown attribute spelling!");
28163 break;
28164 case 0 : {
28165 OS << "#pragma omp declare target";
28166 printPrettyPragma(OS, Policy);
28167 OS << "\n"; break;
28168 }
28169 }
28170 }
28171
28172 const char *OMPDeclareTargetDeclAttr::getSpelling() const {
28173 switch (getAttributeSpellingListIndex()) {
28174 default:
28175 llvm_unreachable("Unknown attribute spelling!");
28176 return "(No spelling)";
28177 case 0:
28178 return "declare target";
28179 }
28180 }
28181
28182
28183 // OMPDeclareVariantAttr implementation
28184
28185 OMPDeclareVariantAttr *OMPDeclareVariantAttr::CreateImplicit(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, const AttributeCommonInfo &CommonInfo) {
28186 auto *A = new (Ctx) OMPDeclareVariantAttr(Ctx, CommonInfo, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize);
28187 A->setImplicit(true);
28188 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28189 A->setAttributeSpellingListIndex(0);
28190 return A;
28191 }
28192
28193 OMPDeclareVariantAttr *OMPDeclareVariantAttr::Create(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, const AttributeCommonInfo &CommonInfo) {
28194 auto *A = new (Ctx) OMPDeclareVariantAttr(Ctx, CommonInfo, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize);
28195 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28196 A->setAttributeSpellingListIndex(0);
28197 return A;
28198 }
28199
28200 OMPDeclareVariantAttr *OMPDeclareVariantAttr::CreateImplicit(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, SourceRange Range) {
28201 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
28202 return CreateImplicit(Ctx, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize, I);
28203 }
28204
28205 OMPDeclareVariantAttr *OMPDeclareVariantAttr::Create(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, SourceRange Range) {
28206 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
28207 return Create(Ctx, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize, I);
28208 }
28209
28210 OMPDeclareVariantAttr::OMPDeclareVariantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28211 , Expr * VariantFuncRef
28212 , OMPTraitInfo * TraitInfos
28213 , Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize
28214 , Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize
28215 , OMPInteropInfo *AppendArgs, unsigned AppendArgsSize
28216 )
28217 : InheritableAttr(Ctx, CommonInfo, attr::OMPDeclareVariant, /*IsLateParsed=*/false, true)
28218 , variantFuncRef(VariantFuncRef)
28219 , traitInfos(TraitInfos)
28220 , adjustArgsNothing_Size(AdjustArgsNothingSize), adjustArgsNothing_(new (Ctx, 16) Expr *[adjustArgsNothing_Size])
28221 , adjustArgsNeedDevicePtr_Size(AdjustArgsNeedDevicePtrSize), adjustArgsNeedDevicePtr_(new (Ctx, 16) Expr *[adjustArgsNeedDevicePtr_Size])
28222 , appendArgs_Size(AppendArgsSize), appendArgs_(new (Ctx, 16) OMPInteropInfo[appendArgs_Size])
28223 {
28224 std::copy(AdjustArgsNothing, AdjustArgsNothing + adjustArgsNothing_Size, adjustArgsNothing_);
28225 std::copy(AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtr + adjustArgsNeedDevicePtr_Size, adjustArgsNeedDevicePtr_);
28226 std::copy(AppendArgs, AppendArgs + appendArgs_Size, appendArgs_);
28227 }
28228
28229 OMPDeclareVariantAttr::OMPDeclareVariantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28230 , Expr * VariantFuncRef
28231 , OMPTraitInfo * TraitInfos
28232 , OMPInteropInfo *AppendArgs, unsigned AppendArgsSize
28233 )
28234 : InheritableAttr(Ctx, CommonInfo, attr::OMPDeclareVariant, /*IsLateParsed=*/false, true)
28235 , variantFuncRef(VariantFuncRef)
28236 , traitInfos(TraitInfos)
28237 , adjustArgsNothing_Size(0), adjustArgsNothing_(nullptr)
28238 , adjustArgsNeedDevicePtr_Size(0), adjustArgsNeedDevicePtr_(nullptr)
28239 , appendArgs_Size(AppendArgsSize), appendArgs_(new (Ctx, 16) OMPInteropInfo[appendArgs_Size])
28240 {
28241 std::copy(AppendArgs, AppendArgs + appendArgs_Size, appendArgs_);
28242 }
28243
28244
28245
28246
28247
28248
28249
28250
28251
28252
28253
28254 OMPDeclareVariantAttr *OMPDeclareVariantAttr::clone(ASTContext &C) const {
28255 auto *A = new (C) OMPDeclareVariantAttr(C, *this, variantFuncRef, traitInfos, adjustArgsNothing_, adjustArgsNothing_Size, adjustArgsNeedDevicePtr_, adjustArgsNeedDevicePtr_Size, appendArgs_, appendArgs_Size);
28256 A->Inherited = Inherited;
28257 A->IsPackExpansion = IsPackExpansion;
28258 A->setImplicit(Implicit);
28259 return A;
28260 }
28261
28262 void OMPDeclareVariantAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28263 bool IsFirstArgument = true; (void)IsFirstArgument;
28264 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
28265 switch (getAttributeSpellingListIndex()) {
28266 default:
28267 llvm_unreachable("Unknown attribute spelling!");
28268 break;
28269 case 0 : {
28270 OS << "#pragma omp declare variant";
28271 printPrettyPragma(OS, Policy);
28272 OS << "\n"; break;
28273 }
28274 }
28275 }
28276
28277 const char *OMPDeclareVariantAttr::getSpelling() const {
28278 switch (getAttributeSpellingListIndex()) {
28279 default:
28280 llvm_unreachable("Unknown attribute spelling!");
28281 return "(No spelling)";
28282 case 0:
28283 return "declare variant";
28284 }
28285 }
28286
28287
28288 // OMPReferencedVarAttr implementation
28289
28290 OMPReferencedVarAttr *OMPReferencedVarAttr::CreateImplicit(ASTContext &Ctx, Expr * Ref, const AttributeCommonInfo &CommonInfo) {
28291 auto *A = new (Ctx) OMPReferencedVarAttr(Ctx, CommonInfo, Ref);
28292 A->setImplicit(true);
28293 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28294 A->setAttributeSpellingListIndex(0);
28295 return A;
28296 }
28297
28298 OMPReferencedVarAttr *OMPReferencedVarAttr::Create(ASTContext &Ctx, Expr * Ref, const AttributeCommonInfo &CommonInfo) {
28299 auto *A = new (Ctx) OMPReferencedVarAttr(Ctx, CommonInfo, Ref);
28300 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28301 A->setAttributeSpellingListIndex(0);
28302 return A;
28303 }
28304
28305 OMPReferencedVarAttr *OMPReferencedVarAttr::CreateImplicit(ASTContext &Ctx, Expr * Ref, SourceRange Range) {
28306 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
28307 return CreateImplicit(Ctx, Ref, I);
28308 }
28309
28310 OMPReferencedVarAttr *OMPReferencedVarAttr::Create(ASTContext &Ctx, Expr * Ref, SourceRange Range) {
28311 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
28312 return Create(Ctx, Ref, I);
28313 }
28314
28315 OMPReferencedVarAttr::OMPReferencedVarAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28316 , Expr * Ref
28317 )
28318 : Attr(Ctx, CommonInfo, attr::OMPReferencedVar, /*IsLateParsed=*/false)
28319 , ref(Ref)
28320 {
28321 }
28322
28323
28324
28325 OMPReferencedVarAttr *OMPReferencedVarAttr::clone(ASTContext &C) const {
28326 auto *A = new (C) OMPReferencedVarAttr(C, *this, ref);
28327 A->Inherited = Inherited;
28328 A->IsPackExpansion = IsPackExpansion;
28329 A->setImplicit(Implicit);
28330 return A;
28331 }
28332
28333 void OMPReferencedVarAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28334 }
28335
28336 const char *OMPReferencedVarAttr::getSpelling() const {
28337 return "(No spelling)";
28338 }
28339
28340
28341 // OMPThreadPrivateDeclAttr implementation
28342
28343 OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28344 auto *A = new (Ctx) OMPThreadPrivateDeclAttr(Ctx, CommonInfo);
28345 A->setImplicit(true);
28346 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28347 A->setAttributeSpellingListIndex(0);
28348 return A;
28349 }
28350
28351 OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28352 auto *A = new (Ctx) OMPThreadPrivateDeclAttr(Ctx, CommonInfo);
28353 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28354 A->setAttributeSpellingListIndex(0);
28355 return A;
28356 }
28357
28358 OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
28359 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
28360 return CreateImplicit(Ctx, I);
28361 }
28362
28363 OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::Create(ASTContext &Ctx, SourceRange Range) {
28364 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
28365 return Create(Ctx, I);
28366 }
28367
28368 OMPThreadPrivateDeclAttr::OMPThreadPrivateDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28369 )
28370 : InheritableAttr(Ctx, CommonInfo, attr::OMPThreadPrivateDecl, /*IsLateParsed=*/false, false)
28371 {
28372 }
28373
28374 OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::clone(ASTContext &C) const {
28375 auto *A = new (C) OMPThreadPrivateDeclAttr(C, *this);
28376 A->Inherited = Inherited;
28377 A->IsPackExpansion = IsPackExpansion;
28378 A->setImplicit(Implicit);
28379 return A;
28380 }
28381
28382 void OMPThreadPrivateDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28383 }
28384
28385 const char *OMPThreadPrivateDeclAttr::getSpelling() const {
28386 return "(No spelling)";
28387 }
28388
28389
28390 // OSConsumedAttr implementation
28391
28392 OSConsumedAttr *OSConsumedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28393 auto *A = new (Ctx) OSConsumedAttr(Ctx, CommonInfo);
28394 A->setImplicit(true);
28395 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28396 A->setAttributeSpellingListIndex(0);
28397 return A;
28398 }
28399
28400 OSConsumedAttr *OSConsumedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28401 auto *A = new (Ctx) OSConsumedAttr(Ctx, CommonInfo);
28402 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28403 A->setAttributeSpellingListIndex(0);
28404 return A;
28405 }
28406
28407 OSConsumedAttr *OSConsumedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
28408 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28409 switch (S) {
28410 case GNU_os_consumed:
28411 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28412 case CXX11_clang_os_consumed:
28413 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28414 case C23_clang_os_consumed:
28415 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28416 default:
28417 llvm_unreachable("Unknown attribute spelling!");
28418 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28419 }
28420 }());
28421 return CreateImplicit(Ctx, I);
28422 }
28423
28424 OSConsumedAttr *OSConsumedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
28425 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28426 switch (S) {
28427 case GNU_os_consumed:
28428 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28429 case CXX11_clang_os_consumed:
28430 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28431 case C23_clang_os_consumed:
28432 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28433 default:
28434 llvm_unreachable("Unknown attribute spelling!");
28435 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28436 }
28437 }());
28438 return Create(Ctx, I);
28439 }
28440
28441 OSConsumedAttr::OSConsumedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28442 )
28443 : InheritableParamAttr(Ctx, CommonInfo, attr::OSConsumed, /*IsLateParsed=*/false, false)
28444 {
28445 }
28446
28447 OSConsumedAttr *OSConsumedAttr::clone(ASTContext &C) const {
28448 auto *A = new (C) OSConsumedAttr(C, *this);
28449 A->Inherited = Inherited;
28450 A->IsPackExpansion = IsPackExpansion;
28451 A->setImplicit(Implicit);
28452 return A;
28453 }
28454
28455 void OSConsumedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28456 bool IsFirstArgument = true; (void)IsFirstArgument;
28457 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
28458 switch (getAttributeSpellingListIndex()) {
28459 default:
28460 llvm_unreachable("Unknown attribute spelling!");
28461 break;
28462 case 0 : {
28463 OS << "__attribute__((os_consumed";
28464 OS << "))";
28465 break;
28466 }
28467 case 1 : {
28468 OS << "[[clang::os_consumed";
28469 OS << "]]";
28470 break;
28471 }
28472 case 2 : {
28473 OS << "[[clang::os_consumed";
28474 OS << "]]";
28475 break;
28476 }
28477 }
28478 }
28479
28480 const char *OSConsumedAttr::getSpelling() const {
28481 switch (getAttributeSpellingListIndex()) {
28482 default:
28483 llvm_unreachable("Unknown attribute spelling!");
28484 return "(No spelling)";
28485 case 0:
28486 return "os_consumed";
28487 case 1:
28488 return "os_consumed";
28489 case 2:
28490 return "os_consumed";
28491 }
28492 }
28493
28494
28495 // OSConsumesThisAttr implementation
28496
28497 OSConsumesThisAttr *OSConsumesThisAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28498 auto *A = new (Ctx) OSConsumesThisAttr(Ctx, CommonInfo);
28499 A->setImplicit(true);
28500 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28501 A->setAttributeSpellingListIndex(0);
28502 return A;
28503 }
28504
28505 OSConsumesThisAttr *OSConsumesThisAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28506 auto *A = new (Ctx) OSConsumesThisAttr(Ctx, CommonInfo);
28507 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28508 A->setAttributeSpellingListIndex(0);
28509 return A;
28510 }
28511
28512 OSConsumesThisAttr *OSConsumesThisAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
28513 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28514 switch (S) {
28515 case GNU_os_consumes_this:
28516 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28517 case CXX11_clang_os_consumes_this:
28518 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28519 case C23_clang_os_consumes_this:
28520 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28521 default:
28522 llvm_unreachable("Unknown attribute spelling!");
28523 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28524 }
28525 }());
28526 return CreateImplicit(Ctx, I);
28527 }
28528
28529 OSConsumesThisAttr *OSConsumesThisAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
28530 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28531 switch (S) {
28532 case GNU_os_consumes_this:
28533 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28534 case CXX11_clang_os_consumes_this:
28535 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28536 case C23_clang_os_consumes_this:
28537 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28538 default:
28539 llvm_unreachable("Unknown attribute spelling!");
28540 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28541 }
28542 }());
28543 return Create(Ctx, I);
28544 }
28545
28546 OSConsumesThisAttr::OSConsumesThisAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28547 )
28548 : InheritableAttr(Ctx, CommonInfo, attr::OSConsumesThis, /*IsLateParsed=*/false, false)
28549 {
28550 }
28551
28552 OSConsumesThisAttr *OSConsumesThisAttr::clone(ASTContext &C) const {
28553 auto *A = new (C) OSConsumesThisAttr(C, *this);
28554 A->Inherited = Inherited;
28555 A->IsPackExpansion = IsPackExpansion;
28556 A->setImplicit(Implicit);
28557 return A;
28558 }
28559
28560 void OSConsumesThisAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28561 bool IsFirstArgument = true; (void)IsFirstArgument;
28562 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
28563 switch (getAttributeSpellingListIndex()) {
28564 default:
28565 llvm_unreachable("Unknown attribute spelling!");
28566 break;
28567 case 0 : {
28568 OS << "__attribute__((os_consumes_this";
28569 OS << "))";
28570 break;
28571 }
28572 case 1 : {
28573 OS << "[[clang::os_consumes_this";
28574 OS << "]]";
28575 break;
28576 }
28577 case 2 : {
28578 OS << "[[clang::os_consumes_this";
28579 OS << "]]";
28580 break;
28581 }
28582 }
28583 }
28584
28585 const char *OSConsumesThisAttr::getSpelling() const {
28586 switch (getAttributeSpellingListIndex()) {
28587 default:
28588 llvm_unreachable("Unknown attribute spelling!");
28589 return "(No spelling)";
28590 case 0:
28591 return "os_consumes_this";
28592 case 1:
28593 return "os_consumes_this";
28594 case 2:
28595 return "os_consumes_this";
28596 }
28597 }
28598
28599
28600 // OSReturnsNotRetainedAttr implementation
28601
28602 OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28603 auto *A = new (Ctx) OSReturnsNotRetainedAttr(Ctx, CommonInfo);
28604 A->setImplicit(true);
28605 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28606 A->setAttributeSpellingListIndex(0);
28607 return A;
28608 }
28609
28610 OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28611 auto *A = new (Ctx) OSReturnsNotRetainedAttr(Ctx, CommonInfo);
28612 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28613 A->setAttributeSpellingListIndex(0);
28614 return A;
28615 }
28616
28617 OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
28618 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28619 switch (S) {
28620 case GNU_os_returns_not_retained:
28621 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28622 case CXX11_clang_os_returns_not_retained:
28623 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28624 case C23_clang_os_returns_not_retained:
28625 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28626 default:
28627 llvm_unreachable("Unknown attribute spelling!");
28628 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28629 }
28630 }());
28631 return CreateImplicit(Ctx, I);
28632 }
28633
28634 OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
28635 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28636 switch (S) {
28637 case GNU_os_returns_not_retained:
28638 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28639 case CXX11_clang_os_returns_not_retained:
28640 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28641 case C23_clang_os_returns_not_retained:
28642 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28643 default:
28644 llvm_unreachable("Unknown attribute spelling!");
28645 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28646 }
28647 }());
28648 return Create(Ctx, I);
28649 }
28650
28651 OSReturnsNotRetainedAttr::OSReturnsNotRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28652 )
28653 : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsNotRetained, /*IsLateParsed=*/false, false)
28654 {
28655 }
28656
28657 OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::clone(ASTContext &C) const {
28658 auto *A = new (C) OSReturnsNotRetainedAttr(C, *this);
28659 A->Inherited = Inherited;
28660 A->IsPackExpansion = IsPackExpansion;
28661 A->setImplicit(Implicit);
28662 return A;
28663 }
28664
28665 void OSReturnsNotRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28666 bool IsFirstArgument = true; (void)IsFirstArgument;
28667 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
28668 switch (getAttributeSpellingListIndex()) {
28669 default:
28670 llvm_unreachable("Unknown attribute spelling!");
28671 break;
28672 case 0 : {
28673 OS << "__attribute__((os_returns_not_retained";
28674 OS << "))";
28675 break;
28676 }
28677 case 1 : {
28678 OS << "[[clang::os_returns_not_retained";
28679 OS << "]]";
28680 break;
28681 }
28682 case 2 : {
28683 OS << "[[clang::os_returns_not_retained";
28684 OS << "]]";
28685 break;
28686 }
28687 }
28688 }
28689
28690 const char *OSReturnsNotRetainedAttr::getSpelling() const {
28691 switch (getAttributeSpellingListIndex()) {
28692 default:
28693 llvm_unreachable("Unknown attribute spelling!");
28694 return "(No spelling)";
28695 case 0:
28696 return "os_returns_not_retained";
28697 case 1:
28698 return "os_returns_not_retained";
28699 case 2:
28700 return "os_returns_not_retained";
28701 }
28702 }
28703
28704
28705 // OSReturnsRetainedAttr implementation
28706
28707 OSReturnsRetainedAttr *OSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28708 auto *A = new (Ctx) OSReturnsRetainedAttr(Ctx, CommonInfo);
28709 A->setImplicit(true);
28710 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28711 A->setAttributeSpellingListIndex(0);
28712 return A;
28713 }
28714
28715 OSReturnsRetainedAttr *OSReturnsRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28716 auto *A = new (Ctx) OSReturnsRetainedAttr(Ctx, CommonInfo);
28717 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28718 A->setAttributeSpellingListIndex(0);
28719 return A;
28720 }
28721
28722 OSReturnsRetainedAttr *OSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
28723 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28724 switch (S) {
28725 case GNU_os_returns_retained:
28726 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28727 case CXX11_clang_os_returns_retained:
28728 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28729 case C23_clang_os_returns_retained:
28730 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28731 default:
28732 llvm_unreachable("Unknown attribute spelling!");
28733 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28734 }
28735 }());
28736 return CreateImplicit(Ctx, I);
28737 }
28738
28739 OSReturnsRetainedAttr *OSReturnsRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
28740 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28741 switch (S) {
28742 case GNU_os_returns_retained:
28743 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28744 case CXX11_clang_os_returns_retained:
28745 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28746 case C23_clang_os_returns_retained:
28747 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28748 default:
28749 llvm_unreachable("Unknown attribute spelling!");
28750 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28751 }
28752 }());
28753 return Create(Ctx, I);
28754 }
28755
28756 OSReturnsRetainedAttr::OSReturnsRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28757 )
28758 : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsRetained, /*IsLateParsed=*/false, false)
28759 {
28760 }
28761
28762 OSReturnsRetainedAttr *OSReturnsRetainedAttr::clone(ASTContext &C) const {
28763 auto *A = new (C) OSReturnsRetainedAttr(C, *this);
28764 A->Inherited = Inherited;
28765 A->IsPackExpansion = IsPackExpansion;
28766 A->setImplicit(Implicit);
28767 return A;
28768 }
28769
28770 void OSReturnsRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28771 bool IsFirstArgument = true; (void)IsFirstArgument;
28772 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
28773 switch (getAttributeSpellingListIndex()) {
28774 default:
28775 llvm_unreachable("Unknown attribute spelling!");
28776 break;
28777 case 0 : {
28778 OS << "__attribute__((os_returns_retained";
28779 OS << "))";
28780 break;
28781 }
28782 case 1 : {
28783 OS << "[[clang::os_returns_retained";
28784 OS << "]]";
28785 break;
28786 }
28787 case 2 : {
28788 OS << "[[clang::os_returns_retained";
28789 OS << "]]";
28790 break;
28791 }
28792 }
28793 }
28794
28795 const char *OSReturnsRetainedAttr::getSpelling() const {
28796 switch (getAttributeSpellingListIndex()) {
28797 default:
28798 llvm_unreachable("Unknown attribute spelling!");
28799 return "(No spelling)";
28800 case 0:
28801 return "os_returns_retained";
28802 case 1:
28803 return "os_returns_retained";
28804 case 2:
28805 return "os_returns_retained";
28806 }
28807 }
28808
28809
28810 // OSReturnsRetainedOnNonZeroAttr implementation
28811
28812 OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28813 auto *A = new (Ctx) OSReturnsRetainedOnNonZeroAttr(Ctx, CommonInfo);
28814 A->setImplicit(true);
28815 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28816 A->setAttributeSpellingListIndex(0);
28817 return A;
28818 }
28819
28820 OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28821 auto *A = new (Ctx) OSReturnsRetainedOnNonZeroAttr(Ctx, CommonInfo);
28822 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28823 A->setAttributeSpellingListIndex(0);
28824 return A;
28825 }
28826
28827 OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
28828 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28829 switch (S) {
28830 case GNU_os_returns_retained_on_non_zero:
28831 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28832 case CXX11_clang_os_returns_retained_on_non_zero:
28833 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28834 case C23_clang_os_returns_retained_on_non_zero:
28835 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28836 default:
28837 llvm_unreachable("Unknown attribute spelling!");
28838 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28839 }
28840 }());
28841 return CreateImplicit(Ctx, I);
28842 }
28843
28844 OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
28845 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28846 switch (S) {
28847 case GNU_os_returns_retained_on_non_zero:
28848 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28849 case CXX11_clang_os_returns_retained_on_non_zero:
28850 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28851 case C23_clang_os_returns_retained_on_non_zero:
28852 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28853 default:
28854 llvm_unreachable("Unknown attribute spelling!");
28855 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28856 }
28857 }());
28858 return Create(Ctx, I);
28859 }
28860
28861 OSReturnsRetainedOnNonZeroAttr::OSReturnsRetainedOnNonZeroAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28862 )
28863 : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsRetainedOnNonZero, /*IsLateParsed=*/false, false)
28864 {
28865 }
28866
28867 OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::clone(ASTContext &C) const {
28868 auto *A = new (C) OSReturnsRetainedOnNonZeroAttr(C, *this);
28869 A->Inherited = Inherited;
28870 A->IsPackExpansion = IsPackExpansion;
28871 A->setImplicit(Implicit);
28872 return A;
28873 }
28874
28875 void OSReturnsRetainedOnNonZeroAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28876 bool IsFirstArgument = true; (void)IsFirstArgument;
28877 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
28878 switch (getAttributeSpellingListIndex()) {
28879 default:
28880 llvm_unreachable("Unknown attribute spelling!");
28881 break;
28882 case 0 : {
28883 OS << "__attribute__((os_returns_retained_on_non_zero";
28884 OS << "))";
28885 break;
28886 }
28887 case 1 : {
28888 OS << "[[clang::os_returns_retained_on_non_zero";
28889 OS << "]]";
28890 break;
28891 }
28892 case 2 : {
28893 OS << "[[clang::os_returns_retained_on_non_zero";
28894 OS << "]]";
28895 break;
28896 }
28897 }
28898 }
28899
28900 const char *OSReturnsRetainedOnNonZeroAttr::getSpelling() const {
28901 switch (getAttributeSpellingListIndex()) {
28902 default:
28903 llvm_unreachable("Unknown attribute spelling!");
28904 return "(No spelling)";
28905 case 0:
28906 return "os_returns_retained_on_non_zero";
28907 case 1:
28908 return "os_returns_retained_on_non_zero";
28909 case 2:
28910 return "os_returns_retained_on_non_zero";
28911 }
28912 }
28913
28914
28915 // OSReturnsRetainedOnZeroAttr implementation
28916
28917 OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28918 auto *A = new (Ctx) OSReturnsRetainedOnZeroAttr(Ctx, CommonInfo);
28919 A->setImplicit(true);
28920 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28921 A->setAttributeSpellingListIndex(0);
28922 return A;
28923 }
28924
28925 OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
28926 auto *A = new (Ctx) OSReturnsRetainedOnZeroAttr(Ctx, CommonInfo);
28927 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
28928 A->setAttributeSpellingListIndex(0);
28929 return A;
28930 }
28931
28932 OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
28933 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28934 switch (S) {
28935 case GNU_os_returns_retained_on_zero:
28936 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28937 case CXX11_clang_os_returns_retained_on_zero:
28938 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28939 case C23_clang_os_returns_retained_on_zero:
28940 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28941 default:
28942 llvm_unreachable("Unknown attribute spelling!");
28943 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28944 }
28945 }());
28946 return CreateImplicit(Ctx, I);
28947 }
28948
28949 OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
28950 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
28951 switch (S) {
28952 case GNU_os_returns_retained_on_zero:
28953 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28954 case CXX11_clang_os_returns_retained_on_zero:
28955 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28956 case C23_clang_os_returns_retained_on_zero:
28957 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28958 default:
28959 llvm_unreachable("Unknown attribute spelling!");
28960 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
28961 }
28962 }());
28963 return Create(Ctx, I);
28964 }
28965
28966 OSReturnsRetainedOnZeroAttr::OSReturnsRetainedOnZeroAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
28967 )
28968 : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsRetainedOnZero, /*IsLateParsed=*/false, false)
28969 {
28970 }
28971
28972 OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::clone(ASTContext &C) const {
28973 auto *A = new (C) OSReturnsRetainedOnZeroAttr(C, *this);
28974 A->Inherited = Inherited;
28975 A->IsPackExpansion = IsPackExpansion;
28976 A->setImplicit(Implicit);
28977 return A;
28978 }
28979
28980 void OSReturnsRetainedOnZeroAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
28981 bool IsFirstArgument = true; (void)IsFirstArgument;
28982 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
28983 switch (getAttributeSpellingListIndex()) {
28984 default:
28985 llvm_unreachable("Unknown attribute spelling!");
28986 break;
28987 case 0 : {
28988 OS << "__attribute__((os_returns_retained_on_zero";
28989 OS << "))";
28990 break;
28991 }
28992 case 1 : {
28993 OS << "[[clang::os_returns_retained_on_zero";
28994 OS << "]]";
28995 break;
28996 }
28997 case 2 : {
28998 OS << "[[clang::os_returns_retained_on_zero";
28999 OS << "]]";
29000 break;
29001 }
29002 }
29003 }
29004
29005 const char *OSReturnsRetainedOnZeroAttr::getSpelling() const {
29006 switch (getAttributeSpellingListIndex()) {
29007 default:
29008 llvm_unreachable("Unknown attribute spelling!");
29009 return "(No spelling)";
29010 case 0:
29011 return "os_returns_retained_on_zero";
29012 case 1:
29013 return "os_returns_retained_on_zero";
29014 case 2:
29015 return "os_returns_retained_on_zero";
29016 }
29017 }
29018
29019
29020 // ObjCBoxableAttr implementation
29021
29022 ObjCBoxableAttr *ObjCBoxableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29023 auto *A = new (Ctx) ObjCBoxableAttr(Ctx, CommonInfo);
29024 A->setImplicit(true);
29025 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29026 A->setAttributeSpellingListIndex(0);
29027 return A;
29028 }
29029
29030 ObjCBoxableAttr *ObjCBoxableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29031 auto *A = new (Ctx) ObjCBoxableAttr(Ctx, CommonInfo);
29032 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29033 A->setAttributeSpellingListIndex(0);
29034 return A;
29035 }
29036
29037 ObjCBoxableAttr *ObjCBoxableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
29038 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29039 switch (S) {
29040 case GNU_objc_boxable:
29041 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29042 case CXX11_clang_objc_boxable:
29043 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29044 case C23_clang_objc_boxable:
29045 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29046 default:
29047 llvm_unreachable("Unknown attribute spelling!");
29048 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29049 }
29050 }());
29051 return CreateImplicit(Ctx, I);
29052 }
29053
29054 ObjCBoxableAttr *ObjCBoxableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
29055 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29056 switch (S) {
29057 case GNU_objc_boxable:
29058 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29059 case CXX11_clang_objc_boxable:
29060 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29061 case C23_clang_objc_boxable:
29062 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29063 default:
29064 llvm_unreachable("Unknown attribute spelling!");
29065 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29066 }
29067 }());
29068 return Create(Ctx, I);
29069 }
29070
29071 ObjCBoxableAttr::ObjCBoxableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
29072 )
29073 : Attr(Ctx, CommonInfo, attr::ObjCBoxable, /*IsLateParsed=*/false)
29074 {
29075 }
29076
29077 ObjCBoxableAttr *ObjCBoxableAttr::clone(ASTContext &C) const {
29078 auto *A = new (C) ObjCBoxableAttr(C, *this);
29079 A->Inherited = Inherited;
29080 A->IsPackExpansion = IsPackExpansion;
29081 A->setImplicit(Implicit);
29082 return A;
29083 }
29084
29085 void ObjCBoxableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
29086 bool IsFirstArgument = true; (void)IsFirstArgument;
29087 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
29088 switch (getAttributeSpellingListIndex()) {
29089 default:
29090 llvm_unreachable("Unknown attribute spelling!");
29091 break;
29092 case 0 : {
29093 OS << "__attribute__((objc_boxable";
29094 OS << "))";
29095 break;
29096 }
29097 case 1 : {
29098 OS << "[[clang::objc_boxable";
29099 OS << "]]";
29100 break;
29101 }
29102 case 2 : {
29103 OS << "[[clang::objc_boxable";
29104 OS << "]]";
29105 break;
29106 }
29107 }
29108 }
29109
29110 const char *ObjCBoxableAttr::getSpelling() const {
29111 switch (getAttributeSpellingListIndex()) {
29112 default:
29113 llvm_unreachable("Unknown attribute spelling!");
29114 return "(No spelling)";
29115 case 0:
29116 return "objc_boxable";
29117 case 1:
29118 return "objc_boxable";
29119 case 2:
29120 return "objc_boxable";
29121 }
29122 }
29123
29124
29125 // ObjCBridgeAttr implementation
29126
29127 ObjCBridgeAttr *ObjCBridgeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) {
29128 auto *A = new (Ctx) ObjCBridgeAttr(Ctx, CommonInfo, BridgedType);
29129 A->setImplicit(true);
29130 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29131 A->setAttributeSpellingListIndex(0);
29132 return A;
29133 }
29134
29135 ObjCBridgeAttr *ObjCBridgeAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) {
29136 auto *A = new (Ctx) ObjCBridgeAttr(Ctx, CommonInfo, BridgedType);
29137 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29138 A->setAttributeSpellingListIndex(0);
29139 return A;
29140 }
29141
29142 ObjCBridgeAttr *ObjCBridgeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, Spelling S) {
29143 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29144 switch (S) {
29145 case GNU_objc_bridge:
29146 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29147 case CXX11_clang_objc_bridge:
29148 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29149 case C23_clang_objc_bridge:
29150 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29151 default:
29152 llvm_unreachable("Unknown attribute spelling!");
29153 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29154 }
29155 }());
29156 return CreateImplicit(Ctx, BridgedType, I);
29157 }
29158
29159 ObjCBridgeAttr *ObjCBridgeAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, Spelling S) {
29160 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29161 switch (S) {
29162 case GNU_objc_bridge:
29163 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29164 case CXX11_clang_objc_bridge:
29165 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29166 case C23_clang_objc_bridge:
29167 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29168 default:
29169 llvm_unreachable("Unknown attribute spelling!");
29170 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29171 }
29172 }());
29173 return Create(Ctx, BridgedType, I);
29174 }
29175
29176 ObjCBridgeAttr::ObjCBridgeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
29177 , IdentifierInfo * BridgedType
29178 )
29179 : InheritableAttr(Ctx, CommonInfo, attr::ObjCBridge, /*IsLateParsed=*/false, false)
29180 , bridgedType(BridgedType)
29181 {
29182 }
29183
29184
29185
29186 ObjCBridgeAttr *ObjCBridgeAttr::clone(ASTContext &C) const {
29187 auto *A = new (C) ObjCBridgeAttr(C, *this, bridgedType);
29188 A->Inherited = Inherited;
29189 A->IsPackExpansion = IsPackExpansion;
29190 A->setImplicit(Implicit);
29191 return A;
29192 }
29193
29194 void ObjCBridgeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
29195 bool IsFirstArgument = true; (void)IsFirstArgument;
29196 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
29197 switch (getAttributeSpellingListIndex()) {
29198 default:
29199 llvm_unreachable("Unknown attribute spelling!");
29200 break;
29201 case 0 : {
29202 OS << "__attribute__((objc_bridge";
29203 DelimitAttributeArgument(OS, IsFirstArgument);
29204 OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << "";
29205 if (!IsFirstArgument)
29206 OS << ")";
29207 OS << "))";
29208 break;
29209 }
29210 case 1 : {
29211 OS << "[[clang::objc_bridge";
29212 DelimitAttributeArgument(OS, IsFirstArgument);
29213 OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << "";
29214 if (!IsFirstArgument)
29215 OS << ")";
29216 OS << "]]";
29217 break;
29218 }
29219 case 2 : {
29220 OS << "[[clang::objc_bridge";
29221 DelimitAttributeArgument(OS, IsFirstArgument);
29222 OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << "";
29223 if (!IsFirstArgument)
29224 OS << ")";
29225 OS << "]]";
29226 break;
29227 }
29228 }
29229 }
29230
29231 const char *ObjCBridgeAttr::getSpelling() const {
29232 switch (getAttributeSpellingListIndex()) {
29233 default:
29234 llvm_unreachable("Unknown attribute spelling!");
29235 return "(No spelling)";
29236 case 0:
29237 return "objc_bridge";
29238 case 1:
29239 return "objc_bridge";
29240 case 2:
29241 return "objc_bridge";
29242 }
29243 }
29244
29245
29246 // ObjCBridgeMutableAttr implementation
29247
29248 ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) {
29249 auto *A = new (Ctx) ObjCBridgeMutableAttr(Ctx, CommonInfo, BridgedType);
29250 A->setImplicit(true);
29251 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29252 A->setAttributeSpellingListIndex(0);
29253 return A;
29254 }
29255
29256 ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) {
29257 auto *A = new (Ctx) ObjCBridgeMutableAttr(Ctx, CommonInfo, BridgedType);
29258 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29259 A->setAttributeSpellingListIndex(0);
29260 return A;
29261 }
29262
29263 ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, Spelling S) {
29264 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29265 switch (S) {
29266 case GNU_objc_bridge_mutable:
29267 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29268 case CXX11_clang_objc_bridge_mutable:
29269 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29270 case C23_clang_objc_bridge_mutable:
29271 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29272 default:
29273 llvm_unreachable("Unknown attribute spelling!");
29274 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29275 }
29276 }());
29277 return CreateImplicit(Ctx, BridgedType, I);
29278 }
29279
29280 ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, Spelling S) {
29281 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29282 switch (S) {
29283 case GNU_objc_bridge_mutable:
29284 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29285 case CXX11_clang_objc_bridge_mutable:
29286 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29287 case C23_clang_objc_bridge_mutable:
29288 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29289 default:
29290 llvm_unreachable("Unknown attribute spelling!");
29291 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29292 }
29293 }());
29294 return Create(Ctx, BridgedType, I);
29295 }
29296
29297 ObjCBridgeMutableAttr::ObjCBridgeMutableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
29298 , IdentifierInfo * BridgedType
29299 )
29300 : InheritableAttr(Ctx, CommonInfo, attr::ObjCBridgeMutable, /*IsLateParsed=*/false, false)
29301 , bridgedType(BridgedType)
29302 {
29303 }
29304
29305
29306
29307 ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::clone(ASTContext &C) const {
29308 auto *A = new (C) ObjCBridgeMutableAttr(C, *this, bridgedType);
29309 A->Inherited = Inherited;
29310 A->IsPackExpansion = IsPackExpansion;
29311 A->setImplicit(Implicit);
29312 return A;
29313 }
29314
29315 void ObjCBridgeMutableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
29316 bool IsFirstArgument = true; (void)IsFirstArgument;
29317 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
29318 switch (getAttributeSpellingListIndex()) {
29319 default:
29320 llvm_unreachable("Unknown attribute spelling!");
29321 break;
29322 case 0 : {
29323 OS << "__attribute__((objc_bridge_mutable";
29324 DelimitAttributeArgument(OS, IsFirstArgument);
29325 OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << "";
29326 if (!IsFirstArgument)
29327 OS << ")";
29328 OS << "))";
29329 break;
29330 }
29331 case 1 : {
29332 OS << "[[clang::objc_bridge_mutable";
29333 DelimitAttributeArgument(OS, IsFirstArgument);
29334 OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << "";
29335 if (!IsFirstArgument)
29336 OS << ")";
29337 OS << "]]";
29338 break;
29339 }
29340 case 2 : {
29341 OS << "[[clang::objc_bridge_mutable";
29342 DelimitAttributeArgument(OS, IsFirstArgument);
29343 OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << "";
29344 if (!IsFirstArgument)
29345 OS << ")";
29346 OS << "]]";
29347 break;
29348 }
29349 }
29350 }
29351
29352 const char *ObjCBridgeMutableAttr::getSpelling() const {
29353 switch (getAttributeSpellingListIndex()) {
29354 default:
29355 llvm_unreachable("Unknown attribute spelling!");
29356 return "(No spelling)";
29357 case 0:
29358 return "objc_bridge_mutable";
29359 case 1:
29360 return "objc_bridge_mutable";
29361 case 2:
29362 return "objc_bridge_mutable";
29363 }
29364 }
29365
29366
29367 // ObjCBridgeRelatedAttr implementation
29368
29369 ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, const AttributeCommonInfo &CommonInfo) {
29370 auto *A = new (Ctx) ObjCBridgeRelatedAttr(Ctx, CommonInfo, RelatedClass, ClassMethod, InstanceMethod);
29371 A->setImplicit(true);
29372 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29373 A->setAttributeSpellingListIndex(0);
29374 return A;
29375 }
29376
29377 ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::Create(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, const AttributeCommonInfo &CommonInfo) {
29378 auto *A = new (Ctx) ObjCBridgeRelatedAttr(Ctx, CommonInfo, RelatedClass, ClassMethod, InstanceMethod);
29379 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29380 A->setAttributeSpellingListIndex(0);
29381 return A;
29382 }
29383
29384 ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, SourceRange Range, Spelling S) {
29385 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29386 switch (S) {
29387 case GNU_objc_bridge_related:
29388 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29389 case CXX11_clang_objc_bridge_related:
29390 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29391 case C23_clang_objc_bridge_related:
29392 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29393 default:
29394 llvm_unreachable("Unknown attribute spelling!");
29395 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29396 }
29397 }());
29398 return CreateImplicit(Ctx, RelatedClass, ClassMethod, InstanceMethod, I);
29399 }
29400
29401 ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::Create(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, SourceRange Range, Spelling S) {
29402 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29403 switch (S) {
29404 case GNU_objc_bridge_related:
29405 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29406 case CXX11_clang_objc_bridge_related:
29407 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29408 case C23_clang_objc_bridge_related:
29409 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29410 default:
29411 llvm_unreachable("Unknown attribute spelling!");
29412 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29413 }
29414 }());
29415 return Create(Ctx, RelatedClass, ClassMethod, InstanceMethod, I);
29416 }
29417
29418 ObjCBridgeRelatedAttr::ObjCBridgeRelatedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
29419 , IdentifierInfo * RelatedClass
29420 , IdentifierInfo * ClassMethod
29421 , IdentifierInfo * InstanceMethod
29422 )
29423 : InheritableAttr(Ctx, CommonInfo, attr::ObjCBridgeRelated, /*IsLateParsed=*/false, false)
29424 , relatedClass(RelatedClass)
29425 , classMethod(ClassMethod)
29426 , instanceMethod(InstanceMethod)
29427 {
29428 }
29429
29430
29431
29432
29433
29434
29435
29436 ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::clone(ASTContext &C) const {
29437 auto *A = new (C) ObjCBridgeRelatedAttr(C, *this, relatedClass, classMethod, instanceMethod);
29438 A->Inherited = Inherited;
29439 A->IsPackExpansion = IsPackExpansion;
29440 A->setImplicit(Implicit);
29441 return A;
29442 }
29443
29444 void ObjCBridgeRelatedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
29445 bool IsFirstArgument = true; (void)IsFirstArgument;
29446 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
29447 switch (getAttributeSpellingListIndex()) {
29448 default:
29449 llvm_unreachable("Unknown attribute spelling!");
29450 break;
29451 case 0 : {
29452 OS << "__attribute__((objc_bridge_related";
29453 DelimitAttributeArgument(OS, IsFirstArgument);
29454 OS << "" << (getRelatedClass() ? getRelatedClass()->getName() : "") << "";
29455 DelimitAttributeArgument(OS, IsFirstArgument);
29456 OS << "" << (getClassMethod() ? getClassMethod()->getName() : "") << "";
29457 DelimitAttributeArgument(OS, IsFirstArgument);
29458 OS << "" << (getInstanceMethod() ? getInstanceMethod()->getName() : "") << "";
29459 if (!IsFirstArgument)
29460 OS << ")";
29461 OS << "))";
29462 break;
29463 }
29464 case 1 : {
29465 OS << "[[clang::objc_bridge_related";
29466 DelimitAttributeArgument(OS, IsFirstArgument);
29467 OS << "" << (getRelatedClass() ? getRelatedClass()->getName() : "") << "";
29468 DelimitAttributeArgument(OS, IsFirstArgument);
29469 OS << "" << (getClassMethod() ? getClassMethod()->getName() : "") << "";
29470 DelimitAttributeArgument(OS, IsFirstArgument);
29471 OS << "" << (getInstanceMethod() ? getInstanceMethod()->getName() : "") << "";
29472 if (!IsFirstArgument)
29473 OS << ")";
29474 OS << "]]";
29475 break;
29476 }
29477 case 2 : {
29478 OS << "[[clang::objc_bridge_related";
29479 DelimitAttributeArgument(OS, IsFirstArgument);
29480 OS << "" << (getRelatedClass() ? getRelatedClass()->getName() : "") << "";
29481 DelimitAttributeArgument(OS, IsFirstArgument);
29482 OS << "" << (getClassMethod() ? getClassMethod()->getName() : "") << "";
29483 DelimitAttributeArgument(OS, IsFirstArgument);
29484 OS << "" << (getInstanceMethod() ? getInstanceMethod()->getName() : "") << "";
29485 if (!IsFirstArgument)
29486 OS << ")";
29487 OS << "]]";
29488 break;
29489 }
29490 }
29491 }
29492
29493 const char *ObjCBridgeRelatedAttr::getSpelling() const {
29494 switch (getAttributeSpellingListIndex()) {
29495 default:
29496 llvm_unreachable("Unknown attribute spelling!");
29497 return "(No spelling)";
29498 case 0:
29499 return "objc_bridge_related";
29500 case 1:
29501 return "objc_bridge_related";
29502 case 2:
29503 return "objc_bridge_related";
29504 }
29505 }
29506
29507
29508 // ObjCClassStubAttr implementation
29509
29510 ObjCClassStubAttr *ObjCClassStubAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29511 auto *A = new (Ctx) ObjCClassStubAttr(Ctx, CommonInfo);
29512 A->setImplicit(true);
29513 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29514 A->setAttributeSpellingListIndex(0);
29515 return A;
29516 }
29517
29518 ObjCClassStubAttr *ObjCClassStubAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29519 auto *A = new (Ctx) ObjCClassStubAttr(Ctx, CommonInfo);
29520 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29521 A->setAttributeSpellingListIndex(0);
29522 return A;
29523 }
29524
29525 ObjCClassStubAttr *ObjCClassStubAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
29526 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29527 switch (S) {
29528 case GNU_objc_class_stub:
29529 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29530 case CXX11_clang_objc_class_stub:
29531 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29532 case C23_clang_objc_class_stub:
29533 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29534 default:
29535 llvm_unreachable("Unknown attribute spelling!");
29536 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29537 }
29538 }());
29539 return CreateImplicit(Ctx, I);
29540 }
29541
29542 ObjCClassStubAttr *ObjCClassStubAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
29543 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29544 switch (S) {
29545 case GNU_objc_class_stub:
29546 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29547 case CXX11_clang_objc_class_stub:
29548 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29549 case C23_clang_objc_class_stub:
29550 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29551 default:
29552 llvm_unreachable("Unknown attribute spelling!");
29553 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29554 }
29555 }());
29556 return Create(Ctx, I);
29557 }
29558
29559 ObjCClassStubAttr::ObjCClassStubAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
29560 )
29561 : Attr(Ctx, CommonInfo, attr::ObjCClassStub, /*IsLateParsed=*/false)
29562 {
29563 }
29564
29565 ObjCClassStubAttr *ObjCClassStubAttr::clone(ASTContext &C) const {
29566 auto *A = new (C) ObjCClassStubAttr(C, *this);
29567 A->Inherited = Inherited;
29568 A->IsPackExpansion = IsPackExpansion;
29569 A->setImplicit(Implicit);
29570 return A;
29571 }
29572
29573 void ObjCClassStubAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
29574 bool IsFirstArgument = true; (void)IsFirstArgument;
29575 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
29576 switch (getAttributeSpellingListIndex()) {
29577 default:
29578 llvm_unreachable("Unknown attribute spelling!");
29579 break;
29580 case 0 : {
29581 OS << "__attribute__((objc_class_stub";
29582 OS << "))";
29583 break;
29584 }
29585 case 1 : {
29586 OS << "[[clang::objc_class_stub";
29587 OS << "]]";
29588 break;
29589 }
29590 case 2 : {
29591 OS << "[[clang::objc_class_stub";
29592 OS << "]]";
29593 break;
29594 }
29595 }
29596 }
29597
29598 const char *ObjCClassStubAttr::getSpelling() const {
29599 switch (getAttributeSpellingListIndex()) {
29600 default:
29601 llvm_unreachable("Unknown attribute spelling!");
29602 return "(No spelling)";
29603 case 0:
29604 return "objc_class_stub";
29605 case 1:
29606 return "objc_class_stub";
29607 case 2:
29608 return "objc_class_stub";
29609 }
29610 }
29611
29612
29613 // ObjCDesignatedInitializerAttr implementation
29614
29615 ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29616 auto *A = new (Ctx) ObjCDesignatedInitializerAttr(Ctx, CommonInfo);
29617 A->setImplicit(true);
29618 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29619 A->setAttributeSpellingListIndex(0);
29620 return A;
29621 }
29622
29623 ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29624 auto *A = new (Ctx) ObjCDesignatedInitializerAttr(Ctx, CommonInfo);
29625 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29626 A->setAttributeSpellingListIndex(0);
29627 return A;
29628 }
29629
29630 ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
29631 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29632 switch (S) {
29633 case GNU_objc_designated_initializer:
29634 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29635 case CXX11_clang_objc_designated_initializer:
29636 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29637 case C23_clang_objc_designated_initializer:
29638 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29639 default:
29640 llvm_unreachable("Unknown attribute spelling!");
29641 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29642 }
29643 }());
29644 return CreateImplicit(Ctx, I);
29645 }
29646
29647 ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
29648 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29649 switch (S) {
29650 case GNU_objc_designated_initializer:
29651 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29652 case CXX11_clang_objc_designated_initializer:
29653 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29654 case C23_clang_objc_designated_initializer:
29655 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29656 default:
29657 llvm_unreachable("Unknown attribute spelling!");
29658 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29659 }
29660 }());
29661 return Create(Ctx, I);
29662 }
29663
29664 ObjCDesignatedInitializerAttr::ObjCDesignatedInitializerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
29665 )
29666 : Attr(Ctx, CommonInfo, attr::ObjCDesignatedInitializer, /*IsLateParsed=*/false)
29667 {
29668 }
29669
29670 ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::clone(ASTContext &C) const {
29671 auto *A = new (C) ObjCDesignatedInitializerAttr(C, *this);
29672 A->Inherited = Inherited;
29673 A->IsPackExpansion = IsPackExpansion;
29674 A->setImplicit(Implicit);
29675 return A;
29676 }
29677
29678 void ObjCDesignatedInitializerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
29679 bool IsFirstArgument = true; (void)IsFirstArgument;
29680 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
29681 switch (getAttributeSpellingListIndex()) {
29682 default:
29683 llvm_unreachable("Unknown attribute spelling!");
29684 break;
29685 case 0 : {
29686 OS << "__attribute__((objc_designated_initializer";
29687 OS << "))";
29688 break;
29689 }
29690 case 1 : {
29691 OS << "[[clang::objc_designated_initializer";
29692 OS << "]]";
29693 break;
29694 }
29695 case 2 : {
29696 OS << "[[clang::objc_designated_initializer";
29697 OS << "]]";
29698 break;
29699 }
29700 }
29701 }
29702
29703 const char *ObjCDesignatedInitializerAttr::getSpelling() const {
29704 switch (getAttributeSpellingListIndex()) {
29705 default:
29706 llvm_unreachable("Unknown attribute spelling!");
29707 return "(No spelling)";
29708 case 0:
29709 return "objc_designated_initializer";
29710 case 1:
29711 return "objc_designated_initializer";
29712 case 2:
29713 return "objc_designated_initializer";
29714 }
29715 }
29716
29717
29718 // ObjCDirectAttr implementation
29719
29720 ObjCDirectAttr *ObjCDirectAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29721 auto *A = new (Ctx) ObjCDirectAttr(Ctx, CommonInfo);
29722 A->setImplicit(true);
29723 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29724 A->setAttributeSpellingListIndex(0);
29725 return A;
29726 }
29727
29728 ObjCDirectAttr *ObjCDirectAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29729 auto *A = new (Ctx) ObjCDirectAttr(Ctx, CommonInfo);
29730 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29731 A->setAttributeSpellingListIndex(0);
29732 return A;
29733 }
29734
29735 ObjCDirectAttr *ObjCDirectAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
29736 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29737 switch (S) {
29738 case GNU_objc_direct:
29739 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29740 case CXX11_clang_objc_direct:
29741 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29742 case C23_clang_objc_direct:
29743 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29744 default:
29745 llvm_unreachable("Unknown attribute spelling!");
29746 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29747 }
29748 }());
29749 return CreateImplicit(Ctx, I);
29750 }
29751
29752 ObjCDirectAttr *ObjCDirectAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
29753 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29754 switch (S) {
29755 case GNU_objc_direct:
29756 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29757 case CXX11_clang_objc_direct:
29758 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29759 case C23_clang_objc_direct:
29760 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29761 default:
29762 llvm_unreachable("Unknown attribute spelling!");
29763 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29764 }
29765 }());
29766 return Create(Ctx, I);
29767 }
29768
29769 ObjCDirectAttr::ObjCDirectAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
29770 )
29771 : Attr(Ctx, CommonInfo, attr::ObjCDirect, /*IsLateParsed=*/false)
29772 {
29773 }
29774
29775 ObjCDirectAttr *ObjCDirectAttr::clone(ASTContext &C) const {
29776 auto *A = new (C) ObjCDirectAttr(C, *this);
29777 A->Inherited = Inherited;
29778 A->IsPackExpansion = IsPackExpansion;
29779 A->setImplicit(Implicit);
29780 return A;
29781 }
29782
29783 void ObjCDirectAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
29784 bool IsFirstArgument = true; (void)IsFirstArgument;
29785 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
29786 switch (getAttributeSpellingListIndex()) {
29787 default:
29788 llvm_unreachable("Unknown attribute spelling!");
29789 break;
29790 case 0 : {
29791 OS << "__attribute__((objc_direct";
29792 OS << "))";
29793 break;
29794 }
29795 case 1 : {
29796 OS << "[[clang::objc_direct";
29797 OS << "]]";
29798 break;
29799 }
29800 case 2 : {
29801 OS << "[[clang::objc_direct";
29802 OS << "]]";
29803 break;
29804 }
29805 }
29806 }
29807
29808 const char *ObjCDirectAttr::getSpelling() const {
29809 switch (getAttributeSpellingListIndex()) {
29810 default:
29811 llvm_unreachable("Unknown attribute spelling!");
29812 return "(No spelling)";
29813 case 0:
29814 return "objc_direct";
29815 case 1:
29816 return "objc_direct";
29817 case 2:
29818 return "objc_direct";
29819 }
29820 }
29821
29822
29823 // ObjCDirectMembersAttr implementation
29824
29825 ObjCDirectMembersAttr *ObjCDirectMembersAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29826 auto *A = new (Ctx) ObjCDirectMembersAttr(Ctx, CommonInfo);
29827 A->setImplicit(true);
29828 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29829 A->setAttributeSpellingListIndex(0);
29830 return A;
29831 }
29832
29833 ObjCDirectMembersAttr *ObjCDirectMembersAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29834 auto *A = new (Ctx) ObjCDirectMembersAttr(Ctx, CommonInfo);
29835 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29836 A->setAttributeSpellingListIndex(0);
29837 return A;
29838 }
29839
29840 ObjCDirectMembersAttr *ObjCDirectMembersAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
29841 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29842 switch (S) {
29843 case GNU_objc_direct_members:
29844 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29845 case CXX11_clang_objc_direct_members:
29846 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29847 case C23_clang_objc_direct_members:
29848 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29849 default:
29850 llvm_unreachable("Unknown attribute spelling!");
29851 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29852 }
29853 }());
29854 return CreateImplicit(Ctx, I);
29855 }
29856
29857 ObjCDirectMembersAttr *ObjCDirectMembersAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
29858 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29859 switch (S) {
29860 case GNU_objc_direct_members:
29861 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29862 case CXX11_clang_objc_direct_members:
29863 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29864 case C23_clang_objc_direct_members:
29865 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29866 default:
29867 llvm_unreachable("Unknown attribute spelling!");
29868 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29869 }
29870 }());
29871 return Create(Ctx, I);
29872 }
29873
29874 ObjCDirectMembersAttr::ObjCDirectMembersAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
29875 )
29876 : Attr(Ctx, CommonInfo, attr::ObjCDirectMembers, /*IsLateParsed=*/false)
29877 {
29878 }
29879
29880 ObjCDirectMembersAttr *ObjCDirectMembersAttr::clone(ASTContext &C) const {
29881 auto *A = new (C) ObjCDirectMembersAttr(C, *this);
29882 A->Inherited = Inherited;
29883 A->IsPackExpansion = IsPackExpansion;
29884 A->setImplicit(Implicit);
29885 return A;
29886 }
29887
29888 void ObjCDirectMembersAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
29889 bool IsFirstArgument = true; (void)IsFirstArgument;
29890 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
29891 switch (getAttributeSpellingListIndex()) {
29892 default:
29893 llvm_unreachable("Unknown attribute spelling!");
29894 break;
29895 case 0 : {
29896 OS << "__attribute__((objc_direct_members";
29897 OS << "))";
29898 break;
29899 }
29900 case 1 : {
29901 OS << "[[clang::objc_direct_members";
29902 OS << "]]";
29903 break;
29904 }
29905 case 2 : {
29906 OS << "[[clang::objc_direct_members";
29907 OS << "]]";
29908 break;
29909 }
29910 }
29911 }
29912
29913 const char *ObjCDirectMembersAttr::getSpelling() const {
29914 switch (getAttributeSpellingListIndex()) {
29915 default:
29916 llvm_unreachable("Unknown attribute spelling!");
29917 return "(No spelling)";
29918 case 0:
29919 return "objc_direct_members";
29920 case 1:
29921 return "objc_direct_members";
29922 case 2:
29923 return "objc_direct_members";
29924 }
29925 }
29926
29927
29928 // ObjCExceptionAttr implementation
29929
29930 ObjCExceptionAttr *ObjCExceptionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29931 auto *A = new (Ctx) ObjCExceptionAttr(Ctx, CommonInfo);
29932 A->setImplicit(true);
29933 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29934 A->setAttributeSpellingListIndex(0);
29935 return A;
29936 }
29937
29938 ObjCExceptionAttr *ObjCExceptionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
29939 auto *A = new (Ctx) ObjCExceptionAttr(Ctx, CommonInfo);
29940 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
29941 A->setAttributeSpellingListIndex(0);
29942 return A;
29943 }
29944
29945 ObjCExceptionAttr *ObjCExceptionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
29946 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29947 switch (S) {
29948 case GNU_objc_exception:
29949 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29950 case CXX11_clang_objc_exception:
29951 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29952 case C23_clang_objc_exception:
29953 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29954 default:
29955 llvm_unreachable("Unknown attribute spelling!");
29956 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29957 }
29958 }());
29959 return CreateImplicit(Ctx, I);
29960 }
29961
29962 ObjCExceptionAttr *ObjCExceptionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
29963 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
29964 switch (S) {
29965 case GNU_objc_exception:
29966 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29967 case CXX11_clang_objc_exception:
29968 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29969 case C23_clang_objc_exception:
29970 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29971 default:
29972 llvm_unreachable("Unknown attribute spelling!");
29973 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
29974 }
29975 }());
29976 return Create(Ctx, I);
29977 }
29978
29979 ObjCExceptionAttr::ObjCExceptionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
29980 )
29981 : InheritableAttr(Ctx, CommonInfo, attr::ObjCException, /*IsLateParsed=*/false, false)
29982 {
29983 }
29984
29985 ObjCExceptionAttr *ObjCExceptionAttr::clone(ASTContext &C) const {
29986 auto *A = new (C) ObjCExceptionAttr(C, *this);
29987 A->Inherited = Inherited;
29988 A->IsPackExpansion = IsPackExpansion;
29989 A->setImplicit(Implicit);
29990 return A;
29991 }
29992
29993 void ObjCExceptionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
29994 bool IsFirstArgument = true; (void)IsFirstArgument;
29995 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
29996 switch (getAttributeSpellingListIndex()) {
29997 default:
29998 llvm_unreachable("Unknown attribute spelling!");
29999 break;
30000 case 0 : {
30001 OS << "__attribute__((objc_exception";
30002 OS << "))";
30003 break;
30004 }
30005 case 1 : {
30006 OS << "[[clang::objc_exception";
30007 OS << "]]";
30008 break;
30009 }
30010 case 2 : {
30011 OS << "[[clang::objc_exception";
30012 OS << "]]";
30013 break;
30014 }
30015 }
30016 }
30017
30018 const char *ObjCExceptionAttr::getSpelling() const {
30019 switch (getAttributeSpellingListIndex()) {
30020 default:
30021 llvm_unreachable("Unknown attribute spelling!");
30022 return "(No spelling)";
30023 case 0:
30024 return "objc_exception";
30025 case 1:
30026 return "objc_exception";
30027 case 2:
30028 return "objc_exception";
30029 }
30030 }
30031
30032
30033 // ObjCExplicitProtocolImplAttr implementation
30034
30035 ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30036 auto *A = new (Ctx) ObjCExplicitProtocolImplAttr(Ctx, CommonInfo);
30037 A->setImplicit(true);
30038 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30039 A->setAttributeSpellingListIndex(0);
30040 return A;
30041 }
30042
30043 ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30044 auto *A = new (Ctx) ObjCExplicitProtocolImplAttr(Ctx, CommonInfo);
30045 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30046 A->setAttributeSpellingListIndex(0);
30047 return A;
30048 }
30049
30050 ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
30051 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30052 switch (S) {
30053 case GNU_objc_protocol_requires_explicit_implementation:
30054 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30055 case CXX11_clang_objc_protocol_requires_explicit_implementation:
30056 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30057 case C23_clang_objc_protocol_requires_explicit_implementation:
30058 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30059 default:
30060 llvm_unreachable("Unknown attribute spelling!");
30061 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30062 }
30063 }());
30064 return CreateImplicit(Ctx, I);
30065 }
30066
30067 ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
30068 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30069 switch (S) {
30070 case GNU_objc_protocol_requires_explicit_implementation:
30071 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30072 case CXX11_clang_objc_protocol_requires_explicit_implementation:
30073 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30074 case C23_clang_objc_protocol_requires_explicit_implementation:
30075 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30076 default:
30077 llvm_unreachable("Unknown attribute spelling!");
30078 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30079 }
30080 }());
30081 return Create(Ctx, I);
30082 }
30083
30084 ObjCExplicitProtocolImplAttr::ObjCExplicitProtocolImplAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
30085 )
30086 : InheritableAttr(Ctx, CommonInfo, attr::ObjCExplicitProtocolImpl, /*IsLateParsed=*/false, false)
30087 {
30088 }
30089
30090 ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::clone(ASTContext &C) const {
30091 auto *A = new (C) ObjCExplicitProtocolImplAttr(C, *this);
30092 A->Inherited = Inherited;
30093 A->IsPackExpansion = IsPackExpansion;
30094 A->setImplicit(Implicit);
30095 return A;
30096 }
30097
30098 void ObjCExplicitProtocolImplAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
30099 bool IsFirstArgument = true; (void)IsFirstArgument;
30100 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
30101 switch (getAttributeSpellingListIndex()) {
30102 default:
30103 llvm_unreachable("Unknown attribute spelling!");
30104 break;
30105 case 0 : {
30106 OS << "__attribute__((objc_protocol_requires_explicit_implementation";
30107 OS << "))";
30108 break;
30109 }
30110 case 1 : {
30111 OS << "[[clang::objc_protocol_requires_explicit_implementation";
30112 OS << "]]";
30113 break;
30114 }
30115 case 2 : {
30116 OS << "[[clang::objc_protocol_requires_explicit_implementation";
30117 OS << "]]";
30118 break;
30119 }
30120 }
30121 }
30122
30123 const char *ObjCExplicitProtocolImplAttr::getSpelling() const {
30124 switch (getAttributeSpellingListIndex()) {
30125 default:
30126 llvm_unreachable("Unknown attribute spelling!");
30127 return "(No spelling)";
30128 case 0:
30129 return "objc_protocol_requires_explicit_implementation";
30130 case 1:
30131 return "objc_protocol_requires_explicit_implementation";
30132 case 2:
30133 return "objc_protocol_requires_explicit_implementation";
30134 }
30135 }
30136
30137
30138 // ObjCExternallyRetainedAttr implementation
30139
30140 ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30141 auto *A = new (Ctx) ObjCExternallyRetainedAttr(Ctx, CommonInfo);
30142 A->setImplicit(true);
30143 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30144 A->setAttributeSpellingListIndex(0);
30145 return A;
30146 }
30147
30148 ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30149 auto *A = new (Ctx) ObjCExternallyRetainedAttr(Ctx, CommonInfo);
30150 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30151 A->setAttributeSpellingListIndex(0);
30152 return A;
30153 }
30154
30155 ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
30156 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30157 switch (S) {
30158 case GNU_objc_externally_retained:
30159 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30160 case CXX11_clang_objc_externally_retained:
30161 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30162 case C23_clang_objc_externally_retained:
30163 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30164 default:
30165 llvm_unreachable("Unknown attribute spelling!");
30166 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30167 }
30168 }());
30169 return CreateImplicit(Ctx, I);
30170 }
30171
30172 ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
30173 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30174 switch (S) {
30175 case GNU_objc_externally_retained:
30176 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30177 case CXX11_clang_objc_externally_retained:
30178 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30179 case C23_clang_objc_externally_retained:
30180 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30181 default:
30182 llvm_unreachable("Unknown attribute spelling!");
30183 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30184 }
30185 }());
30186 return Create(Ctx, I);
30187 }
30188
30189 ObjCExternallyRetainedAttr::ObjCExternallyRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
30190 )
30191 : InheritableAttr(Ctx, CommonInfo, attr::ObjCExternallyRetained, /*IsLateParsed=*/false, false)
30192 {
30193 }
30194
30195 ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::clone(ASTContext &C) const {
30196 auto *A = new (C) ObjCExternallyRetainedAttr(C, *this);
30197 A->Inherited = Inherited;
30198 A->IsPackExpansion = IsPackExpansion;
30199 A->setImplicit(Implicit);
30200 return A;
30201 }
30202
30203 void ObjCExternallyRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
30204 bool IsFirstArgument = true; (void)IsFirstArgument;
30205 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
30206 switch (getAttributeSpellingListIndex()) {
30207 default:
30208 llvm_unreachable("Unknown attribute spelling!");
30209 break;
30210 case 0 : {
30211 OS << "__attribute__((objc_externally_retained";
30212 OS << "))";
30213 break;
30214 }
30215 case 1 : {
30216 OS << "[[clang::objc_externally_retained";
30217 OS << "]]";
30218 break;
30219 }
30220 case 2 : {
30221 OS << "[[clang::objc_externally_retained";
30222 OS << "]]";
30223 break;
30224 }
30225 }
30226 }
30227
30228 const char *ObjCExternallyRetainedAttr::getSpelling() const {
30229 switch (getAttributeSpellingListIndex()) {
30230 default:
30231 llvm_unreachable("Unknown attribute spelling!");
30232 return "(No spelling)";
30233 case 0:
30234 return "objc_externally_retained";
30235 case 1:
30236 return "objc_externally_retained";
30237 case 2:
30238 return "objc_externally_retained";
30239 }
30240 }
30241
30242
30243 // ObjCGCAttr implementation
30244
30245 ObjCGCAttr *ObjCGCAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) {
30246 auto *A = new (Ctx) ObjCGCAttr(Ctx, CommonInfo, Kind);
30247 A->setImplicit(true);
30248 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30249 A->setAttributeSpellingListIndex(0);
30250 return A;
30251 }
30252
30253 ObjCGCAttr *ObjCGCAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) {
30254 auto *A = new (Ctx) ObjCGCAttr(Ctx, CommonInfo, Kind);
30255 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30256 A->setAttributeSpellingListIndex(0);
30257 return A;
30258 }
30259
30260 ObjCGCAttr *ObjCGCAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, Spelling S) {
30261 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30262 switch (S) {
30263 case GNU_objc_gc:
30264 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30265 case CXX11_clang_objc_gc:
30266 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30267 case C23_clang_objc_gc:
30268 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30269 default:
30270 llvm_unreachable("Unknown attribute spelling!");
30271 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30272 }
30273 }());
30274 return CreateImplicit(Ctx, Kind, I);
30275 }
30276
30277 ObjCGCAttr *ObjCGCAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, Spelling S) {
30278 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30279 switch (S) {
30280 case GNU_objc_gc:
30281 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30282 case CXX11_clang_objc_gc:
30283 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30284 case C23_clang_objc_gc:
30285 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30286 default:
30287 llvm_unreachable("Unknown attribute spelling!");
30288 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30289 }
30290 }());
30291 return Create(Ctx, Kind, I);
30292 }
30293
30294 ObjCGCAttr::ObjCGCAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
30295 , IdentifierInfo * Kind
30296 )
30297 : TypeAttr(Ctx, CommonInfo, attr::ObjCGC, /*IsLateParsed=*/false)
30298 , kind(Kind)
30299 {
30300 }
30301
30302
30303
30304 ObjCGCAttr *ObjCGCAttr::clone(ASTContext &C) const {
30305 auto *A = new (C) ObjCGCAttr(C, *this, kind);
30306 A->Inherited = Inherited;
30307 A->IsPackExpansion = IsPackExpansion;
30308 A->setImplicit(Implicit);
30309 return A;
30310 }
30311
30312 void ObjCGCAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
30313 bool IsFirstArgument = true; (void)IsFirstArgument;
30314 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
30315 switch (getAttributeSpellingListIndex()) {
30316 default:
30317 llvm_unreachable("Unknown attribute spelling!");
30318 break;
30319 case 0 : {
30320 OS << "__attribute__((objc_gc";
30321 DelimitAttributeArgument(OS, IsFirstArgument);
30322 OS << "" << (getKind() ? getKind()->getName() : "") << "";
30323 if (!IsFirstArgument)
30324 OS << ")";
30325 OS << "))";
30326 break;
30327 }
30328 case 1 : {
30329 OS << "[[clang::objc_gc";
30330 DelimitAttributeArgument(OS, IsFirstArgument);
30331 OS << "" << (getKind() ? getKind()->getName() : "") << "";
30332 if (!IsFirstArgument)
30333 OS << ")";
30334 OS << "]]";
30335 break;
30336 }
30337 case 2 : {
30338 OS << "[[clang::objc_gc";
30339 DelimitAttributeArgument(OS, IsFirstArgument);
30340 OS << "" << (getKind() ? getKind()->getName() : "") << "";
30341 if (!IsFirstArgument)
30342 OS << ")";
30343 OS << "]]";
30344 break;
30345 }
30346 }
30347 }
30348
30349 const char *ObjCGCAttr::getSpelling() const {
30350 switch (getAttributeSpellingListIndex()) {
30351 default:
30352 llvm_unreachable("Unknown attribute spelling!");
30353 return "(No spelling)";
30354 case 0:
30355 return "objc_gc";
30356 case 1:
30357 return "objc_gc";
30358 case 2:
30359 return "objc_gc";
30360 }
30361 }
30362
30363
30364 // ObjCIndependentClassAttr implementation
30365
30366 ObjCIndependentClassAttr *ObjCIndependentClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30367 auto *A = new (Ctx) ObjCIndependentClassAttr(Ctx, CommonInfo);
30368 A->setImplicit(true);
30369 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30370 A->setAttributeSpellingListIndex(0);
30371 return A;
30372 }
30373
30374 ObjCIndependentClassAttr *ObjCIndependentClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30375 auto *A = new (Ctx) ObjCIndependentClassAttr(Ctx, CommonInfo);
30376 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30377 A->setAttributeSpellingListIndex(0);
30378 return A;
30379 }
30380
30381 ObjCIndependentClassAttr *ObjCIndependentClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
30382 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30383 switch (S) {
30384 case GNU_objc_independent_class:
30385 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30386 case CXX11_clang_objc_independent_class:
30387 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30388 case C23_clang_objc_independent_class:
30389 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30390 default:
30391 llvm_unreachable("Unknown attribute spelling!");
30392 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30393 }
30394 }());
30395 return CreateImplicit(Ctx, I);
30396 }
30397
30398 ObjCIndependentClassAttr *ObjCIndependentClassAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
30399 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30400 switch (S) {
30401 case GNU_objc_independent_class:
30402 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30403 case CXX11_clang_objc_independent_class:
30404 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30405 case C23_clang_objc_independent_class:
30406 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30407 default:
30408 llvm_unreachable("Unknown attribute spelling!");
30409 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30410 }
30411 }());
30412 return Create(Ctx, I);
30413 }
30414
30415 ObjCIndependentClassAttr::ObjCIndependentClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
30416 )
30417 : InheritableAttr(Ctx, CommonInfo, attr::ObjCIndependentClass, /*IsLateParsed=*/false, false)
30418 {
30419 }
30420
30421 ObjCIndependentClassAttr *ObjCIndependentClassAttr::clone(ASTContext &C) const {
30422 auto *A = new (C) ObjCIndependentClassAttr(C, *this);
30423 A->Inherited = Inherited;
30424 A->IsPackExpansion = IsPackExpansion;
30425 A->setImplicit(Implicit);
30426 return A;
30427 }
30428
30429 void ObjCIndependentClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
30430 bool IsFirstArgument = true; (void)IsFirstArgument;
30431 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
30432 switch (getAttributeSpellingListIndex()) {
30433 default:
30434 llvm_unreachable("Unknown attribute spelling!");
30435 break;
30436 case 0 : {
30437 OS << "__attribute__((objc_independent_class";
30438 OS << "))";
30439 break;
30440 }
30441 case 1 : {
30442 OS << "[[clang::objc_independent_class";
30443 OS << "]]";
30444 break;
30445 }
30446 case 2 : {
30447 OS << "[[clang::objc_independent_class";
30448 OS << "]]";
30449 break;
30450 }
30451 }
30452 }
30453
30454 const char *ObjCIndependentClassAttr::getSpelling() const {
30455 switch (getAttributeSpellingListIndex()) {
30456 default:
30457 llvm_unreachable("Unknown attribute spelling!");
30458 return "(No spelling)";
30459 case 0:
30460 return "objc_independent_class";
30461 case 1:
30462 return "objc_independent_class";
30463 case 2:
30464 return "objc_independent_class";
30465 }
30466 }
30467
30468
30469 // ObjCInertUnsafeUnretainedAttr implementation
30470
30471 ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30472 auto *A = new (Ctx) ObjCInertUnsafeUnretainedAttr(Ctx, CommonInfo);
30473 A->setImplicit(true);
30474 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30475 A->setAttributeSpellingListIndex(0);
30476 return A;
30477 }
30478
30479 ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30480 auto *A = new (Ctx) ObjCInertUnsafeUnretainedAttr(Ctx, CommonInfo);
30481 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30482 A->setAttributeSpellingListIndex(0);
30483 return A;
30484 }
30485
30486 ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
30487 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
30488 return CreateImplicit(Ctx, I);
30489 }
30490
30491 ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::Create(ASTContext &Ctx, SourceRange Range) {
30492 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
30493 return Create(Ctx, I);
30494 }
30495
30496 ObjCInertUnsafeUnretainedAttr::ObjCInertUnsafeUnretainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
30497 )
30498 : TypeAttr(Ctx, CommonInfo, attr::ObjCInertUnsafeUnretained, /*IsLateParsed=*/false)
30499 {
30500 }
30501
30502 ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::clone(ASTContext &C) const {
30503 auto *A = new (C) ObjCInertUnsafeUnretainedAttr(C, *this);
30504 A->Inherited = Inherited;
30505 A->IsPackExpansion = IsPackExpansion;
30506 A->setImplicit(Implicit);
30507 return A;
30508 }
30509
30510 void ObjCInertUnsafeUnretainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
30511 bool IsFirstArgument = true; (void)IsFirstArgument;
30512 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
30513 switch (getAttributeSpellingListIndex()) {
30514 default:
30515 llvm_unreachable("Unknown attribute spelling!");
30516 break;
30517 case 0 : {
30518 OS << "__unsafe_unretained";
30519 OS << "";
30520 break;
30521 }
30522 }
30523 }
30524
30525 const char *ObjCInertUnsafeUnretainedAttr::getSpelling() const {
30526 switch (getAttributeSpellingListIndex()) {
30527 default:
30528 llvm_unreachable("Unknown attribute spelling!");
30529 return "(No spelling)";
30530 case 0:
30531 return "__unsafe_unretained";
30532 }
30533 }
30534
30535
30536 // ObjCKindOfAttr implementation
30537
30538 ObjCKindOfAttr *ObjCKindOfAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30539 auto *A = new (Ctx) ObjCKindOfAttr(Ctx, CommonInfo);
30540 A->setImplicit(true);
30541 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30542 A->setAttributeSpellingListIndex(0);
30543 return A;
30544 }
30545
30546 ObjCKindOfAttr *ObjCKindOfAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30547 auto *A = new (Ctx) ObjCKindOfAttr(Ctx, CommonInfo);
30548 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30549 A->setAttributeSpellingListIndex(0);
30550 return A;
30551 }
30552
30553 ObjCKindOfAttr *ObjCKindOfAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
30554 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
30555 return CreateImplicit(Ctx, I);
30556 }
30557
30558 ObjCKindOfAttr *ObjCKindOfAttr::Create(ASTContext &Ctx, SourceRange Range) {
30559 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
30560 return Create(Ctx, I);
30561 }
30562
30563 ObjCKindOfAttr::ObjCKindOfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
30564 )
30565 : TypeAttr(Ctx, CommonInfo, attr::ObjCKindOf, /*IsLateParsed=*/false)
30566 {
30567 }
30568
30569 ObjCKindOfAttr *ObjCKindOfAttr::clone(ASTContext &C) const {
30570 auto *A = new (C) ObjCKindOfAttr(C, *this);
30571 A->Inherited = Inherited;
30572 A->IsPackExpansion = IsPackExpansion;
30573 A->setImplicit(Implicit);
30574 return A;
30575 }
30576
30577 void ObjCKindOfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
30578 bool IsFirstArgument = true; (void)IsFirstArgument;
30579 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
30580 switch (getAttributeSpellingListIndex()) {
30581 default:
30582 llvm_unreachable("Unknown attribute spelling!");
30583 break;
30584 case 0 : {
30585 OS << "__kindof";
30586 OS << "";
30587 break;
30588 }
30589 }
30590 }
30591
30592 const char *ObjCKindOfAttr::getSpelling() const {
30593 switch (getAttributeSpellingListIndex()) {
30594 default:
30595 llvm_unreachable("Unknown attribute spelling!");
30596 return "(No spelling)";
30597 case 0:
30598 return "__kindof";
30599 }
30600 }
30601
30602
30603 // ObjCMethodFamilyAttr implementation
30604
30605 ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::CreateImplicit(ASTContext &Ctx, ObjCMethodFamilyAttr::FamilyKind Family, const AttributeCommonInfo &CommonInfo) {
30606 auto *A = new (Ctx) ObjCMethodFamilyAttr(Ctx, CommonInfo, Family);
30607 A->setImplicit(true);
30608 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30609 A->setAttributeSpellingListIndex(0);
30610 return A;
30611 }
30612
30613 ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::Create(ASTContext &Ctx, ObjCMethodFamilyAttr::FamilyKind Family, const AttributeCommonInfo &CommonInfo) {
30614 auto *A = new (Ctx) ObjCMethodFamilyAttr(Ctx, CommonInfo, Family);
30615 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30616 A->setAttributeSpellingListIndex(0);
30617 return A;
30618 }
30619
30620 ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::CreateImplicit(ASTContext &Ctx, ObjCMethodFamilyAttr::FamilyKind Family, SourceRange Range, Spelling S) {
30621 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30622 switch (S) {
30623 case GNU_objc_method_family:
30624 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30625 case CXX11_clang_objc_method_family:
30626 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30627 case C23_clang_objc_method_family:
30628 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30629 default:
30630 llvm_unreachable("Unknown attribute spelling!");
30631 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30632 }
30633 }());
30634 return CreateImplicit(Ctx, Family, I);
30635 }
30636
30637 ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::Create(ASTContext &Ctx, ObjCMethodFamilyAttr::FamilyKind Family, SourceRange Range, Spelling S) {
30638 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30639 switch (S) {
30640 case GNU_objc_method_family:
30641 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30642 case CXX11_clang_objc_method_family:
30643 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30644 case C23_clang_objc_method_family:
30645 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30646 default:
30647 llvm_unreachable("Unknown attribute spelling!");
30648 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30649 }
30650 }());
30651 return Create(Ctx, Family, I);
30652 }
30653
30654 ObjCMethodFamilyAttr::ObjCMethodFamilyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
30655 , ObjCMethodFamilyAttr::FamilyKind Family
30656 )
30657 : InheritableAttr(Ctx, CommonInfo, attr::ObjCMethodFamily, /*IsLateParsed=*/false, false)
30658 , family(Family)
30659 {
30660 }
30661
30662
30663
30664 bool ObjCMethodFamilyAttr::ConvertStrToFamilyKind(StringRef Val, ObjCMethodFamilyAttr::FamilyKind &Out) {
30665 std::optional<ObjCMethodFamilyAttr::FamilyKind> R = llvm::StringSwitch<std::optional<ObjCMethodFamilyAttr::FamilyKind>>(Val)
30666 .Case("none", ObjCMethodFamilyAttr::FamilyKind::OMF_None)
30667 .Case("alloc", ObjCMethodFamilyAttr::FamilyKind::OMF_alloc)
30668 .Case("copy", ObjCMethodFamilyAttr::FamilyKind::OMF_copy)
30669 .Case("init", ObjCMethodFamilyAttr::FamilyKind::OMF_init)
30670 .Case("mutableCopy", ObjCMethodFamilyAttr::FamilyKind::OMF_mutableCopy)
30671 .Case("new", ObjCMethodFamilyAttr::FamilyKind::OMF_new)
30672 .Default(std::optional<ObjCMethodFamilyAttr::FamilyKind>());
30673 if (R) {
30674 Out = *R;
30675 return true;
30676 }
30677 return false;
30678 }
30679
30680 const char *ObjCMethodFamilyAttr::ConvertFamilyKindToStr(ObjCMethodFamilyAttr::FamilyKind Val) {
30681 switch(Val) {
30682 case ObjCMethodFamilyAttr::FamilyKind::OMF_None: return "none";
30683 case ObjCMethodFamilyAttr::FamilyKind::OMF_alloc: return "alloc";
30684 case ObjCMethodFamilyAttr::FamilyKind::OMF_copy: return "copy";
30685 case ObjCMethodFamilyAttr::FamilyKind::OMF_init: return "init";
30686 case ObjCMethodFamilyAttr::FamilyKind::OMF_mutableCopy: return "mutableCopy";
30687 case ObjCMethodFamilyAttr::FamilyKind::OMF_new: return "new";
30688 }
30689 llvm_unreachable("No enumerator with that value");
30690 }
30691 ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::clone(ASTContext &C) const {
30692 auto *A = new (C) ObjCMethodFamilyAttr(C, *this, family);
30693 A->Inherited = Inherited;
30694 A->IsPackExpansion = IsPackExpansion;
30695 A->setImplicit(Implicit);
30696 return A;
30697 }
30698
30699 void ObjCMethodFamilyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
30700 bool IsFirstArgument = true; (void)IsFirstArgument;
30701 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
30702 switch (getAttributeSpellingListIndex()) {
30703 default:
30704 llvm_unreachable("Unknown attribute spelling!");
30705 break;
30706 case 0 : {
30707 OS << "__attribute__((objc_method_family";
30708 DelimitAttributeArgument(OS, IsFirstArgument);
30709 OS << "\"" << ObjCMethodFamilyAttr::ConvertFamilyKindToStr(getFamily()) << "\"";
30710 if (!IsFirstArgument)
30711 OS << ")";
30712 OS << "))";
30713 break;
30714 }
30715 case 1 : {
30716 OS << "[[clang::objc_method_family";
30717 DelimitAttributeArgument(OS, IsFirstArgument);
30718 OS << "\"" << ObjCMethodFamilyAttr::ConvertFamilyKindToStr(getFamily()) << "\"";
30719 if (!IsFirstArgument)
30720 OS << ")";
30721 OS << "]]";
30722 break;
30723 }
30724 case 2 : {
30725 OS << "[[clang::objc_method_family";
30726 DelimitAttributeArgument(OS, IsFirstArgument);
30727 OS << "\"" << ObjCMethodFamilyAttr::ConvertFamilyKindToStr(getFamily()) << "\"";
30728 if (!IsFirstArgument)
30729 OS << ")";
30730 OS << "]]";
30731 break;
30732 }
30733 }
30734 }
30735
30736 const char *ObjCMethodFamilyAttr::getSpelling() const {
30737 switch (getAttributeSpellingListIndex()) {
30738 default:
30739 llvm_unreachable("Unknown attribute spelling!");
30740 return "(No spelling)";
30741 case 0:
30742 return "objc_method_family";
30743 case 1:
30744 return "objc_method_family";
30745 case 2:
30746 return "objc_method_family";
30747 }
30748 }
30749
30750
30751 // ObjCNSObjectAttr implementation
30752
30753 ObjCNSObjectAttr *ObjCNSObjectAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30754 auto *A = new (Ctx) ObjCNSObjectAttr(Ctx, CommonInfo);
30755 A->setImplicit(true);
30756 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30757 A->setAttributeSpellingListIndex(0);
30758 return A;
30759 }
30760
30761 ObjCNSObjectAttr *ObjCNSObjectAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30762 auto *A = new (Ctx) ObjCNSObjectAttr(Ctx, CommonInfo);
30763 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30764 A->setAttributeSpellingListIndex(0);
30765 return A;
30766 }
30767
30768 ObjCNSObjectAttr *ObjCNSObjectAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
30769 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30770 switch (S) {
30771 case GNU_NSObject:
30772 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30773 case CXX11_clang_NSObject:
30774 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30775 case C23_clang_NSObject:
30776 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30777 default:
30778 llvm_unreachable("Unknown attribute spelling!");
30779 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30780 }
30781 }());
30782 return CreateImplicit(Ctx, I);
30783 }
30784
30785 ObjCNSObjectAttr *ObjCNSObjectAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
30786 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30787 switch (S) {
30788 case GNU_NSObject:
30789 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30790 case CXX11_clang_NSObject:
30791 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30792 case C23_clang_NSObject:
30793 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30794 default:
30795 llvm_unreachable("Unknown attribute spelling!");
30796 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30797 }
30798 }());
30799 return Create(Ctx, I);
30800 }
30801
30802 ObjCNSObjectAttr::ObjCNSObjectAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
30803 )
30804 : InheritableAttr(Ctx, CommonInfo, attr::ObjCNSObject, /*IsLateParsed=*/false, false)
30805 {
30806 }
30807
30808 ObjCNSObjectAttr *ObjCNSObjectAttr::clone(ASTContext &C) const {
30809 auto *A = new (C) ObjCNSObjectAttr(C, *this);
30810 A->Inherited = Inherited;
30811 A->IsPackExpansion = IsPackExpansion;
30812 A->setImplicit(Implicit);
30813 return A;
30814 }
30815
30816 void ObjCNSObjectAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
30817 bool IsFirstArgument = true; (void)IsFirstArgument;
30818 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
30819 switch (getAttributeSpellingListIndex()) {
30820 default:
30821 llvm_unreachable("Unknown attribute spelling!");
30822 break;
30823 case 0 : {
30824 OS << "__attribute__((NSObject";
30825 OS << "))";
30826 break;
30827 }
30828 case 1 : {
30829 OS << "[[clang::NSObject";
30830 OS << "]]";
30831 break;
30832 }
30833 case 2 : {
30834 OS << "[[clang::NSObject";
30835 OS << "]]";
30836 break;
30837 }
30838 }
30839 }
30840
30841 const char *ObjCNSObjectAttr::getSpelling() const {
30842 switch (getAttributeSpellingListIndex()) {
30843 default:
30844 llvm_unreachable("Unknown attribute spelling!");
30845 return "(No spelling)";
30846 case 0:
30847 return "NSObject";
30848 case 1:
30849 return "NSObject";
30850 case 2:
30851 return "NSObject";
30852 }
30853 }
30854
30855
30856 // ObjCNonLazyClassAttr implementation
30857
30858 ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30859 auto *A = new (Ctx) ObjCNonLazyClassAttr(Ctx, CommonInfo);
30860 A->setImplicit(true);
30861 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30862 A->setAttributeSpellingListIndex(0);
30863 return A;
30864 }
30865
30866 ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30867 auto *A = new (Ctx) ObjCNonLazyClassAttr(Ctx, CommonInfo);
30868 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30869 A->setAttributeSpellingListIndex(0);
30870 return A;
30871 }
30872
30873 ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
30874 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30875 switch (S) {
30876 case GNU_objc_nonlazy_class:
30877 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30878 case CXX11_clang_objc_nonlazy_class:
30879 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30880 case C23_clang_objc_nonlazy_class:
30881 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30882 default:
30883 llvm_unreachable("Unknown attribute spelling!");
30884 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30885 }
30886 }());
30887 return CreateImplicit(Ctx, I);
30888 }
30889
30890 ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
30891 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30892 switch (S) {
30893 case GNU_objc_nonlazy_class:
30894 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30895 case CXX11_clang_objc_nonlazy_class:
30896 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30897 case C23_clang_objc_nonlazy_class:
30898 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30899 default:
30900 llvm_unreachable("Unknown attribute spelling!");
30901 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30902 }
30903 }());
30904 return Create(Ctx, I);
30905 }
30906
30907 ObjCNonLazyClassAttr::ObjCNonLazyClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
30908 )
30909 : Attr(Ctx, CommonInfo, attr::ObjCNonLazyClass, /*IsLateParsed=*/false)
30910 {
30911 }
30912
30913 ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::clone(ASTContext &C) const {
30914 auto *A = new (C) ObjCNonLazyClassAttr(C, *this);
30915 A->Inherited = Inherited;
30916 A->IsPackExpansion = IsPackExpansion;
30917 A->setImplicit(Implicit);
30918 return A;
30919 }
30920
30921 void ObjCNonLazyClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
30922 bool IsFirstArgument = true; (void)IsFirstArgument;
30923 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
30924 switch (getAttributeSpellingListIndex()) {
30925 default:
30926 llvm_unreachable("Unknown attribute spelling!");
30927 break;
30928 case 0 : {
30929 OS << "__attribute__((objc_nonlazy_class";
30930 OS << "))";
30931 break;
30932 }
30933 case 1 : {
30934 OS << "[[clang::objc_nonlazy_class";
30935 OS << "]]";
30936 break;
30937 }
30938 case 2 : {
30939 OS << "[[clang::objc_nonlazy_class";
30940 OS << "]]";
30941 break;
30942 }
30943 }
30944 }
30945
30946 const char *ObjCNonLazyClassAttr::getSpelling() const {
30947 switch (getAttributeSpellingListIndex()) {
30948 default:
30949 llvm_unreachable("Unknown attribute spelling!");
30950 return "(No spelling)";
30951 case 0:
30952 return "objc_nonlazy_class";
30953 case 1:
30954 return "objc_nonlazy_class";
30955 case 2:
30956 return "objc_nonlazy_class";
30957 }
30958 }
30959
30960
30961 // ObjCNonRuntimeProtocolAttr implementation
30962
30963 ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30964 auto *A = new (Ctx) ObjCNonRuntimeProtocolAttr(Ctx, CommonInfo);
30965 A->setImplicit(true);
30966 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30967 A->setAttributeSpellingListIndex(0);
30968 return A;
30969 }
30970
30971 ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
30972 auto *A = new (Ctx) ObjCNonRuntimeProtocolAttr(Ctx, CommonInfo);
30973 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
30974 A->setAttributeSpellingListIndex(0);
30975 return A;
30976 }
30977
30978 ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
30979 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30980 switch (S) {
30981 case GNU_objc_non_runtime_protocol:
30982 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30983 case CXX11_clang_objc_non_runtime_protocol:
30984 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30985 case C23_clang_objc_non_runtime_protocol:
30986 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30987 default:
30988 llvm_unreachable("Unknown attribute spelling!");
30989 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
30990 }
30991 }());
30992 return CreateImplicit(Ctx, I);
30993 }
30994
30995 ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
30996 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
30997 switch (S) {
30998 case GNU_objc_non_runtime_protocol:
30999 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31000 case CXX11_clang_objc_non_runtime_protocol:
31001 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31002 case C23_clang_objc_non_runtime_protocol:
31003 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31004 default:
31005 llvm_unreachable("Unknown attribute spelling!");
31006 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31007 }
31008 }());
31009 return Create(Ctx, I);
31010 }
31011
31012 ObjCNonRuntimeProtocolAttr::ObjCNonRuntimeProtocolAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31013 )
31014 : Attr(Ctx, CommonInfo, attr::ObjCNonRuntimeProtocol, /*IsLateParsed=*/false)
31015 {
31016 }
31017
31018 ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::clone(ASTContext &C) const {
31019 auto *A = new (C) ObjCNonRuntimeProtocolAttr(C, *this);
31020 A->Inherited = Inherited;
31021 A->IsPackExpansion = IsPackExpansion;
31022 A->setImplicit(Implicit);
31023 return A;
31024 }
31025
31026 void ObjCNonRuntimeProtocolAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
31027 bool IsFirstArgument = true; (void)IsFirstArgument;
31028 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
31029 switch (getAttributeSpellingListIndex()) {
31030 default:
31031 llvm_unreachable("Unknown attribute spelling!");
31032 break;
31033 case 0 : {
31034 OS << "__attribute__((objc_non_runtime_protocol";
31035 OS << "))";
31036 break;
31037 }
31038 case 1 : {
31039 OS << "[[clang::objc_non_runtime_protocol";
31040 OS << "]]";
31041 break;
31042 }
31043 case 2 : {
31044 OS << "[[clang::objc_non_runtime_protocol";
31045 OS << "]]";
31046 break;
31047 }
31048 }
31049 }
31050
31051 const char *ObjCNonRuntimeProtocolAttr::getSpelling() const {
31052 switch (getAttributeSpellingListIndex()) {
31053 default:
31054 llvm_unreachable("Unknown attribute spelling!");
31055 return "(No spelling)";
31056 case 0:
31057 return "objc_non_runtime_protocol";
31058 case 1:
31059 return "objc_non_runtime_protocol";
31060 case 2:
31061 return "objc_non_runtime_protocol";
31062 }
31063 }
31064
31065
31066 // ObjCOwnershipAttr implementation
31067
31068 ObjCOwnershipAttr *ObjCOwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) {
31069 auto *A = new (Ctx) ObjCOwnershipAttr(Ctx, CommonInfo, Kind);
31070 A->setImplicit(true);
31071 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31072 A->setAttributeSpellingListIndex(0);
31073 return A;
31074 }
31075
31076 ObjCOwnershipAttr *ObjCOwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) {
31077 auto *A = new (Ctx) ObjCOwnershipAttr(Ctx, CommonInfo, Kind);
31078 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31079 A->setAttributeSpellingListIndex(0);
31080 return A;
31081 }
31082
31083 ObjCOwnershipAttr *ObjCOwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, Spelling S) {
31084 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31085 switch (S) {
31086 case GNU_objc_ownership:
31087 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31088 case CXX11_clang_objc_ownership:
31089 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31090 case C23_clang_objc_ownership:
31091 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31092 default:
31093 llvm_unreachable("Unknown attribute spelling!");
31094 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31095 }
31096 }());
31097 return CreateImplicit(Ctx, Kind, I);
31098 }
31099
31100 ObjCOwnershipAttr *ObjCOwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, Spelling S) {
31101 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31102 switch (S) {
31103 case GNU_objc_ownership:
31104 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31105 case CXX11_clang_objc_ownership:
31106 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31107 case C23_clang_objc_ownership:
31108 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31109 default:
31110 llvm_unreachable("Unknown attribute spelling!");
31111 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31112 }
31113 }());
31114 return Create(Ctx, Kind, I);
31115 }
31116
31117 ObjCOwnershipAttr::ObjCOwnershipAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31118 , IdentifierInfo * Kind
31119 )
31120 : InheritableAttr(Ctx, CommonInfo, attr::ObjCOwnership, /*IsLateParsed=*/false, false)
31121 , kind(Kind)
31122 {
31123 }
31124
31125
31126
31127 ObjCOwnershipAttr *ObjCOwnershipAttr::clone(ASTContext &C) const {
31128 auto *A = new (C) ObjCOwnershipAttr(C, *this, kind);
31129 A->Inherited = Inherited;
31130 A->IsPackExpansion = IsPackExpansion;
31131 A->setImplicit(Implicit);
31132 return A;
31133 }
31134
31135 void ObjCOwnershipAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
31136 bool IsFirstArgument = true; (void)IsFirstArgument;
31137 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
31138 switch (getAttributeSpellingListIndex()) {
31139 default:
31140 llvm_unreachable("Unknown attribute spelling!");
31141 break;
31142 case 0 : {
31143 OS << "__attribute__((objc_ownership";
31144 DelimitAttributeArgument(OS, IsFirstArgument);
31145 OS << "" << (getKind() ? getKind()->getName() : "") << "";
31146 if (!IsFirstArgument)
31147 OS << ")";
31148 OS << "))";
31149 break;
31150 }
31151 case 1 : {
31152 OS << "[[clang::objc_ownership";
31153 DelimitAttributeArgument(OS, IsFirstArgument);
31154 OS << "" << (getKind() ? getKind()->getName() : "") << "";
31155 if (!IsFirstArgument)
31156 OS << ")";
31157 OS << "]]";
31158 break;
31159 }
31160 case 2 : {
31161 OS << "[[clang::objc_ownership";
31162 DelimitAttributeArgument(OS, IsFirstArgument);
31163 OS << "" << (getKind() ? getKind()->getName() : "") << "";
31164 if (!IsFirstArgument)
31165 OS << ")";
31166 OS << "]]";
31167 break;
31168 }
31169 }
31170 }
31171
31172 const char *ObjCOwnershipAttr::getSpelling() const {
31173 switch (getAttributeSpellingListIndex()) {
31174 default:
31175 llvm_unreachable("Unknown attribute spelling!");
31176 return "(No spelling)";
31177 case 0:
31178 return "objc_ownership";
31179 case 1:
31180 return "objc_ownership";
31181 case 2:
31182 return "objc_ownership";
31183 }
31184 }
31185
31186
31187 // ObjCPreciseLifetimeAttr implementation
31188
31189 ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31190 auto *A = new (Ctx) ObjCPreciseLifetimeAttr(Ctx, CommonInfo);
31191 A->setImplicit(true);
31192 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31193 A->setAttributeSpellingListIndex(0);
31194 return A;
31195 }
31196
31197 ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31198 auto *A = new (Ctx) ObjCPreciseLifetimeAttr(Ctx, CommonInfo);
31199 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31200 A->setAttributeSpellingListIndex(0);
31201 return A;
31202 }
31203
31204 ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
31205 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31206 switch (S) {
31207 case GNU_objc_precise_lifetime:
31208 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31209 case CXX11_clang_objc_precise_lifetime:
31210 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31211 case C23_clang_objc_precise_lifetime:
31212 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31213 default:
31214 llvm_unreachable("Unknown attribute spelling!");
31215 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31216 }
31217 }());
31218 return CreateImplicit(Ctx, I);
31219 }
31220
31221 ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
31222 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31223 switch (S) {
31224 case GNU_objc_precise_lifetime:
31225 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31226 case CXX11_clang_objc_precise_lifetime:
31227 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31228 case C23_clang_objc_precise_lifetime:
31229 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31230 default:
31231 llvm_unreachable("Unknown attribute spelling!");
31232 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31233 }
31234 }());
31235 return Create(Ctx, I);
31236 }
31237
31238 ObjCPreciseLifetimeAttr::ObjCPreciseLifetimeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31239 )
31240 : InheritableAttr(Ctx, CommonInfo, attr::ObjCPreciseLifetime, /*IsLateParsed=*/false, false)
31241 {
31242 }
31243
31244 ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::clone(ASTContext &C) const {
31245 auto *A = new (C) ObjCPreciseLifetimeAttr(C, *this);
31246 A->Inherited = Inherited;
31247 A->IsPackExpansion = IsPackExpansion;
31248 A->setImplicit(Implicit);
31249 return A;
31250 }
31251
31252 void ObjCPreciseLifetimeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
31253 bool IsFirstArgument = true; (void)IsFirstArgument;
31254 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
31255 switch (getAttributeSpellingListIndex()) {
31256 default:
31257 llvm_unreachable("Unknown attribute spelling!");
31258 break;
31259 case 0 : {
31260 OS << "__attribute__((objc_precise_lifetime";
31261 OS << "))";
31262 break;
31263 }
31264 case 1 : {
31265 OS << "[[clang::objc_precise_lifetime";
31266 OS << "]]";
31267 break;
31268 }
31269 case 2 : {
31270 OS << "[[clang::objc_precise_lifetime";
31271 OS << "]]";
31272 break;
31273 }
31274 }
31275 }
31276
31277 const char *ObjCPreciseLifetimeAttr::getSpelling() const {
31278 switch (getAttributeSpellingListIndex()) {
31279 default:
31280 llvm_unreachable("Unknown attribute spelling!");
31281 return "(No spelling)";
31282 case 0:
31283 return "objc_precise_lifetime";
31284 case 1:
31285 return "objc_precise_lifetime";
31286 case 2:
31287 return "objc_precise_lifetime";
31288 }
31289 }
31290
31291
31292 // ObjCRequiresPropertyDefsAttr implementation
31293
31294 ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31295 auto *A = new (Ctx) ObjCRequiresPropertyDefsAttr(Ctx, CommonInfo);
31296 A->setImplicit(true);
31297 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31298 A->setAttributeSpellingListIndex(0);
31299 return A;
31300 }
31301
31302 ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31303 auto *A = new (Ctx) ObjCRequiresPropertyDefsAttr(Ctx, CommonInfo);
31304 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31305 A->setAttributeSpellingListIndex(0);
31306 return A;
31307 }
31308
31309 ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
31310 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31311 switch (S) {
31312 case GNU_objc_requires_property_definitions:
31313 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31314 case CXX11_clang_objc_requires_property_definitions:
31315 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31316 case C23_clang_objc_requires_property_definitions:
31317 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31318 default:
31319 llvm_unreachable("Unknown attribute spelling!");
31320 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31321 }
31322 }());
31323 return CreateImplicit(Ctx, I);
31324 }
31325
31326 ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
31327 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31328 switch (S) {
31329 case GNU_objc_requires_property_definitions:
31330 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31331 case CXX11_clang_objc_requires_property_definitions:
31332 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31333 case C23_clang_objc_requires_property_definitions:
31334 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31335 default:
31336 llvm_unreachable("Unknown attribute spelling!");
31337 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31338 }
31339 }());
31340 return Create(Ctx, I);
31341 }
31342
31343 ObjCRequiresPropertyDefsAttr::ObjCRequiresPropertyDefsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31344 )
31345 : InheritableAttr(Ctx, CommonInfo, attr::ObjCRequiresPropertyDefs, /*IsLateParsed=*/false, false)
31346 {
31347 }
31348
31349 ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::clone(ASTContext &C) const {
31350 auto *A = new (C) ObjCRequiresPropertyDefsAttr(C, *this);
31351 A->Inherited = Inherited;
31352 A->IsPackExpansion = IsPackExpansion;
31353 A->setImplicit(Implicit);
31354 return A;
31355 }
31356
31357 void ObjCRequiresPropertyDefsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
31358 bool IsFirstArgument = true; (void)IsFirstArgument;
31359 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
31360 switch (getAttributeSpellingListIndex()) {
31361 default:
31362 llvm_unreachable("Unknown attribute spelling!");
31363 break;
31364 case 0 : {
31365 OS << "__attribute__((objc_requires_property_definitions";
31366 OS << "))";
31367 break;
31368 }
31369 case 1 : {
31370 OS << "[[clang::objc_requires_property_definitions";
31371 OS << "]]";
31372 break;
31373 }
31374 case 2 : {
31375 OS << "[[clang::objc_requires_property_definitions";
31376 OS << "]]";
31377 break;
31378 }
31379 }
31380 }
31381
31382 const char *ObjCRequiresPropertyDefsAttr::getSpelling() const {
31383 switch (getAttributeSpellingListIndex()) {
31384 default:
31385 llvm_unreachable("Unknown attribute spelling!");
31386 return "(No spelling)";
31387 case 0:
31388 return "objc_requires_property_definitions";
31389 case 1:
31390 return "objc_requires_property_definitions";
31391 case 2:
31392 return "objc_requires_property_definitions";
31393 }
31394 }
31395
31396
31397 // ObjCRequiresSuperAttr implementation
31398
31399 ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31400 auto *A = new (Ctx) ObjCRequiresSuperAttr(Ctx, CommonInfo);
31401 A->setImplicit(true);
31402 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31403 A->setAttributeSpellingListIndex(0);
31404 return A;
31405 }
31406
31407 ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31408 auto *A = new (Ctx) ObjCRequiresSuperAttr(Ctx, CommonInfo);
31409 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31410 A->setAttributeSpellingListIndex(0);
31411 return A;
31412 }
31413
31414 ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
31415 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31416 switch (S) {
31417 case GNU_objc_requires_super:
31418 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31419 case CXX11_clang_objc_requires_super:
31420 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31421 case C23_clang_objc_requires_super:
31422 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31423 default:
31424 llvm_unreachable("Unknown attribute spelling!");
31425 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31426 }
31427 }());
31428 return CreateImplicit(Ctx, I);
31429 }
31430
31431 ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
31432 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31433 switch (S) {
31434 case GNU_objc_requires_super:
31435 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31436 case CXX11_clang_objc_requires_super:
31437 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31438 case C23_clang_objc_requires_super:
31439 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31440 default:
31441 llvm_unreachable("Unknown attribute spelling!");
31442 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31443 }
31444 }());
31445 return Create(Ctx, I);
31446 }
31447
31448 ObjCRequiresSuperAttr::ObjCRequiresSuperAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31449 )
31450 : InheritableAttr(Ctx, CommonInfo, attr::ObjCRequiresSuper, /*IsLateParsed=*/false, false)
31451 {
31452 }
31453
31454 ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::clone(ASTContext &C) const {
31455 auto *A = new (C) ObjCRequiresSuperAttr(C, *this);
31456 A->Inherited = Inherited;
31457 A->IsPackExpansion = IsPackExpansion;
31458 A->setImplicit(Implicit);
31459 return A;
31460 }
31461
31462 void ObjCRequiresSuperAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
31463 bool IsFirstArgument = true; (void)IsFirstArgument;
31464 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
31465 switch (getAttributeSpellingListIndex()) {
31466 default:
31467 llvm_unreachable("Unknown attribute spelling!");
31468 break;
31469 case 0 : {
31470 OS << "__attribute__((objc_requires_super";
31471 OS << "))";
31472 break;
31473 }
31474 case 1 : {
31475 OS << "[[clang::objc_requires_super";
31476 OS << "]]";
31477 break;
31478 }
31479 case 2 : {
31480 OS << "[[clang::objc_requires_super";
31481 OS << "]]";
31482 break;
31483 }
31484 }
31485 }
31486
31487 const char *ObjCRequiresSuperAttr::getSpelling() const {
31488 switch (getAttributeSpellingListIndex()) {
31489 default:
31490 llvm_unreachable("Unknown attribute spelling!");
31491 return "(No spelling)";
31492 case 0:
31493 return "objc_requires_super";
31494 case 1:
31495 return "objc_requires_super";
31496 case 2:
31497 return "objc_requires_super";
31498 }
31499 }
31500
31501
31502 // ObjCReturnsInnerPointerAttr implementation
31503
31504 ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31505 auto *A = new (Ctx) ObjCReturnsInnerPointerAttr(Ctx, CommonInfo);
31506 A->setImplicit(true);
31507 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31508 A->setAttributeSpellingListIndex(0);
31509 return A;
31510 }
31511
31512 ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31513 auto *A = new (Ctx) ObjCReturnsInnerPointerAttr(Ctx, CommonInfo);
31514 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31515 A->setAttributeSpellingListIndex(0);
31516 return A;
31517 }
31518
31519 ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
31520 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31521 switch (S) {
31522 case GNU_objc_returns_inner_pointer:
31523 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31524 case CXX11_clang_objc_returns_inner_pointer:
31525 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31526 case C23_clang_objc_returns_inner_pointer:
31527 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31528 default:
31529 llvm_unreachable("Unknown attribute spelling!");
31530 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31531 }
31532 }());
31533 return CreateImplicit(Ctx, I);
31534 }
31535
31536 ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
31537 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31538 switch (S) {
31539 case GNU_objc_returns_inner_pointer:
31540 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31541 case CXX11_clang_objc_returns_inner_pointer:
31542 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31543 case C23_clang_objc_returns_inner_pointer:
31544 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31545 default:
31546 llvm_unreachable("Unknown attribute spelling!");
31547 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31548 }
31549 }());
31550 return Create(Ctx, I);
31551 }
31552
31553 ObjCReturnsInnerPointerAttr::ObjCReturnsInnerPointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31554 )
31555 : InheritableAttr(Ctx, CommonInfo, attr::ObjCReturnsInnerPointer, /*IsLateParsed=*/false, false)
31556 {
31557 }
31558
31559 ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::clone(ASTContext &C) const {
31560 auto *A = new (C) ObjCReturnsInnerPointerAttr(C, *this);
31561 A->Inherited = Inherited;
31562 A->IsPackExpansion = IsPackExpansion;
31563 A->setImplicit(Implicit);
31564 return A;
31565 }
31566
31567 void ObjCReturnsInnerPointerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
31568 bool IsFirstArgument = true; (void)IsFirstArgument;
31569 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
31570 switch (getAttributeSpellingListIndex()) {
31571 default:
31572 llvm_unreachable("Unknown attribute spelling!");
31573 break;
31574 case 0 : {
31575 OS << "__attribute__((objc_returns_inner_pointer";
31576 OS << "))";
31577 break;
31578 }
31579 case 1 : {
31580 OS << "[[clang::objc_returns_inner_pointer";
31581 OS << "]]";
31582 break;
31583 }
31584 case 2 : {
31585 OS << "[[clang::objc_returns_inner_pointer";
31586 OS << "]]";
31587 break;
31588 }
31589 }
31590 }
31591
31592 const char *ObjCReturnsInnerPointerAttr::getSpelling() const {
31593 switch (getAttributeSpellingListIndex()) {
31594 default:
31595 llvm_unreachable("Unknown attribute spelling!");
31596 return "(No spelling)";
31597 case 0:
31598 return "objc_returns_inner_pointer";
31599 case 1:
31600 return "objc_returns_inner_pointer";
31601 case 2:
31602 return "objc_returns_inner_pointer";
31603 }
31604 }
31605
31606
31607 // ObjCRootClassAttr implementation
31608
31609 ObjCRootClassAttr *ObjCRootClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31610 auto *A = new (Ctx) ObjCRootClassAttr(Ctx, CommonInfo);
31611 A->setImplicit(true);
31612 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31613 A->setAttributeSpellingListIndex(0);
31614 return A;
31615 }
31616
31617 ObjCRootClassAttr *ObjCRootClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31618 auto *A = new (Ctx) ObjCRootClassAttr(Ctx, CommonInfo);
31619 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31620 A->setAttributeSpellingListIndex(0);
31621 return A;
31622 }
31623
31624 ObjCRootClassAttr *ObjCRootClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
31625 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31626 switch (S) {
31627 case GNU_objc_root_class:
31628 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31629 case CXX11_clang_objc_root_class:
31630 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31631 case C23_clang_objc_root_class:
31632 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31633 default:
31634 llvm_unreachable("Unknown attribute spelling!");
31635 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31636 }
31637 }());
31638 return CreateImplicit(Ctx, I);
31639 }
31640
31641 ObjCRootClassAttr *ObjCRootClassAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
31642 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31643 switch (S) {
31644 case GNU_objc_root_class:
31645 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31646 case CXX11_clang_objc_root_class:
31647 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31648 case C23_clang_objc_root_class:
31649 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31650 default:
31651 llvm_unreachable("Unknown attribute spelling!");
31652 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31653 }
31654 }());
31655 return Create(Ctx, I);
31656 }
31657
31658 ObjCRootClassAttr::ObjCRootClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31659 )
31660 : InheritableAttr(Ctx, CommonInfo, attr::ObjCRootClass, /*IsLateParsed=*/false, false)
31661 {
31662 }
31663
31664 ObjCRootClassAttr *ObjCRootClassAttr::clone(ASTContext &C) const {
31665 auto *A = new (C) ObjCRootClassAttr(C, *this);
31666 A->Inherited = Inherited;
31667 A->IsPackExpansion = IsPackExpansion;
31668 A->setImplicit(Implicit);
31669 return A;
31670 }
31671
31672 void ObjCRootClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
31673 bool IsFirstArgument = true; (void)IsFirstArgument;
31674 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
31675 switch (getAttributeSpellingListIndex()) {
31676 default:
31677 llvm_unreachable("Unknown attribute spelling!");
31678 break;
31679 case 0 : {
31680 OS << "__attribute__((objc_root_class";
31681 OS << "))";
31682 break;
31683 }
31684 case 1 : {
31685 OS << "[[clang::objc_root_class";
31686 OS << "]]";
31687 break;
31688 }
31689 case 2 : {
31690 OS << "[[clang::objc_root_class";
31691 OS << "]]";
31692 break;
31693 }
31694 }
31695 }
31696
31697 const char *ObjCRootClassAttr::getSpelling() const {
31698 switch (getAttributeSpellingListIndex()) {
31699 default:
31700 llvm_unreachable("Unknown attribute spelling!");
31701 return "(No spelling)";
31702 case 0:
31703 return "objc_root_class";
31704 case 1:
31705 return "objc_root_class";
31706 case 2:
31707 return "objc_root_class";
31708 }
31709 }
31710
31711
31712 // ObjCRuntimeNameAttr implementation
31713
31714 ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef MetadataName, const AttributeCommonInfo &CommonInfo) {
31715 auto *A = new (Ctx) ObjCRuntimeNameAttr(Ctx, CommonInfo, MetadataName);
31716 A->setImplicit(true);
31717 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31718 A->setAttributeSpellingListIndex(0);
31719 return A;
31720 }
31721
31722 ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::Create(ASTContext &Ctx, llvm::StringRef MetadataName, const AttributeCommonInfo &CommonInfo) {
31723 auto *A = new (Ctx) ObjCRuntimeNameAttr(Ctx, CommonInfo, MetadataName);
31724 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31725 A->setAttributeSpellingListIndex(0);
31726 return A;
31727 }
31728
31729 ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef MetadataName, SourceRange Range, Spelling S) {
31730 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31731 switch (S) {
31732 case GNU_objc_runtime_name:
31733 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31734 case CXX11_clang_objc_runtime_name:
31735 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31736 case C23_clang_objc_runtime_name:
31737 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31738 default:
31739 llvm_unreachable("Unknown attribute spelling!");
31740 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31741 }
31742 }());
31743 return CreateImplicit(Ctx, MetadataName, I);
31744 }
31745
31746 ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::Create(ASTContext &Ctx, llvm::StringRef MetadataName, SourceRange Range, Spelling S) {
31747 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31748 switch (S) {
31749 case GNU_objc_runtime_name:
31750 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31751 case CXX11_clang_objc_runtime_name:
31752 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31753 case C23_clang_objc_runtime_name:
31754 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31755 default:
31756 llvm_unreachable("Unknown attribute spelling!");
31757 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31758 }
31759 }());
31760 return Create(Ctx, MetadataName, I);
31761 }
31762
31763 ObjCRuntimeNameAttr::ObjCRuntimeNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31764 , llvm::StringRef MetadataName
31765 )
31766 : Attr(Ctx, CommonInfo, attr::ObjCRuntimeName, /*IsLateParsed=*/false)
31767 , metadataNameLength(MetadataName.size()),metadataName(new (Ctx, 1) char[metadataNameLength])
31768 {
31769 if (!MetadataName.empty())
31770 std::memcpy(metadataName, MetadataName.data(), metadataNameLength);
31771 }
31772
31773
31774
31775 ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::clone(ASTContext &C) const {
31776 auto *A = new (C) ObjCRuntimeNameAttr(C, *this, getMetadataName());
31777 A->Inherited = Inherited;
31778 A->IsPackExpansion = IsPackExpansion;
31779 A->setImplicit(Implicit);
31780 return A;
31781 }
31782
31783 void ObjCRuntimeNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
31784 bool IsFirstArgument = true; (void)IsFirstArgument;
31785 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
31786 switch (getAttributeSpellingListIndex()) {
31787 default:
31788 llvm_unreachable("Unknown attribute spelling!");
31789 break;
31790 case 0 : {
31791 OS << "__attribute__((objc_runtime_name";
31792 DelimitAttributeArgument(OS, IsFirstArgument);
31793 OS << "\"" << getMetadataName() << "\"";
31794 if (!IsFirstArgument)
31795 OS << ")";
31796 OS << "))";
31797 break;
31798 }
31799 case 1 : {
31800 OS << "[[clang::objc_runtime_name";
31801 DelimitAttributeArgument(OS, IsFirstArgument);
31802 OS << "\"" << getMetadataName() << "\"";
31803 if (!IsFirstArgument)
31804 OS << ")";
31805 OS << "]]";
31806 break;
31807 }
31808 case 2 : {
31809 OS << "[[clang::objc_runtime_name";
31810 DelimitAttributeArgument(OS, IsFirstArgument);
31811 OS << "\"" << getMetadataName() << "\"";
31812 if (!IsFirstArgument)
31813 OS << ")";
31814 OS << "]]";
31815 break;
31816 }
31817 }
31818 }
31819
31820 const char *ObjCRuntimeNameAttr::getSpelling() const {
31821 switch (getAttributeSpellingListIndex()) {
31822 default:
31823 llvm_unreachable("Unknown attribute spelling!");
31824 return "(No spelling)";
31825 case 0:
31826 return "objc_runtime_name";
31827 case 1:
31828 return "objc_runtime_name";
31829 case 2:
31830 return "objc_runtime_name";
31831 }
31832 }
31833
31834
31835 // ObjCRuntimeVisibleAttr implementation
31836
31837 ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31838 auto *A = new (Ctx) ObjCRuntimeVisibleAttr(Ctx, CommonInfo);
31839 A->setImplicit(true);
31840 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31841 A->setAttributeSpellingListIndex(0);
31842 return A;
31843 }
31844
31845 ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31846 auto *A = new (Ctx) ObjCRuntimeVisibleAttr(Ctx, CommonInfo);
31847 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31848 A->setAttributeSpellingListIndex(0);
31849 return A;
31850 }
31851
31852 ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
31853 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31854 switch (S) {
31855 case GNU_objc_runtime_visible:
31856 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31857 case CXX11_clang_objc_runtime_visible:
31858 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31859 case C23_clang_objc_runtime_visible:
31860 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31861 default:
31862 llvm_unreachable("Unknown attribute spelling!");
31863 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31864 }
31865 }());
31866 return CreateImplicit(Ctx, I);
31867 }
31868
31869 ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
31870 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31871 switch (S) {
31872 case GNU_objc_runtime_visible:
31873 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31874 case CXX11_clang_objc_runtime_visible:
31875 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31876 case C23_clang_objc_runtime_visible:
31877 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31878 default:
31879 llvm_unreachable("Unknown attribute spelling!");
31880 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31881 }
31882 }());
31883 return Create(Ctx, I);
31884 }
31885
31886 ObjCRuntimeVisibleAttr::ObjCRuntimeVisibleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31887 )
31888 : Attr(Ctx, CommonInfo, attr::ObjCRuntimeVisible, /*IsLateParsed=*/false)
31889 {
31890 }
31891
31892 ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::clone(ASTContext &C) const {
31893 auto *A = new (C) ObjCRuntimeVisibleAttr(C, *this);
31894 A->Inherited = Inherited;
31895 A->IsPackExpansion = IsPackExpansion;
31896 A->setImplicit(Implicit);
31897 return A;
31898 }
31899
31900 void ObjCRuntimeVisibleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
31901 bool IsFirstArgument = true; (void)IsFirstArgument;
31902 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
31903 switch (getAttributeSpellingListIndex()) {
31904 default:
31905 llvm_unreachable("Unknown attribute spelling!");
31906 break;
31907 case 0 : {
31908 OS << "__attribute__((objc_runtime_visible";
31909 OS << "))";
31910 break;
31911 }
31912 case 1 : {
31913 OS << "[[clang::objc_runtime_visible";
31914 OS << "]]";
31915 break;
31916 }
31917 case 2 : {
31918 OS << "[[clang::objc_runtime_visible";
31919 OS << "]]";
31920 break;
31921 }
31922 }
31923 }
31924
31925 const char *ObjCRuntimeVisibleAttr::getSpelling() const {
31926 switch (getAttributeSpellingListIndex()) {
31927 default:
31928 llvm_unreachable("Unknown attribute spelling!");
31929 return "(No spelling)";
31930 case 0:
31931 return "objc_runtime_visible";
31932 case 1:
31933 return "objc_runtime_visible";
31934 case 2:
31935 return "objc_runtime_visible";
31936 }
31937 }
31938
31939
31940 // ObjCSubclassingRestrictedAttr implementation
31941
31942 ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31943 auto *A = new (Ctx) ObjCSubclassingRestrictedAttr(Ctx, CommonInfo);
31944 A->setImplicit(true);
31945 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31946 A->setAttributeSpellingListIndex(0);
31947 return A;
31948 }
31949
31950 ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
31951 auto *A = new (Ctx) ObjCSubclassingRestrictedAttr(Ctx, CommonInfo);
31952 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
31953 A->setAttributeSpellingListIndex(0);
31954 return A;
31955 }
31956
31957 ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
31958 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31959 switch (S) {
31960 case GNU_objc_subclassing_restricted:
31961 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31962 case CXX11_clang_objc_subclassing_restricted:
31963 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31964 case C23_clang_objc_subclassing_restricted:
31965 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31966 default:
31967 llvm_unreachable("Unknown attribute spelling!");
31968 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31969 }
31970 }());
31971 return CreateImplicit(Ctx, I);
31972 }
31973
31974 ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
31975 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
31976 switch (S) {
31977 case GNU_objc_subclassing_restricted:
31978 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31979 case CXX11_clang_objc_subclassing_restricted:
31980 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31981 case C23_clang_objc_subclassing_restricted:
31982 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31983 default:
31984 llvm_unreachable("Unknown attribute spelling!");
31985 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
31986 }
31987 }());
31988 return Create(Ctx, I);
31989 }
31990
31991 ObjCSubclassingRestrictedAttr::ObjCSubclassingRestrictedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
31992 )
31993 : InheritableAttr(Ctx, CommonInfo, attr::ObjCSubclassingRestricted, /*IsLateParsed=*/false, false)
31994 {
31995 }
31996
31997 ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::clone(ASTContext &C) const {
31998 auto *A = new (C) ObjCSubclassingRestrictedAttr(C, *this);
31999 A->Inherited = Inherited;
32000 A->IsPackExpansion = IsPackExpansion;
32001 A->setImplicit(Implicit);
32002 return A;
32003 }
32004
32005 void ObjCSubclassingRestrictedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
32006 bool IsFirstArgument = true; (void)IsFirstArgument;
32007 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
32008 switch (getAttributeSpellingListIndex()) {
32009 default:
32010 llvm_unreachable("Unknown attribute spelling!");
32011 break;
32012 case 0 : {
32013 OS << "__attribute__((objc_subclassing_restricted";
32014 OS << "))";
32015 break;
32016 }
32017 case 1 : {
32018 OS << "[[clang::objc_subclassing_restricted";
32019 OS << "]]";
32020 break;
32021 }
32022 case 2 : {
32023 OS << "[[clang::objc_subclassing_restricted";
32024 OS << "]]";
32025 break;
32026 }
32027 }
32028 }
32029
32030 const char *ObjCSubclassingRestrictedAttr::getSpelling() const {
32031 switch (getAttributeSpellingListIndex()) {
32032 default:
32033 llvm_unreachable("Unknown attribute spelling!");
32034 return "(No spelling)";
32035 case 0:
32036 return "objc_subclassing_restricted";
32037 case 1:
32038 return "objc_subclassing_restricted";
32039 case 2:
32040 return "objc_subclassing_restricted";
32041 }
32042 }
32043
32044
32045 // OpenCLAccessAttr implementation
32046
32047 OpenCLAccessAttr *OpenCLAccessAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32048 auto *A = new (Ctx) OpenCLAccessAttr(Ctx, CommonInfo);
32049 A->setImplicit(true);
32050 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32051 A->setAttributeSpellingListIndex(0);
32052 return A;
32053 }
32054
32055 OpenCLAccessAttr *OpenCLAccessAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32056 auto *A = new (Ctx) OpenCLAccessAttr(Ctx, CommonInfo);
32057 return A;
32058 }
32059
32060 OpenCLAccessAttr *OpenCLAccessAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
32061 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32062 switch (S) {
32063 case Keyword_read_only:
32064 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_read_only, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32065 case Keyword_write_only:
32066 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_write_only, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32067 case Keyword_read_write:
32068 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_read_write, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32069 default:
32070 llvm_unreachable("Unknown attribute spelling!");
32071 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32072 }
32073 }());
32074 return CreateImplicit(Ctx, I);
32075 }
32076
32077 OpenCLAccessAttr *OpenCLAccessAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
32078 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32079 switch (S) {
32080 case Keyword_read_only:
32081 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_read_only, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32082 case Keyword_write_only:
32083 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_write_only, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32084 case Keyword_read_write:
32085 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_read_write, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32086 default:
32087 llvm_unreachable("Unknown attribute spelling!");
32088 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32089 }
32090 }());
32091 return Create(Ctx, I);
32092 }
32093
32094 OpenCLAccessAttr::OpenCLAccessAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
32095 )
32096 : Attr(Ctx, CommonInfo, attr::OpenCLAccess, /*IsLateParsed=*/false)
32097 {
32098 }
32099
32100 OpenCLAccessAttr::Spelling OpenCLAccessAttr::getSemanticSpelling() const {
32101 switch (getAttributeSpellingListIndex()) {
32102 default: llvm_unreachable("Unknown spelling list index");
32103 case 0: return Keyword_read_only;
32104 case 1: return Keyword_read_only;
32105 case 2: return Keyword_write_only;
32106 case 3: return Keyword_write_only;
32107 case 4: return Keyword_read_write;
32108 case 5: return Keyword_read_write;
32109 }
32110 }
32111 OpenCLAccessAttr *OpenCLAccessAttr::clone(ASTContext &C) const {
32112 auto *A = new (C) OpenCLAccessAttr(C, *this);
32113 A->Inherited = Inherited;
32114 A->IsPackExpansion = IsPackExpansion;
32115 A->setImplicit(Implicit);
32116 return A;
32117 }
32118
32119 void OpenCLAccessAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
32120 bool IsFirstArgument = true; (void)IsFirstArgument;
32121 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
32122 switch (getAttributeSpellingListIndex()) {
32123 default:
32124 llvm_unreachable("Unknown attribute spelling!");
32125 break;
32126 case 0 : {
32127 OS << "__read_only";
32128 OS << "";
32129 break;
32130 }
32131 case 1 : {
32132 OS << "read_only";
32133 OS << "";
32134 break;
32135 }
32136 case 2 : {
32137 OS << "__write_only";
32138 OS << "";
32139 break;
32140 }
32141 case 3 : {
32142 OS << "write_only";
32143 OS << "";
32144 break;
32145 }
32146 case 4 : {
32147 OS << "__read_write";
32148 OS << "";
32149 break;
32150 }
32151 case 5 : {
32152 OS << "read_write";
32153 OS << "";
32154 break;
32155 }
32156 }
32157 }
32158
32159 const char *OpenCLAccessAttr::getSpelling() const {
32160 switch (getAttributeSpellingListIndex()) {
32161 default:
32162 llvm_unreachable("Unknown attribute spelling!");
32163 return "(No spelling)";
32164 case 0:
32165 return "__read_only";
32166 case 1:
32167 return "read_only";
32168 case 2:
32169 return "__write_only";
32170 case 3:
32171 return "write_only";
32172 case 4:
32173 return "__read_write";
32174 case 5:
32175 return "read_write";
32176 }
32177 }
32178
32179
32180 // OpenCLConstantAddressSpaceAttr implementation
32181
32182 OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32183 auto *A = new (Ctx) OpenCLConstantAddressSpaceAttr(Ctx, CommonInfo);
32184 A->setImplicit(true);
32185 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32186 A->setAttributeSpellingListIndex(0);
32187 return A;
32188 }
32189
32190 OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32191 auto *A = new (Ctx) OpenCLConstantAddressSpaceAttr(Ctx, CommonInfo);
32192 return A;
32193 }
32194
32195 OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
32196 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32197 switch (S) {
32198 case Keyword_constant:
32199 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32200 case GNU_opencl_constant:
32201 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32202 case CXX11_clang_opencl_constant:
32203 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32204 case C23_clang_opencl_constant:
32205 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32206 default:
32207 llvm_unreachable("Unknown attribute spelling!");
32208 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32209 }
32210 }());
32211 return CreateImplicit(Ctx, I);
32212 }
32213
32214 OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
32215 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32216 switch (S) {
32217 case Keyword_constant:
32218 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32219 case GNU_opencl_constant:
32220 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32221 case CXX11_clang_opencl_constant:
32222 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32223 case C23_clang_opencl_constant:
32224 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32225 default:
32226 llvm_unreachable("Unknown attribute spelling!");
32227 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32228 }
32229 }());
32230 return Create(Ctx, I);
32231 }
32232
32233 OpenCLConstantAddressSpaceAttr::OpenCLConstantAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
32234 )
32235 : TypeAttr(Ctx, CommonInfo, attr::OpenCLConstantAddressSpace, /*IsLateParsed=*/false)
32236 {
32237 }
32238
32239 OpenCLConstantAddressSpaceAttr::Spelling OpenCLConstantAddressSpaceAttr::getSemanticSpelling() const {
32240 switch (getAttributeSpellingListIndex()) {
32241 default: llvm_unreachable("Unknown spelling list index");
32242 case 0: return Keyword_constant;
32243 case 1: return Keyword_constant;
32244 case 2: return GNU_opencl_constant;
32245 case 3: return CXX11_clang_opencl_constant;
32246 case 4: return C23_clang_opencl_constant;
32247 }
32248 }
32249 OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::clone(ASTContext &C) const {
32250 auto *A = new (C) OpenCLConstantAddressSpaceAttr(C, *this);
32251 A->Inherited = Inherited;
32252 A->IsPackExpansion = IsPackExpansion;
32253 A->setImplicit(Implicit);
32254 return A;
32255 }
32256
32257 void OpenCLConstantAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
32258 bool IsFirstArgument = true; (void)IsFirstArgument;
32259 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
32260 switch (getAttributeSpellingListIndex()) {
32261 default:
32262 llvm_unreachable("Unknown attribute spelling!");
32263 break;
32264 case 0 : {
32265 OS << "__constant";
32266 OS << "";
32267 break;
32268 }
32269 case 1 : {
32270 OS << "constant";
32271 OS << "";
32272 break;
32273 }
32274 case 2 : {
32275 OS << "__attribute__((opencl_constant";
32276 OS << "))";
32277 break;
32278 }
32279 case 3 : {
32280 OS << "[[clang::opencl_constant";
32281 OS << "]]";
32282 break;
32283 }
32284 case 4 : {
32285 OS << "[[clang::opencl_constant";
32286 OS << "]]";
32287 break;
32288 }
32289 }
32290 }
32291
32292 const char *OpenCLConstantAddressSpaceAttr::getSpelling() const {
32293 switch (getAttributeSpellingListIndex()) {
32294 default:
32295 llvm_unreachable("Unknown attribute spelling!");
32296 return "(No spelling)";
32297 case 0:
32298 return "__constant";
32299 case 1:
32300 return "constant";
32301 case 2:
32302 return "opencl_constant";
32303 case 3:
32304 return "opencl_constant";
32305 case 4:
32306 return "opencl_constant";
32307 }
32308 }
32309
32310
32311 // OpenCLGenericAddressSpaceAttr implementation
32312
32313 OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32314 auto *A = new (Ctx) OpenCLGenericAddressSpaceAttr(Ctx, CommonInfo);
32315 A->setImplicit(true);
32316 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32317 A->setAttributeSpellingListIndex(0);
32318 return A;
32319 }
32320
32321 OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32322 auto *A = new (Ctx) OpenCLGenericAddressSpaceAttr(Ctx, CommonInfo);
32323 return A;
32324 }
32325
32326 OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
32327 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32328 switch (S) {
32329 case Keyword_generic:
32330 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32331 case GNU_opencl_generic:
32332 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32333 case CXX11_clang_opencl_generic:
32334 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32335 case C23_clang_opencl_generic:
32336 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32337 default:
32338 llvm_unreachable("Unknown attribute spelling!");
32339 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32340 }
32341 }());
32342 return CreateImplicit(Ctx, I);
32343 }
32344
32345 OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
32346 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32347 switch (S) {
32348 case Keyword_generic:
32349 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32350 case GNU_opencl_generic:
32351 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32352 case CXX11_clang_opencl_generic:
32353 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32354 case C23_clang_opencl_generic:
32355 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32356 default:
32357 llvm_unreachable("Unknown attribute spelling!");
32358 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32359 }
32360 }());
32361 return Create(Ctx, I);
32362 }
32363
32364 OpenCLGenericAddressSpaceAttr::OpenCLGenericAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
32365 )
32366 : TypeAttr(Ctx, CommonInfo, attr::OpenCLGenericAddressSpace, /*IsLateParsed=*/false)
32367 {
32368 }
32369
32370 OpenCLGenericAddressSpaceAttr::Spelling OpenCLGenericAddressSpaceAttr::getSemanticSpelling() const {
32371 switch (getAttributeSpellingListIndex()) {
32372 default: llvm_unreachable("Unknown spelling list index");
32373 case 0: return Keyword_generic;
32374 case 1: return Keyword_generic;
32375 case 2: return GNU_opencl_generic;
32376 case 3: return CXX11_clang_opencl_generic;
32377 case 4: return C23_clang_opencl_generic;
32378 }
32379 }
32380 OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::clone(ASTContext &C) const {
32381 auto *A = new (C) OpenCLGenericAddressSpaceAttr(C, *this);
32382 A->Inherited = Inherited;
32383 A->IsPackExpansion = IsPackExpansion;
32384 A->setImplicit(Implicit);
32385 return A;
32386 }
32387
32388 void OpenCLGenericAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
32389 bool IsFirstArgument = true; (void)IsFirstArgument;
32390 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
32391 switch (getAttributeSpellingListIndex()) {
32392 default:
32393 llvm_unreachable("Unknown attribute spelling!");
32394 break;
32395 case 0 : {
32396 OS << "__generic";
32397 OS << "";
32398 break;
32399 }
32400 case 1 : {
32401 OS << "generic";
32402 OS << "";
32403 break;
32404 }
32405 case 2 : {
32406 OS << "__attribute__((opencl_generic";
32407 OS << "))";
32408 break;
32409 }
32410 case 3 : {
32411 OS << "[[clang::opencl_generic";
32412 OS << "]]";
32413 break;
32414 }
32415 case 4 : {
32416 OS << "[[clang::opencl_generic";
32417 OS << "]]";
32418 break;
32419 }
32420 }
32421 }
32422
32423 const char *OpenCLGenericAddressSpaceAttr::getSpelling() const {
32424 switch (getAttributeSpellingListIndex()) {
32425 default:
32426 llvm_unreachable("Unknown attribute spelling!");
32427 return "(No spelling)";
32428 case 0:
32429 return "__generic";
32430 case 1:
32431 return "generic";
32432 case 2:
32433 return "opencl_generic";
32434 case 3:
32435 return "opencl_generic";
32436 case 4:
32437 return "opencl_generic";
32438 }
32439 }
32440
32441
32442 // OpenCLGlobalAddressSpaceAttr implementation
32443
32444 OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32445 auto *A = new (Ctx) OpenCLGlobalAddressSpaceAttr(Ctx, CommonInfo);
32446 A->setImplicit(true);
32447 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32448 A->setAttributeSpellingListIndex(0);
32449 return A;
32450 }
32451
32452 OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32453 auto *A = new (Ctx) OpenCLGlobalAddressSpaceAttr(Ctx, CommonInfo);
32454 return A;
32455 }
32456
32457 OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
32458 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32459 switch (S) {
32460 case Keyword_global:
32461 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32462 case GNU_opencl_global:
32463 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32464 case CXX11_clang_opencl_global:
32465 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32466 case C23_clang_opencl_global:
32467 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32468 default:
32469 llvm_unreachable("Unknown attribute spelling!");
32470 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32471 }
32472 }());
32473 return CreateImplicit(Ctx, I);
32474 }
32475
32476 OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
32477 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32478 switch (S) {
32479 case Keyword_global:
32480 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32481 case GNU_opencl_global:
32482 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32483 case CXX11_clang_opencl_global:
32484 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32485 case C23_clang_opencl_global:
32486 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32487 default:
32488 llvm_unreachable("Unknown attribute spelling!");
32489 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32490 }
32491 }());
32492 return Create(Ctx, I);
32493 }
32494
32495 OpenCLGlobalAddressSpaceAttr::OpenCLGlobalAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
32496 )
32497 : TypeAttr(Ctx, CommonInfo, attr::OpenCLGlobalAddressSpace, /*IsLateParsed=*/false)
32498 {
32499 }
32500
32501 OpenCLGlobalAddressSpaceAttr::Spelling OpenCLGlobalAddressSpaceAttr::getSemanticSpelling() const {
32502 switch (getAttributeSpellingListIndex()) {
32503 default: llvm_unreachable("Unknown spelling list index");
32504 case 0: return Keyword_global;
32505 case 1: return Keyword_global;
32506 case 2: return GNU_opencl_global;
32507 case 3: return CXX11_clang_opencl_global;
32508 case 4: return C23_clang_opencl_global;
32509 }
32510 }
32511 OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::clone(ASTContext &C) const {
32512 auto *A = new (C) OpenCLGlobalAddressSpaceAttr(C, *this);
32513 A->Inherited = Inherited;
32514 A->IsPackExpansion = IsPackExpansion;
32515 A->setImplicit(Implicit);
32516 return A;
32517 }
32518
32519 void OpenCLGlobalAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
32520 bool IsFirstArgument = true; (void)IsFirstArgument;
32521 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
32522 switch (getAttributeSpellingListIndex()) {
32523 default:
32524 llvm_unreachable("Unknown attribute spelling!");
32525 break;
32526 case 0 : {
32527 OS << "__global";
32528 OS << "";
32529 break;
32530 }
32531 case 1 : {
32532 OS << "global";
32533 OS << "";
32534 break;
32535 }
32536 case 2 : {
32537 OS << "__attribute__((opencl_global";
32538 OS << "))";
32539 break;
32540 }
32541 case 3 : {
32542 OS << "[[clang::opencl_global";
32543 OS << "]]";
32544 break;
32545 }
32546 case 4 : {
32547 OS << "[[clang::opencl_global";
32548 OS << "]]";
32549 break;
32550 }
32551 }
32552 }
32553
32554 const char *OpenCLGlobalAddressSpaceAttr::getSpelling() const {
32555 switch (getAttributeSpellingListIndex()) {
32556 default:
32557 llvm_unreachable("Unknown attribute spelling!");
32558 return "(No spelling)";
32559 case 0:
32560 return "__global";
32561 case 1:
32562 return "global";
32563 case 2:
32564 return "opencl_global";
32565 case 3:
32566 return "opencl_global";
32567 case 4:
32568 return "opencl_global";
32569 }
32570 }
32571
32572
32573 // OpenCLGlobalDeviceAddressSpaceAttr implementation
32574
32575 OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32576 auto *A = new (Ctx) OpenCLGlobalDeviceAddressSpaceAttr(Ctx, CommonInfo);
32577 A->setImplicit(true);
32578 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32579 A->setAttributeSpellingListIndex(0);
32580 return A;
32581 }
32582
32583 OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32584 auto *A = new (Ctx) OpenCLGlobalDeviceAddressSpaceAttr(Ctx, CommonInfo);
32585 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32586 A->setAttributeSpellingListIndex(0);
32587 return A;
32588 }
32589
32590 OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
32591 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32592 switch (S) {
32593 case GNU_opencl_global_device:
32594 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32595 case CXX11_clang_opencl_global_device:
32596 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32597 case C23_clang_opencl_global_device:
32598 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32599 default:
32600 llvm_unreachable("Unknown attribute spelling!");
32601 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32602 }
32603 }());
32604 return CreateImplicit(Ctx, I);
32605 }
32606
32607 OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
32608 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32609 switch (S) {
32610 case GNU_opencl_global_device:
32611 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32612 case CXX11_clang_opencl_global_device:
32613 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32614 case C23_clang_opencl_global_device:
32615 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32616 default:
32617 llvm_unreachable("Unknown attribute spelling!");
32618 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32619 }
32620 }());
32621 return Create(Ctx, I);
32622 }
32623
32624 OpenCLGlobalDeviceAddressSpaceAttr::OpenCLGlobalDeviceAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
32625 )
32626 : TypeAttr(Ctx, CommonInfo, attr::OpenCLGlobalDeviceAddressSpace, /*IsLateParsed=*/false)
32627 {
32628 }
32629
32630 OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::clone(ASTContext &C) const {
32631 auto *A = new (C) OpenCLGlobalDeviceAddressSpaceAttr(C, *this);
32632 A->Inherited = Inherited;
32633 A->IsPackExpansion = IsPackExpansion;
32634 A->setImplicit(Implicit);
32635 return A;
32636 }
32637
32638 void OpenCLGlobalDeviceAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
32639 bool IsFirstArgument = true; (void)IsFirstArgument;
32640 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
32641 switch (getAttributeSpellingListIndex()) {
32642 default:
32643 llvm_unreachable("Unknown attribute spelling!");
32644 break;
32645 case 0 : {
32646 OS << "__attribute__((opencl_global_device";
32647 OS << "))";
32648 break;
32649 }
32650 case 1 : {
32651 OS << "[[clang::opencl_global_device";
32652 OS << "]]";
32653 break;
32654 }
32655 case 2 : {
32656 OS << "[[clang::opencl_global_device";
32657 OS << "]]";
32658 break;
32659 }
32660 }
32661 }
32662
32663 const char *OpenCLGlobalDeviceAddressSpaceAttr::getSpelling() const {
32664 switch (getAttributeSpellingListIndex()) {
32665 default:
32666 llvm_unreachable("Unknown attribute spelling!");
32667 return "(No spelling)";
32668 case 0:
32669 return "opencl_global_device";
32670 case 1:
32671 return "opencl_global_device";
32672 case 2:
32673 return "opencl_global_device";
32674 }
32675 }
32676
32677
32678 // OpenCLGlobalHostAddressSpaceAttr implementation
32679
32680 OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32681 auto *A = new (Ctx) OpenCLGlobalHostAddressSpaceAttr(Ctx, CommonInfo);
32682 A->setImplicit(true);
32683 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32684 A->setAttributeSpellingListIndex(0);
32685 return A;
32686 }
32687
32688 OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32689 auto *A = new (Ctx) OpenCLGlobalHostAddressSpaceAttr(Ctx, CommonInfo);
32690 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32691 A->setAttributeSpellingListIndex(0);
32692 return A;
32693 }
32694
32695 OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
32696 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32697 switch (S) {
32698 case GNU_opencl_global_host:
32699 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32700 case CXX11_clang_opencl_global_host:
32701 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32702 case C23_clang_opencl_global_host:
32703 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32704 default:
32705 llvm_unreachable("Unknown attribute spelling!");
32706 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32707 }
32708 }());
32709 return CreateImplicit(Ctx, I);
32710 }
32711
32712 OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
32713 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32714 switch (S) {
32715 case GNU_opencl_global_host:
32716 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32717 case CXX11_clang_opencl_global_host:
32718 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32719 case C23_clang_opencl_global_host:
32720 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32721 default:
32722 llvm_unreachable("Unknown attribute spelling!");
32723 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32724 }
32725 }());
32726 return Create(Ctx, I);
32727 }
32728
32729 OpenCLGlobalHostAddressSpaceAttr::OpenCLGlobalHostAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
32730 )
32731 : TypeAttr(Ctx, CommonInfo, attr::OpenCLGlobalHostAddressSpace, /*IsLateParsed=*/false)
32732 {
32733 }
32734
32735 OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::clone(ASTContext &C) const {
32736 auto *A = new (C) OpenCLGlobalHostAddressSpaceAttr(C, *this);
32737 A->Inherited = Inherited;
32738 A->IsPackExpansion = IsPackExpansion;
32739 A->setImplicit(Implicit);
32740 return A;
32741 }
32742
32743 void OpenCLGlobalHostAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
32744 bool IsFirstArgument = true; (void)IsFirstArgument;
32745 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
32746 switch (getAttributeSpellingListIndex()) {
32747 default:
32748 llvm_unreachable("Unknown attribute spelling!");
32749 break;
32750 case 0 : {
32751 OS << "__attribute__((opencl_global_host";
32752 OS << "))";
32753 break;
32754 }
32755 case 1 : {
32756 OS << "[[clang::opencl_global_host";
32757 OS << "]]";
32758 break;
32759 }
32760 case 2 : {
32761 OS << "[[clang::opencl_global_host";
32762 OS << "]]";
32763 break;
32764 }
32765 }
32766 }
32767
32768 const char *OpenCLGlobalHostAddressSpaceAttr::getSpelling() const {
32769 switch (getAttributeSpellingListIndex()) {
32770 default:
32771 llvm_unreachable("Unknown attribute spelling!");
32772 return "(No spelling)";
32773 case 0:
32774 return "opencl_global_host";
32775 case 1:
32776 return "opencl_global_host";
32777 case 2:
32778 return "opencl_global_host";
32779 }
32780 }
32781
32782
32783 // OpenCLIntelReqdSubGroupSizeAttr implementation
32784
32785 OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned SubGroupSize, const AttributeCommonInfo &CommonInfo) {
32786 auto *A = new (Ctx) OpenCLIntelReqdSubGroupSizeAttr(Ctx, CommonInfo, SubGroupSize);
32787 A->setImplicit(true);
32788 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32789 A->setAttributeSpellingListIndex(0);
32790 return A;
32791 }
32792
32793 OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::Create(ASTContext &Ctx, unsigned SubGroupSize, const AttributeCommonInfo &CommonInfo) {
32794 auto *A = new (Ctx) OpenCLIntelReqdSubGroupSizeAttr(Ctx, CommonInfo, SubGroupSize);
32795 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32796 A->setAttributeSpellingListIndex(0);
32797 return A;
32798 }
32799
32800 OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned SubGroupSize, SourceRange Range) {
32801 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
32802 return CreateImplicit(Ctx, SubGroupSize, I);
32803 }
32804
32805 OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::Create(ASTContext &Ctx, unsigned SubGroupSize, SourceRange Range) {
32806 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
32807 return Create(Ctx, SubGroupSize, I);
32808 }
32809
32810 OpenCLIntelReqdSubGroupSizeAttr::OpenCLIntelReqdSubGroupSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
32811 , unsigned SubGroupSize
32812 )
32813 : InheritableAttr(Ctx, CommonInfo, attr::OpenCLIntelReqdSubGroupSize, /*IsLateParsed=*/false, false)
32814 , subGroupSize(SubGroupSize)
32815 {
32816 }
32817
32818
32819
32820 OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::clone(ASTContext &C) const {
32821 auto *A = new (C) OpenCLIntelReqdSubGroupSizeAttr(C, *this, subGroupSize);
32822 A->Inherited = Inherited;
32823 A->IsPackExpansion = IsPackExpansion;
32824 A->setImplicit(Implicit);
32825 return A;
32826 }
32827
32828 void OpenCLIntelReqdSubGroupSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
32829 bool IsFirstArgument = true; (void)IsFirstArgument;
32830 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
32831 switch (getAttributeSpellingListIndex()) {
32832 default:
32833 llvm_unreachable("Unknown attribute spelling!");
32834 break;
32835 case 0 : {
32836 OS << "__attribute__((intel_reqd_sub_group_size";
32837 DelimitAttributeArgument(OS, IsFirstArgument);
32838 OS << "" << getSubGroupSize() << "";
32839 if (!IsFirstArgument)
32840 OS << ")";
32841 OS << "))";
32842 break;
32843 }
32844 }
32845 }
32846
32847 const char *OpenCLIntelReqdSubGroupSizeAttr::getSpelling() const {
32848 switch (getAttributeSpellingListIndex()) {
32849 default:
32850 llvm_unreachable("Unknown attribute spelling!");
32851 return "(No spelling)";
32852 case 0:
32853 return "intel_reqd_sub_group_size";
32854 }
32855 }
32856
32857
32858 // OpenCLKernelAttr implementation
32859
32860 OpenCLKernelAttr *OpenCLKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32861 auto *A = new (Ctx) OpenCLKernelAttr(Ctx, CommonInfo);
32862 A->setImplicit(true);
32863 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32864 A->setAttributeSpellingListIndex(0);
32865 return A;
32866 }
32867
32868 OpenCLKernelAttr *OpenCLKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32869 auto *A = new (Ctx) OpenCLKernelAttr(Ctx, CommonInfo);
32870 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32871 A->setAttributeSpellingListIndex(0);
32872 return A;
32873 }
32874
32875 OpenCLKernelAttr *OpenCLKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
32876 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32877 switch (S) {
32878 case Keyword_kernel:
32879 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32880 default:
32881 llvm_unreachable("Unknown attribute spelling!");
32882 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32883 }
32884 }());
32885 return CreateImplicit(Ctx, I);
32886 }
32887
32888 OpenCLKernelAttr *OpenCLKernelAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
32889 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32890 switch (S) {
32891 case Keyword_kernel:
32892 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32893 default:
32894 llvm_unreachable("Unknown attribute spelling!");
32895 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32896 }
32897 }());
32898 return Create(Ctx, I);
32899 }
32900
32901 OpenCLKernelAttr::OpenCLKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
32902 )
32903 : InheritableAttr(Ctx, CommonInfo, attr::OpenCLKernel, /*IsLateParsed=*/false, false)
32904 {
32905 }
32906
32907 OpenCLKernelAttr *OpenCLKernelAttr::clone(ASTContext &C) const {
32908 auto *A = new (C) OpenCLKernelAttr(C, *this);
32909 A->Inherited = Inherited;
32910 A->IsPackExpansion = IsPackExpansion;
32911 A->setImplicit(Implicit);
32912 return A;
32913 }
32914
32915 void OpenCLKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
32916 bool IsFirstArgument = true; (void)IsFirstArgument;
32917 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
32918 switch (getAttributeSpellingListIndex()) {
32919 default:
32920 llvm_unreachable("Unknown attribute spelling!");
32921 break;
32922 case 0 : {
32923 OS << "__kernel";
32924 OS << "";
32925 break;
32926 }
32927 case 1 : {
32928 OS << "kernel";
32929 OS << "";
32930 break;
32931 }
32932 }
32933 }
32934
32935 const char *OpenCLKernelAttr::getSpelling() const {
32936 switch (getAttributeSpellingListIndex()) {
32937 default:
32938 llvm_unreachable("Unknown attribute spelling!");
32939 return "(No spelling)";
32940 case 0:
32941 return "__kernel";
32942 case 1:
32943 return "kernel";
32944 }
32945 }
32946
32947
32948 // OpenCLLocalAddressSpaceAttr implementation
32949
32950 OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32951 auto *A = new (Ctx) OpenCLLocalAddressSpaceAttr(Ctx, CommonInfo);
32952 A->setImplicit(true);
32953 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
32954 A->setAttributeSpellingListIndex(0);
32955 return A;
32956 }
32957
32958 OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
32959 auto *A = new (Ctx) OpenCLLocalAddressSpaceAttr(Ctx, CommonInfo);
32960 return A;
32961 }
32962
32963 OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
32964 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32965 switch (S) {
32966 case Keyword_local:
32967 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32968 case GNU_opencl_local:
32969 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32970 case CXX11_clang_opencl_local:
32971 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32972 case C23_clang_opencl_local:
32973 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32974 default:
32975 llvm_unreachable("Unknown attribute spelling!");
32976 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32977 }
32978 }());
32979 return CreateImplicit(Ctx, I);
32980 }
32981
32982 OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
32983 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
32984 switch (S) {
32985 case Keyword_local:
32986 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32987 case GNU_opencl_local:
32988 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32989 case CXX11_clang_opencl_local:
32990 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32991 case C23_clang_opencl_local:
32992 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32993 default:
32994 llvm_unreachable("Unknown attribute spelling!");
32995 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
32996 }
32997 }());
32998 return Create(Ctx, I);
32999 }
33000
33001 OpenCLLocalAddressSpaceAttr::OpenCLLocalAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33002 )
33003 : TypeAttr(Ctx, CommonInfo, attr::OpenCLLocalAddressSpace, /*IsLateParsed=*/false)
33004 {
33005 }
33006
33007 OpenCLLocalAddressSpaceAttr::Spelling OpenCLLocalAddressSpaceAttr::getSemanticSpelling() const {
33008 switch (getAttributeSpellingListIndex()) {
33009 default: llvm_unreachable("Unknown spelling list index");
33010 case 0: return Keyword_local;
33011 case 1: return Keyword_local;
33012 case 2: return GNU_opencl_local;
33013 case 3: return CXX11_clang_opencl_local;
33014 case 4: return C23_clang_opencl_local;
33015 }
33016 }
33017 OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::clone(ASTContext &C) const {
33018 auto *A = new (C) OpenCLLocalAddressSpaceAttr(C, *this);
33019 A->Inherited = Inherited;
33020 A->IsPackExpansion = IsPackExpansion;
33021 A->setImplicit(Implicit);
33022 return A;
33023 }
33024
33025 void OpenCLLocalAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
33026 bool IsFirstArgument = true; (void)IsFirstArgument;
33027 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
33028 switch (getAttributeSpellingListIndex()) {
33029 default:
33030 llvm_unreachable("Unknown attribute spelling!");
33031 break;
33032 case 0 : {
33033 OS << "__local";
33034 OS << "";
33035 break;
33036 }
33037 case 1 : {
33038 OS << "local";
33039 OS << "";
33040 break;
33041 }
33042 case 2 : {
33043 OS << "__attribute__((opencl_local";
33044 OS << "))";
33045 break;
33046 }
33047 case 3 : {
33048 OS << "[[clang::opencl_local";
33049 OS << "]]";
33050 break;
33051 }
33052 case 4 : {
33053 OS << "[[clang::opencl_local";
33054 OS << "]]";
33055 break;
33056 }
33057 }
33058 }
33059
33060 const char *OpenCLLocalAddressSpaceAttr::getSpelling() const {
33061 switch (getAttributeSpellingListIndex()) {
33062 default:
33063 llvm_unreachable("Unknown attribute spelling!");
33064 return "(No spelling)";
33065 case 0:
33066 return "__local";
33067 case 1:
33068 return "local";
33069 case 2:
33070 return "opencl_local";
33071 case 3:
33072 return "opencl_local";
33073 case 4:
33074 return "opencl_local";
33075 }
33076 }
33077
33078
33079 // OpenCLPrivateAddressSpaceAttr implementation
33080
33081 OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33082 auto *A = new (Ctx) OpenCLPrivateAddressSpaceAttr(Ctx, CommonInfo);
33083 A->setImplicit(true);
33084 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33085 A->setAttributeSpellingListIndex(0);
33086 return A;
33087 }
33088
33089 OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33090 auto *A = new (Ctx) OpenCLPrivateAddressSpaceAttr(Ctx, CommonInfo);
33091 return A;
33092 }
33093
33094 OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
33095 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33096 switch (S) {
33097 case Keyword_private:
33098 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33099 case GNU_opencl_private:
33100 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33101 case CXX11_clang_opencl_private:
33102 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33103 case C23_clang_opencl_private:
33104 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33105 default:
33106 llvm_unreachable("Unknown attribute spelling!");
33107 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33108 }
33109 }());
33110 return CreateImplicit(Ctx, I);
33111 }
33112
33113 OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
33114 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33115 switch (S) {
33116 case Keyword_private:
33117 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33118 case GNU_opencl_private:
33119 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33120 case CXX11_clang_opencl_private:
33121 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33122 case C23_clang_opencl_private:
33123 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33124 default:
33125 llvm_unreachable("Unknown attribute spelling!");
33126 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33127 }
33128 }());
33129 return Create(Ctx, I);
33130 }
33131
33132 OpenCLPrivateAddressSpaceAttr::OpenCLPrivateAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33133 )
33134 : TypeAttr(Ctx, CommonInfo, attr::OpenCLPrivateAddressSpace, /*IsLateParsed=*/false)
33135 {
33136 }
33137
33138 OpenCLPrivateAddressSpaceAttr::Spelling OpenCLPrivateAddressSpaceAttr::getSemanticSpelling() const {
33139 switch (getAttributeSpellingListIndex()) {
33140 default: llvm_unreachable("Unknown spelling list index");
33141 case 0: return Keyword_private;
33142 case 1: return Keyword_private;
33143 case 2: return GNU_opencl_private;
33144 case 3: return CXX11_clang_opencl_private;
33145 case 4: return C23_clang_opencl_private;
33146 }
33147 }
33148 OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::clone(ASTContext &C) const {
33149 auto *A = new (C) OpenCLPrivateAddressSpaceAttr(C, *this);
33150 A->Inherited = Inherited;
33151 A->IsPackExpansion = IsPackExpansion;
33152 A->setImplicit(Implicit);
33153 return A;
33154 }
33155
33156 void OpenCLPrivateAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
33157 bool IsFirstArgument = true; (void)IsFirstArgument;
33158 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
33159 switch (getAttributeSpellingListIndex()) {
33160 default:
33161 llvm_unreachable("Unknown attribute spelling!");
33162 break;
33163 case 0 : {
33164 OS << "__private";
33165 OS << "";
33166 break;
33167 }
33168 case 1 : {
33169 OS << "private";
33170 OS << "";
33171 break;
33172 }
33173 case 2 : {
33174 OS << "__attribute__((opencl_private";
33175 OS << "))";
33176 break;
33177 }
33178 case 3 : {
33179 OS << "[[clang::opencl_private";
33180 OS << "]]";
33181 break;
33182 }
33183 case 4 : {
33184 OS << "[[clang::opencl_private";
33185 OS << "]]";
33186 break;
33187 }
33188 }
33189 }
33190
33191 const char *OpenCLPrivateAddressSpaceAttr::getSpelling() const {
33192 switch (getAttributeSpellingListIndex()) {
33193 default:
33194 llvm_unreachable("Unknown attribute spelling!");
33195 return "(No spelling)";
33196 case 0:
33197 return "__private";
33198 case 1:
33199 return "private";
33200 case 2:
33201 return "opencl_private";
33202 case 3:
33203 return "opencl_private";
33204 case 4:
33205 return "opencl_private";
33206 }
33207 }
33208
33209
33210 // OpenCLUnrollHintAttr implementation
33211
33212 OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::CreateImplicit(ASTContext &Ctx, unsigned UnrollHint, const AttributeCommonInfo &CommonInfo) {
33213 auto *A = new (Ctx) OpenCLUnrollHintAttr(Ctx, CommonInfo, UnrollHint);
33214 A->setImplicit(true);
33215 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33216 A->setAttributeSpellingListIndex(0);
33217 return A;
33218 }
33219
33220 OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::Create(ASTContext &Ctx, unsigned UnrollHint, const AttributeCommonInfo &CommonInfo) {
33221 auto *A = new (Ctx) OpenCLUnrollHintAttr(Ctx, CommonInfo, UnrollHint);
33222 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33223 A->setAttributeSpellingListIndex(0);
33224 return A;
33225 }
33226
33227 OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::CreateImplicit(ASTContext &Ctx, unsigned UnrollHint, SourceRange Range) {
33228 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
33229 return CreateImplicit(Ctx, UnrollHint, I);
33230 }
33231
33232 OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::Create(ASTContext &Ctx, unsigned UnrollHint, SourceRange Range) {
33233 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
33234 return Create(Ctx, UnrollHint, I);
33235 }
33236
33237 OpenCLUnrollHintAttr::OpenCLUnrollHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33238 , unsigned UnrollHint
33239 )
33240 : StmtAttr(Ctx, CommonInfo, attr::OpenCLUnrollHint, /*IsLateParsed=*/false)
33241 , unrollHint(UnrollHint)
33242 {
33243 }
33244
33245 OpenCLUnrollHintAttr::OpenCLUnrollHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33246 )
33247 : StmtAttr(Ctx, CommonInfo, attr::OpenCLUnrollHint, /*IsLateParsed=*/false)
33248 , unrollHint()
33249 {
33250 }
33251
33252
33253
33254 OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::clone(ASTContext &C) const {
33255 auto *A = new (C) OpenCLUnrollHintAttr(C, *this, unrollHint);
33256 A->Inherited = Inherited;
33257 A->IsPackExpansion = IsPackExpansion;
33258 A->setImplicit(Implicit);
33259 return A;
33260 }
33261
33262 void OpenCLUnrollHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
33263 bool IsFirstArgument = true; (void)IsFirstArgument;
33264 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
33265 switch (getAttributeSpellingListIndex()) {
33266 default:
33267 llvm_unreachable("Unknown attribute spelling!");
33268 break;
33269 case 0 : {
33270 OS << "__attribute__((opencl_unroll_hint";
33271 DelimitAttributeArgument(OS, IsFirstArgument);
33272 OS << "" << getUnrollHint() << "";
33273 if (!IsFirstArgument)
33274 OS << ")";
33275 OS << "))";
33276 break;
33277 }
33278 }
33279 }
33280
33281 const char *OpenCLUnrollHintAttr::getSpelling() const {
33282 switch (getAttributeSpellingListIndex()) {
33283 default:
33284 llvm_unreachable("Unknown attribute spelling!");
33285 return "(No spelling)";
33286 case 0:
33287 return "opencl_unroll_hint";
33288 }
33289 }
33290
33291
33292 // OptimizeNoneAttr implementation
33293
33294 OptimizeNoneAttr *OptimizeNoneAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33295 auto *A = new (Ctx) OptimizeNoneAttr(Ctx, CommonInfo);
33296 A->setImplicit(true);
33297 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33298 A->setAttributeSpellingListIndex(0);
33299 return A;
33300 }
33301
33302 OptimizeNoneAttr *OptimizeNoneAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33303 auto *A = new (Ctx) OptimizeNoneAttr(Ctx, CommonInfo);
33304 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33305 A->setAttributeSpellingListIndex(0);
33306 return A;
33307 }
33308
33309 OptimizeNoneAttr *OptimizeNoneAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
33310 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33311 switch (S) {
33312 case GNU_optnone:
33313 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33314 case CXX11_clang_optnone:
33315 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33316 case C23_clang_optnone:
33317 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33318 default:
33319 llvm_unreachable("Unknown attribute spelling!");
33320 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33321 }
33322 }());
33323 return CreateImplicit(Ctx, I);
33324 }
33325
33326 OptimizeNoneAttr *OptimizeNoneAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
33327 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33328 switch (S) {
33329 case GNU_optnone:
33330 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33331 case CXX11_clang_optnone:
33332 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33333 case C23_clang_optnone:
33334 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33335 default:
33336 llvm_unreachable("Unknown attribute spelling!");
33337 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33338 }
33339 }());
33340 return Create(Ctx, I);
33341 }
33342
33343 OptimizeNoneAttr::OptimizeNoneAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33344 )
33345 : InheritableAttr(Ctx, CommonInfo, attr::OptimizeNone, /*IsLateParsed=*/false, false)
33346 {
33347 }
33348
33349 OptimizeNoneAttr *OptimizeNoneAttr::clone(ASTContext &C) const {
33350 auto *A = new (C) OptimizeNoneAttr(C, *this);
33351 A->Inherited = Inherited;
33352 A->IsPackExpansion = IsPackExpansion;
33353 A->setImplicit(Implicit);
33354 return A;
33355 }
33356
33357 void OptimizeNoneAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
33358 bool IsFirstArgument = true; (void)IsFirstArgument;
33359 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
33360 switch (getAttributeSpellingListIndex()) {
33361 default:
33362 llvm_unreachable("Unknown attribute spelling!");
33363 break;
33364 case 0 : {
33365 OS << "__attribute__((optnone";
33366 OS << "))";
33367 break;
33368 }
33369 case 1 : {
33370 OS << "[[clang::optnone";
33371 OS << "]]";
33372 break;
33373 }
33374 case 2 : {
33375 OS << "[[clang::optnone";
33376 OS << "]]";
33377 break;
33378 }
33379 }
33380 }
33381
33382 const char *OptimizeNoneAttr::getSpelling() const {
33383 switch (getAttributeSpellingListIndex()) {
33384 default:
33385 llvm_unreachable("Unknown attribute spelling!");
33386 return "(No spelling)";
33387 case 0:
33388 return "optnone";
33389 case 1:
33390 return "optnone";
33391 case 2:
33392 return "optnone";
33393 }
33394 }
33395
33396
33397 // OverloadableAttr implementation
33398
33399 OverloadableAttr *OverloadableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33400 auto *A = new (Ctx) OverloadableAttr(Ctx, CommonInfo);
33401 A->setImplicit(true);
33402 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33403 A->setAttributeSpellingListIndex(0);
33404 return A;
33405 }
33406
33407 OverloadableAttr *OverloadableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33408 auto *A = new (Ctx) OverloadableAttr(Ctx, CommonInfo);
33409 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33410 A->setAttributeSpellingListIndex(0);
33411 return A;
33412 }
33413
33414 OverloadableAttr *OverloadableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
33415 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33416 switch (S) {
33417 case GNU_overloadable:
33418 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33419 case CXX11_clang_overloadable:
33420 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33421 case C23_clang_overloadable:
33422 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33423 default:
33424 llvm_unreachable("Unknown attribute spelling!");
33425 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33426 }
33427 }());
33428 return CreateImplicit(Ctx, I);
33429 }
33430
33431 OverloadableAttr *OverloadableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
33432 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33433 switch (S) {
33434 case GNU_overloadable:
33435 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33436 case CXX11_clang_overloadable:
33437 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33438 case C23_clang_overloadable:
33439 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33440 default:
33441 llvm_unreachable("Unknown attribute spelling!");
33442 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33443 }
33444 }());
33445 return Create(Ctx, I);
33446 }
33447
33448 OverloadableAttr::OverloadableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33449 )
33450 : Attr(Ctx, CommonInfo, attr::Overloadable, /*IsLateParsed=*/false)
33451 {
33452 }
33453
33454 OverloadableAttr *OverloadableAttr::clone(ASTContext &C) const {
33455 auto *A = new (C) OverloadableAttr(C, *this);
33456 A->Inherited = Inherited;
33457 A->IsPackExpansion = IsPackExpansion;
33458 A->setImplicit(Implicit);
33459 return A;
33460 }
33461
33462 void OverloadableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
33463 bool IsFirstArgument = true; (void)IsFirstArgument;
33464 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
33465 switch (getAttributeSpellingListIndex()) {
33466 default:
33467 llvm_unreachable("Unknown attribute spelling!");
33468 break;
33469 case 0 : {
33470 OS << "__attribute__((overloadable";
33471 OS << "))";
33472 break;
33473 }
33474 case 1 : {
33475 OS << "[[clang::overloadable";
33476 OS << "]]";
33477 break;
33478 }
33479 case 2 : {
33480 OS << "[[clang::overloadable";
33481 OS << "]]";
33482 break;
33483 }
33484 }
33485 }
33486
33487 const char *OverloadableAttr::getSpelling() const {
33488 switch (getAttributeSpellingListIndex()) {
33489 default:
33490 llvm_unreachable("Unknown attribute spelling!");
33491 return "(No spelling)";
33492 case 0:
33493 return "overloadable";
33494 case 1:
33495 return "overloadable";
33496 case 2:
33497 return "overloadable";
33498 }
33499 }
33500
33501
33502 // OverrideAttr implementation
33503
33504 OverrideAttr *OverrideAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33505 auto *A = new (Ctx) OverrideAttr(Ctx, CommonInfo);
33506 A->setImplicit(true);
33507 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33508 A->setAttributeSpellingListIndex(0);
33509 return A;
33510 }
33511
33512 OverrideAttr *OverrideAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33513 auto *A = new (Ctx) OverrideAttr(Ctx, CommonInfo);
33514 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33515 A->setAttributeSpellingListIndex(0);
33516 return A;
33517 }
33518
33519 OverrideAttr *OverrideAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
33520 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
33521 return CreateImplicit(Ctx, I);
33522 }
33523
33524 OverrideAttr *OverrideAttr::Create(ASTContext &Ctx, SourceRange Range) {
33525 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
33526 return Create(Ctx, I);
33527 }
33528
33529 OverrideAttr::OverrideAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33530 )
33531 : InheritableAttr(Ctx, CommonInfo, attr::Override, /*IsLateParsed=*/false, false)
33532 {
33533 }
33534
33535 OverrideAttr *OverrideAttr::clone(ASTContext &C) const {
33536 auto *A = new (C) OverrideAttr(C, *this);
33537 A->Inherited = Inherited;
33538 A->IsPackExpansion = IsPackExpansion;
33539 A->setImplicit(Implicit);
33540 return A;
33541 }
33542
33543 void OverrideAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
33544 bool IsFirstArgument = true; (void)IsFirstArgument;
33545 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
33546 switch (getAttributeSpellingListIndex()) {
33547 default:
33548 llvm_unreachable("Unknown attribute spelling!");
33549 break;
33550 case 0 : {
33551 OS << "override";
33552 OS << "";
33553 break;
33554 }
33555 }
33556 }
33557
33558 const char *OverrideAttr::getSpelling() const {
33559 switch (getAttributeSpellingListIndex()) {
33560 default:
33561 llvm_unreachable("Unknown attribute spelling!");
33562 return "(No spelling)";
33563 case 0:
33564 return "override";
33565 }
33566 }
33567
33568
33569 // OwnerAttr implementation
33570
33571 OwnerAttr *OwnerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) {
33572 auto *A = new (Ctx) OwnerAttr(Ctx, CommonInfo, DerefType);
33573 A->setImplicit(true);
33574 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33575 A->setAttributeSpellingListIndex(0);
33576 return A;
33577 }
33578
33579 OwnerAttr *OwnerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) {
33580 auto *A = new (Ctx) OwnerAttr(Ctx, CommonInfo, DerefType);
33581 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33582 A->setAttributeSpellingListIndex(0);
33583 return A;
33584 }
33585
33586 OwnerAttr *OwnerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range) {
33587 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
33588 return CreateImplicit(Ctx, DerefType, I);
33589 }
33590
33591 OwnerAttr *OwnerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range) {
33592 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
33593 return Create(Ctx, DerefType, I);
33594 }
33595
33596 OwnerAttr::OwnerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33597 , TypeSourceInfo * DerefType
33598 )
33599 : InheritableAttr(Ctx, CommonInfo, attr::Owner, /*IsLateParsed=*/false, false)
33600 , derefType(DerefType)
33601 {
33602 }
33603
33604 OwnerAttr::OwnerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33605 )
33606 : InheritableAttr(Ctx, CommonInfo, attr::Owner, /*IsLateParsed=*/false, false)
33607 , derefType()
33608 {
33609 }
33610
33611
33612
33613 OwnerAttr *OwnerAttr::clone(ASTContext &C) const {
33614 auto *A = new (C) OwnerAttr(C, *this, derefType);
33615 A->Inherited = Inherited;
33616 A->IsPackExpansion = IsPackExpansion;
33617 A->setImplicit(Implicit);
33618 return A;
33619 }
33620
33621 void OwnerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
33622 bool IsFirstArgument = true; (void)IsFirstArgument;
33623 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
33624 switch (getAttributeSpellingListIndex()) {
33625 default:
33626 llvm_unreachable("Unknown attribute spelling!");
33627 break;
33628 case 0 : {
33629 OS << "[[gsl::Owner";
33630 if (!getDerefTypeLoc())
33631 ++TrailingOmittedArgs;
33632 if (!(!getDerefTypeLoc())) {
33633 DelimitAttributeArgument(OS, IsFirstArgument);
33634 OS << "" << getDerefType().getAsString() << "";
33635 }
33636 if (!IsFirstArgument)
33637 OS << ")";
33638 OS << "]]";
33639 break;
33640 }
33641 }
33642 }
33643
33644 const char *OwnerAttr::getSpelling() const {
33645 switch (getAttributeSpellingListIndex()) {
33646 default:
33647 llvm_unreachable("Unknown attribute spelling!");
33648 return "(No spelling)";
33649 case 0:
33650 return "Owner";
33651 }
33652 }
33653
33654
33655 // OwnershipAttr implementation
33656
33657 OwnershipAttr *OwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
33658 auto *A = new (Ctx) OwnershipAttr(Ctx, CommonInfo, Module, Args, ArgsSize);
33659 A->setImplicit(true);
33660 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33661 A->setAttributeSpellingListIndex(0);
33662 return A;
33663 }
33664
33665 OwnershipAttr *OwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
33666 auto *A = new (Ctx) OwnershipAttr(Ctx, CommonInfo, Module, Args, ArgsSize);
33667 return A;
33668 }
33669
33670 OwnershipAttr *OwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
33671 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33672 switch (S) {
33673 case GNU_ownership_holds:
33674 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33675 case CXX11_clang_ownership_holds:
33676 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33677 case C23_clang_ownership_holds:
33678 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33679 case GNU_ownership_returns:
33680 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33681 case CXX11_clang_ownership_returns:
33682 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33683 case C23_clang_ownership_returns:
33684 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33685 case GNU_ownership_takes:
33686 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33687 case CXX11_clang_ownership_takes:
33688 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33689 case C23_clang_ownership_takes:
33690 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33691 default:
33692 llvm_unreachable("Unknown attribute spelling!");
33693 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33694 }
33695 }());
33696 return CreateImplicit(Ctx, Module, Args, ArgsSize, I);
33697 }
33698
33699 OwnershipAttr *OwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
33700 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33701 switch (S) {
33702 case GNU_ownership_holds:
33703 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33704 case CXX11_clang_ownership_holds:
33705 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33706 case C23_clang_ownership_holds:
33707 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33708 case GNU_ownership_returns:
33709 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33710 case CXX11_clang_ownership_returns:
33711 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33712 case C23_clang_ownership_returns:
33713 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33714 case GNU_ownership_takes:
33715 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33716 case CXX11_clang_ownership_takes:
33717 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33718 case C23_clang_ownership_takes:
33719 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33720 default:
33721 llvm_unreachable("Unknown attribute spelling!");
33722 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33723 }
33724 }());
33725 return Create(Ctx, Module, Args, ArgsSize, I);
33726 }
33727
33728 OwnershipAttr::OwnershipAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33729 , IdentifierInfo * Module
33730 , ParamIdx *Args, unsigned ArgsSize
33731 )
33732 : InheritableAttr(Ctx, CommonInfo, attr::Ownership, /*IsLateParsed=*/false, false)
33733 , module(Module)
33734 , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size])
33735 {
33736 std::copy(Args, Args + args_Size, args_);
33737 }
33738
33739 OwnershipAttr::OwnershipAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33740 , IdentifierInfo * Module
33741 )
33742 : InheritableAttr(Ctx, CommonInfo, attr::Ownership, /*IsLateParsed=*/false, false)
33743 , module(Module)
33744 , args_Size(0), args_(nullptr)
33745 {
33746 }
33747
33748 OwnershipAttr::Spelling OwnershipAttr::getSemanticSpelling() const {
33749 switch (getAttributeSpellingListIndex()) {
33750 default: llvm_unreachable("Unknown spelling list index");
33751 case 0: return GNU_ownership_holds;
33752 case 1: return CXX11_clang_ownership_holds;
33753 case 2: return C23_clang_ownership_holds;
33754 case 3: return GNU_ownership_returns;
33755 case 4: return CXX11_clang_ownership_returns;
33756 case 5: return C23_clang_ownership_returns;
33757 case 6: return GNU_ownership_takes;
33758 case 7: return CXX11_clang_ownership_takes;
33759 case 8: return C23_clang_ownership_takes;
33760 }
33761 }
33762
33763
33764
33765
33766 OwnershipAttr *OwnershipAttr::clone(ASTContext &C) const {
33767 auto *A = new (C) OwnershipAttr(C, *this, module, args_, args_Size);
33768 A->Inherited = Inherited;
33769 A->IsPackExpansion = IsPackExpansion;
33770 A->setImplicit(Implicit);
33771 return A;
33772 }
33773
33774 void OwnershipAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
33775 bool IsFirstArgument = true; (void)IsFirstArgument;
33776 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
33777 switch (getAttributeSpellingListIndex()) {
33778 default:
33779 llvm_unreachable("Unknown attribute spelling!");
33780 break;
33781 case 0 : {
33782 OS << "__attribute__((ownership_holds";
33783 DelimitAttributeArgument(OS, IsFirstArgument);
33784 OS << "" << (getModule() ? getModule()->getName() : "") << "";
33785 OS << "";
33786 for (const auto &Val : args()) {
33787 DelimitAttributeArgument(OS, IsFirstArgument);
33788 OS << Val.getSourceIndex();
33789 }
33790 OS << "";
33791 if (!IsFirstArgument)
33792 OS << ")";
33793 OS << "))";
33794 break;
33795 }
33796 case 1 : {
33797 OS << "[[clang::ownership_holds";
33798 DelimitAttributeArgument(OS, IsFirstArgument);
33799 OS << "" << (getModule() ? getModule()->getName() : "") << "";
33800 OS << "";
33801 for (const auto &Val : args()) {
33802 DelimitAttributeArgument(OS, IsFirstArgument);
33803 OS << Val.getSourceIndex();
33804 }
33805 OS << "";
33806 if (!IsFirstArgument)
33807 OS << ")";
33808 OS << "]]";
33809 break;
33810 }
33811 case 2 : {
33812 OS << "[[clang::ownership_holds";
33813 DelimitAttributeArgument(OS, IsFirstArgument);
33814 OS << "" << (getModule() ? getModule()->getName() : "") << "";
33815 OS << "";
33816 for (const auto &Val : args()) {
33817 DelimitAttributeArgument(OS, IsFirstArgument);
33818 OS << Val.getSourceIndex();
33819 }
33820 OS << "";
33821 if (!IsFirstArgument)
33822 OS << ")";
33823 OS << "]]";
33824 break;
33825 }
33826 case 3 : {
33827 OS << "__attribute__((ownership_returns";
33828 DelimitAttributeArgument(OS, IsFirstArgument);
33829 OS << "" << (getModule() ? getModule()->getName() : "") << "";
33830 OS << "";
33831 for (const auto &Val : args()) {
33832 DelimitAttributeArgument(OS, IsFirstArgument);
33833 OS << Val.getSourceIndex();
33834 }
33835 OS << "";
33836 if (!IsFirstArgument)
33837 OS << ")";
33838 OS << "))";
33839 break;
33840 }
33841 case 4 : {
33842 OS << "[[clang::ownership_returns";
33843 DelimitAttributeArgument(OS, IsFirstArgument);
33844 OS << "" << (getModule() ? getModule()->getName() : "") << "";
33845 OS << "";
33846 for (const auto &Val : args()) {
33847 DelimitAttributeArgument(OS, IsFirstArgument);
33848 OS << Val.getSourceIndex();
33849 }
33850 OS << "";
33851 if (!IsFirstArgument)
33852 OS << ")";
33853 OS << "]]";
33854 break;
33855 }
33856 case 5 : {
33857 OS << "[[clang::ownership_returns";
33858 DelimitAttributeArgument(OS, IsFirstArgument);
33859 OS << "" << (getModule() ? getModule()->getName() : "") << "";
33860 OS << "";
33861 for (const auto &Val : args()) {
33862 DelimitAttributeArgument(OS, IsFirstArgument);
33863 OS << Val.getSourceIndex();
33864 }
33865 OS << "";
33866 if (!IsFirstArgument)
33867 OS << ")";
33868 OS << "]]";
33869 break;
33870 }
33871 case 6 : {
33872 OS << "__attribute__((ownership_takes";
33873 DelimitAttributeArgument(OS, IsFirstArgument);
33874 OS << "" << (getModule() ? getModule()->getName() : "") << "";
33875 OS << "";
33876 for (const auto &Val : args()) {
33877 DelimitAttributeArgument(OS, IsFirstArgument);
33878 OS << Val.getSourceIndex();
33879 }
33880 OS << "";
33881 if (!IsFirstArgument)
33882 OS << ")";
33883 OS << "))";
33884 break;
33885 }
33886 case 7 : {
33887 OS << "[[clang::ownership_takes";
33888 DelimitAttributeArgument(OS, IsFirstArgument);
33889 OS << "" << (getModule() ? getModule()->getName() : "") << "";
33890 OS << "";
33891 for (const auto &Val : args()) {
33892 DelimitAttributeArgument(OS, IsFirstArgument);
33893 OS << Val.getSourceIndex();
33894 }
33895 OS << "";
33896 if (!IsFirstArgument)
33897 OS << ")";
33898 OS << "]]";
33899 break;
33900 }
33901 case 8 : {
33902 OS << "[[clang::ownership_takes";
33903 DelimitAttributeArgument(OS, IsFirstArgument);
33904 OS << "" << (getModule() ? getModule()->getName() : "") << "";
33905 OS << "";
33906 for (const auto &Val : args()) {
33907 DelimitAttributeArgument(OS, IsFirstArgument);
33908 OS << Val.getSourceIndex();
33909 }
33910 OS << "";
33911 if (!IsFirstArgument)
33912 OS << ")";
33913 OS << "]]";
33914 break;
33915 }
33916 }
33917 }
33918
33919 const char *OwnershipAttr::getSpelling() const {
33920 switch (getAttributeSpellingListIndex()) {
33921 default:
33922 llvm_unreachable("Unknown attribute spelling!");
33923 return "(No spelling)";
33924 case 0:
33925 return "ownership_holds";
33926 case 1:
33927 return "ownership_holds";
33928 case 2:
33929 return "ownership_holds";
33930 case 3:
33931 return "ownership_returns";
33932 case 4:
33933 return "ownership_returns";
33934 case 5:
33935 return "ownership_returns";
33936 case 6:
33937 return "ownership_takes";
33938 case 7:
33939 return "ownership_takes";
33940 case 8:
33941 return "ownership_takes";
33942 }
33943 }
33944
33945
33946 // PackedAttr implementation
33947
33948 PackedAttr *PackedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33949 auto *A = new (Ctx) PackedAttr(Ctx, CommonInfo);
33950 A->setImplicit(true);
33951 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33952 A->setAttributeSpellingListIndex(0);
33953 return A;
33954 }
33955
33956 PackedAttr *PackedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
33957 auto *A = new (Ctx) PackedAttr(Ctx, CommonInfo);
33958 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
33959 A->setAttributeSpellingListIndex(0);
33960 return A;
33961 }
33962
33963 PackedAttr *PackedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
33964 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33965 switch (S) {
33966 case GNU_packed:
33967 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33968 case CXX11_gnu_packed:
33969 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33970 case C23_gnu_packed:
33971 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33972 default:
33973 llvm_unreachable("Unknown attribute spelling!");
33974 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33975 }
33976 }());
33977 return CreateImplicit(Ctx, I);
33978 }
33979
33980 PackedAttr *PackedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
33981 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
33982 switch (S) {
33983 case GNU_packed:
33984 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33985 case CXX11_gnu_packed:
33986 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33987 case C23_gnu_packed:
33988 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33989 default:
33990 llvm_unreachable("Unknown attribute spelling!");
33991 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
33992 }
33993 }());
33994 return Create(Ctx, I);
33995 }
33996
33997 PackedAttr::PackedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
33998 )
33999 : InheritableAttr(Ctx, CommonInfo, attr::Packed, /*IsLateParsed=*/false, false)
34000 {
34001 }
34002
34003 PackedAttr *PackedAttr::clone(ASTContext &C) const {
34004 auto *A = new (C) PackedAttr(C, *this);
34005 A->Inherited = Inherited;
34006 A->IsPackExpansion = IsPackExpansion;
34007 A->setImplicit(Implicit);
34008 return A;
34009 }
34010
34011 void PackedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
34012 bool IsFirstArgument = true; (void)IsFirstArgument;
34013 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
34014 switch (getAttributeSpellingListIndex()) {
34015 default:
34016 llvm_unreachable("Unknown attribute spelling!");
34017 break;
34018 case 0 : {
34019 OS << "__attribute__((packed";
34020 OS << "))";
34021 break;
34022 }
34023 case 1 : {
34024 OS << "[[gnu::packed";
34025 OS << "]]";
34026 break;
34027 }
34028 case 2 : {
34029 OS << "[[gnu::packed";
34030 OS << "]]";
34031 break;
34032 }
34033 }
34034 }
34035
34036 const char *PackedAttr::getSpelling() const {
34037 switch (getAttributeSpellingListIndex()) {
34038 default:
34039 llvm_unreachable("Unknown attribute spelling!");
34040 return "(No spelling)";
34041 case 0:
34042 return "packed";
34043 case 1:
34044 return "packed";
34045 case 2:
34046 return "packed";
34047 }
34048 }
34049
34050
34051 // ParamTypestateAttr implementation
34052
34053 ParamTypestateAttr *ParamTypestateAttr::CreateImplicit(ASTContext &Ctx, ParamTypestateAttr::ConsumedState ParamState, const AttributeCommonInfo &CommonInfo) {
34054 auto *A = new (Ctx) ParamTypestateAttr(Ctx, CommonInfo, ParamState);
34055 A->setImplicit(true);
34056 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34057 A->setAttributeSpellingListIndex(0);
34058 return A;
34059 }
34060
34061 ParamTypestateAttr *ParamTypestateAttr::Create(ASTContext &Ctx, ParamTypestateAttr::ConsumedState ParamState, const AttributeCommonInfo &CommonInfo) {
34062 auto *A = new (Ctx) ParamTypestateAttr(Ctx, CommonInfo, ParamState);
34063 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34064 A->setAttributeSpellingListIndex(0);
34065 return A;
34066 }
34067
34068 ParamTypestateAttr *ParamTypestateAttr::CreateImplicit(ASTContext &Ctx, ParamTypestateAttr::ConsumedState ParamState, SourceRange Range, Spelling S) {
34069 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34070 switch (S) {
34071 case GNU_param_typestate:
34072 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_param_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34073 case CXX11_clang_param_typestate:
34074 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_param_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34075 default:
34076 llvm_unreachable("Unknown attribute spelling!");
34077 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34078 }
34079 }());
34080 return CreateImplicit(Ctx, ParamState, I);
34081 }
34082
34083 ParamTypestateAttr *ParamTypestateAttr::Create(ASTContext &Ctx, ParamTypestateAttr::ConsumedState ParamState, SourceRange Range, Spelling S) {
34084 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34085 switch (S) {
34086 case GNU_param_typestate:
34087 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_param_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34088 case CXX11_clang_param_typestate:
34089 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_param_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34090 default:
34091 llvm_unreachable("Unknown attribute spelling!");
34092 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34093 }
34094 }());
34095 return Create(Ctx, ParamState, I);
34096 }
34097
34098 ParamTypestateAttr::ParamTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34099 , ParamTypestateAttr::ConsumedState ParamState
34100 )
34101 : InheritableAttr(Ctx, CommonInfo, attr::ParamTypestate, /*IsLateParsed=*/false, false)
34102 , paramState(ParamState)
34103 {
34104 }
34105
34106
34107
34108 bool ParamTypestateAttr::ConvertStrToConsumedState(StringRef Val, ParamTypestateAttr::ConsumedState &Out) {
34109 std::optional<ParamTypestateAttr::ConsumedState> R = llvm::StringSwitch<std::optional<ParamTypestateAttr::ConsumedState>>(Val)
34110 .Case("unknown", ParamTypestateAttr::ConsumedState::Unknown)
34111 .Case("consumed", ParamTypestateAttr::ConsumedState::Consumed)
34112 .Case("unconsumed", ParamTypestateAttr::ConsumedState::Unconsumed)
34113 .Default(std::optional<ParamTypestateAttr::ConsumedState>());
34114 if (R) {
34115 Out = *R;
34116 return true;
34117 }
34118 return false;
34119 }
34120
34121 const char *ParamTypestateAttr::ConvertConsumedStateToStr(ParamTypestateAttr::ConsumedState Val) {
34122 switch(Val) {
34123 case ParamTypestateAttr::ConsumedState::Unknown: return "unknown";
34124 case ParamTypestateAttr::ConsumedState::Consumed: return "consumed";
34125 case ParamTypestateAttr::ConsumedState::Unconsumed: return "unconsumed";
34126 }
34127 llvm_unreachable("No enumerator with that value");
34128 }
34129 ParamTypestateAttr *ParamTypestateAttr::clone(ASTContext &C) const {
34130 auto *A = new (C) ParamTypestateAttr(C, *this, paramState);
34131 A->Inherited = Inherited;
34132 A->IsPackExpansion = IsPackExpansion;
34133 A->setImplicit(Implicit);
34134 return A;
34135 }
34136
34137 void ParamTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
34138 bool IsFirstArgument = true; (void)IsFirstArgument;
34139 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
34140 switch (getAttributeSpellingListIndex()) {
34141 default:
34142 llvm_unreachable("Unknown attribute spelling!");
34143 break;
34144 case 0 : {
34145 OS << "__attribute__((param_typestate";
34146 DelimitAttributeArgument(OS, IsFirstArgument);
34147 OS << "\"" << ParamTypestateAttr::ConvertConsumedStateToStr(getParamState()) << "\"";
34148 if (!IsFirstArgument)
34149 OS << ")";
34150 OS << "))";
34151 break;
34152 }
34153 case 1 : {
34154 OS << "[[clang::param_typestate";
34155 DelimitAttributeArgument(OS, IsFirstArgument);
34156 OS << "\"" << ParamTypestateAttr::ConvertConsumedStateToStr(getParamState()) << "\"";
34157 if (!IsFirstArgument)
34158 OS << ")";
34159 OS << "]]";
34160 break;
34161 }
34162 }
34163 }
34164
34165 const char *ParamTypestateAttr::getSpelling() const {
34166 switch (getAttributeSpellingListIndex()) {
34167 default:
34168 llvm_unreachable("Unknown attribute spelling!");
34169 return "(No spelling)";
34170 case 0:
34171 return "param_typestate";
34172 case 1:
34173 return "param_typestate";
34174 }
34175 }
34176
34177
34178 // PascalAttr implementation
34179
34180 PascalAttr *PascalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
34181 auto *A = new (Ctx) PascalAttr(Ctx, CommonInfo);
34182 A->setImplicit(true);
34183 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34184 A->setAttributeSpellingListIndex(0);
34185 return A;
34186 }
34187
34188 PascalAttr *PascalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
34189 auto *A = new (Ctx) PascalAttr(Ctx, CommonInfo);
34190 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34191 A->setAttributeSpellingListIndex(0);
34192 return A;
34193 }
34194
34195 PascalAttr *PascalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
34196 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34197 switch (S) {
34198 case GNU_pascal:
34199 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34200 case CXX11_clang_pascal:
34201 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34202 case C23_clang_pascal:
34203 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34204 case Keyword_pascal:
34205 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34206 default:
34207 llvm_unreachable("Unknown attribute spelling!");
34208 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34209 }
34210 }());
34211 return CreateImplicit(Ctx, I);
34212 }
34213
34214 PascalAttr *PascalAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
34215 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34216 switch (S) {
34217 case GNU_pascal:
34218 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34219 case CXX11_clang_pascal:
34220 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34221 case C23_clang_pascal:
34222 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34223 case Keyword_pascal:
34224 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34225 default:
34226 llvm_unreachable("Unknown attribute spelling!");
34227 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34228 }
34229 }());
34230 return Create(Ctx, I);
34231 }
34232
34233 PascalAttr::PascalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34234 )
34235 : InheritableAttr(Ctx, CommonInfo, attr::Pascal, /*IsLateParsed=*/false, false)
34236 {
34237 }
34238
34239 PascalAttr *PascalAttr::clone(ASTContext &C) const {
34240 auto *A = new (C) PascalAttr(C, *this);
34241 A->Inherited = Inherited;
34242 A->IsPackExpansion = IsPackExpansion;
34243 A->setImplicit(Implicit);
34244 return A;
34245 }
34246
34247 void PascalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
34248 bool IsFirstArgument = true; (void)IsFirstArgument;
34249 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
34250 switch (getAttributeSpellingListIndex()) {
34251 default:
34252 llvm_unreachable("Unknown attribute spelling!");
34253 break;
34254 case 0 : {
34255 OS << "__attribute__((pascal";
34256 OS << "))";
34257 break;
34258 }
34259 case 1 : {
34260 OS << "[[clang::pascal";
34261 OS << "]]";
34262 break;
34263 }
34264 case 2 : {
34265 OS << "[[clang::pascal";
34266 OS << "]]";
34267 break;
34268 }
34269 case 3 : {
34270 OS << "__pascal";
34271 OS << "";
34272 break;
34273 }
34274 case 4 : {
34275 OS << "_pascal";
34276 OS << "";
34277 break;
34278 }
34279 }
34280 }
34281
34282 const char *PascalAttr::getSpelling() const {
34283 switch (getAttributeSpellingListIndex()) {
34284 default:
34285 llvm_unreachable("Unknown attribute spelling!");
34286 return "(No spelling)";
34287 case 0:
34288 return "pascal";
34289 case 1:
34290 return "pascal";
34291 case 2:
34292 return "pascal";
34293 case 3:
34294 return "__pascal";
34295 case 4:
34296 return "_pascal";
34297 }
34298 }
34299
34300
34301 // PassObjectSizeAttr implementation
34302
34303 PassObjectSizeAttr *PassObjectSizeAttr::CreateImplicit(ASTContext &Ctx, int Type, const AttributeCommonInfo &CommonInfo) {
34304 auto *A = new (Ctx) PassObjectSizeAttr(Ctx, CommonInfo, Type);
34305 A->setImplicit(true);
34306 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34307 A->setAttributeSpellingListIndex(0);
34308 return A;
34309 }
34310
34311 PassObjectSizeAttr *PassObjectSizeAttr::Create(ASTContext &Ctx, int Type, const AttributeCommonInfo &CommonInfo) {
34312 auto *A = new (Ctx) PassObjectSizeAttr(Ctx, CommonInfo, Type);
34313 return A;
34314 }
34315
34316 PassObjectSizeAttr *PassObjectSizeAttr::CreateImplicit(ASTContext &Ctx, int Type, SourceRange Range, Spelling S) {
34317 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34318 switch (S) {
34319 case GNU_pass_object_size:
34320 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34321 case CXX11_clang_pass_object_size:
34322 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34323 case C23_clang_pass_object_size:
34324 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34325 case GNU_pass_dynamic_object_size:
34326 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34327 case CXX11_clang_pass_dynamic_object_size:
34328 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34329 case C23_clang_pass_dynamic_object_size:
34330 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34331 default:
34332 llvm_unreachable("Unknown attribute spelling!");
34333 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34334 }
34335 }());
34336 return CreateImplicit(Ctx, Type, I);
34337 }
34338
34339 PassObjectSizeAttr *PassObjectSizeAttr::Create(ASTContext &Ctx, int Type, SourceRange Range, Spelling S) {
34340 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34341 switch (S) {
34342 case GNU_pass_object_size:
34343 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34344 case CXX11_clang_pass_object_size:
34345 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34346 case C23_clang_pass_object_size:
34347 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34348 case GNU_pass_dynamic_object_size:
34349 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34350 case CXX11_clang_pass_dynamic_object_size:
34351 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34352 case C23_clang_pass_dynamic_object_size:
34353 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34354 default:
34355 llvm_unreachable("Unknown attribute spelling!");
34356 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34357 }
34358 }());
34359 return Create(Ctx, Type, I);
34360 }
34361
34362 PassObjectSizeAttr::PassObjectSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34363 , int Type
34364 )
34365 : InheritableParamAttr(Ctx, CommonInfo, attr::PassObjectSize, /*IsLateParsed=*/false, false)
34366 , type(Type)
34367 {
34368 }
34369
34370 PassObjectSizeAttr::Spelling PassObjectSizeAttr::getSemanticSpelling() const {
34371 switch (getAttributeSpellingListIndex()) {
34372 default: llvm_unreachable("Unknown spelling list index");
34373 case 0: return GNU_pass_object_size;
34374 case 1: return CXX11_clang_pass_object_size;
34375 case 2: return C23_clang_pass_object_size;
34376 case 3: return GNU_pass_dynamic_object_size;
34377 case 4: return CXX11_clang_pass_dynamic_object_size;
34378 case 5: return C23_clang_pass_dynamic_object_size;
34379 }
34380 }
34381
34382
34383 PassObjectSizeAttr *PassObjectSizeAttr::clone(ASTContext &C) const {
34384 auto *A = new (C) PassObjectSizeAttr(C, *this, type);
34385 A->Inherited = Inherited;
34386 A->IsPackExpansion = IsPackExpansion;
34387 A->setImplicit(Implicit);
34388 return A;
34389 }
34390
34391 void PassObjectSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
34392 bool IsFirstArgument = true; (void)IsFirstArgument;
34393 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
34394 switch (getAttributeSpellingListIndex()) {
34395 default:
34396 llvm_unreachable("Unknown attribute spelling!");
34397 break;
34398 case 0 : {
34399 OS << "__attribute__((pass_object_size";
34400 DelimitAttributeArgument(OS, IsFirstArgument);
34401 OS << "" << getType() << "";
34402 if (!IsFirstArgument)
34403 OS << ")";
34404 OS << "))";
34405 break;
34406 }
34407 case 1 : {
34408 OS << "[[clang::pass_object_size";
34409 DelimitAttributeArgument(OS, IsFirstArgument);
34410 OS << "" << getType() << "";
34411 if (!IsFirstArgument)
34412 OS << ")";
34413 OS << "]]";
34414 break;
34415 }
34416 case 2 : {
34417 OS << "[[clang::pass_object_size";
34418 DelimitAttributeArgument(OS, IsFirstArgument);
34419 OS << "" << getType() << "";
34420 if (!IsFirstArgument)
34421 OS << ")";
34422 OS << "]]";
34423 break;
34424 }
34425 case 3 : {
34426 OS << "__attribute__((pass_dynamic_object_size";
34427 DelimitAttributeArgument(OS, IsFirstArgument);
34428 OS << "" << getType() << "";
34429 if (!IsFirstArgument)
34430 OS << ")";
34431 OS << "))";
34432 break;
34433 }
34434 case 4 : {
34435 OS << "[[clang::pass_dynamic_object_size";
34436 DelimitAttributeArgument(OS, IsFirstArgument);
34437 OS << "" << getType() << "";
34438 if (!IsFirstArgument)
34439 OS << ")";
34440 OS << "]]";
34441 break;
34442 }
34443 case 5 : {
34444 OS << "[[clang::pass_dynamic_object_size";
34445 DelimitAttributeArgument(OS, IsFirstArgument);
34446 OS << "" << getType() << "";
34447 if (!IsFirstArgument)
34448 OS << ")";
34449 OS << "]]";
34450 break;
34451 }
34452 }
34453 }
34454
34455 const char *PassObjectSizeAttr::getSpelling() const {
34456 switch (getAttributeSpellingListIndex()) {
34457 default:
34458 llvm_unreachable("Unknown attribute spelling!");
34459 return "(No spelling)";
34460 case 0:
34461 return "pass_object_size";
34462 case 1:
34463 return "pass_object_size";
34464 case 2:
34465 return "pass_object_size";
34466 case 3:
34467 return "pass_dynamic_object_size";
34468 case 4:
34469 return "pass_dynamic_object_size";
34470 case 5:
34471 return "pass_dynamic_object_size";
34472 }
34473 }
34474
34475
34476 // PatchableFunctionEntryAttr implementation
34477
34478 PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::CreateImplicit(ASTContext &Ctx, unsigned Count, int Offset, const AttributeCommonInfo &CommonInfo) {
34479 auto *A = new (Ctx) PatchableFunctionEntryAttr(Ctx, CommonInfo, Count, Offset);
34480 A->setImplicit(true);
34481 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34482 A->setAttributeSpellingListIndex(0);
34483 return A;
34484 }
34485
34486 PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::Create(ASTContext &Ctx, unsigned Count, int Offset, const AttributeCommonInfo &CommonInfo) {
34487 auto *A = new (Ctx) PatchableFunctionEntryAttr(Ctx, CommonInfo, Count, Offset);
34488 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34489 A->setAttributeSpellingListIndex(0);
34490 return A;
34491 }
34492
34493 PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::CreateImplicit(ASTContext &Ctx, unsigned Count, int Offset, SourceRange Range, Spelling S) {
34494 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34495 switch (S) {
34496 case GNU_patchable_function_entry:
34497 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34498 case CXX11_gnu_patchable_function_entry:
34499 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34500 case C23_gnu_patchable_function_entry:
34501 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34502 default:
34503 llvm_unreachable("Unknown attribute spelling!");
34504 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34505 }
34506 }());
34507 return CreateImplicit(Ctx, Count, Offset, I);
34508 }
34509
34510 PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::Create(ASTContext &Ctx, unsigned Count, int Offset, SourceRange Range, Spelling S) {
34511 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34512 switch (S) {
34513 case GNU_patchable_function_entry:
34514 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34515 case CXX11_gnu_patchable_function_entry:
34516 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34517 case C23_gnu_patchable_function_entry:
34518 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34519 default:
34520 llvm_unreachable("Unknown attribute spelling!");
34521 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34522 }
34523 }());
34524 return Create(Ctx, Count, Offset, I);
34525 }
34526
34527 PatchableFunctionEntryAttr::PatchableFunctionEntryAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34528 , unsigned Count
34529 , int Offset
34530 )
34531 : InheritableAttr(Ctx, CommonInfo, attr::PatchableFunctionEntry, /*IsLateParsed=*/false, false)
34532 , count(Count)
34533 , offset(Offset)
34534 {
34535 }
34536
34537 PatchableFunctionEntryAttr::PatchableFunctionEntryAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34538 , unsigned Count
34539 )
34540 : InheritableAttr(Ctx, CommonInfo, attr::PatchableFunctionEntry, /*IsLateParsed=*/false, false)
34541 , count(Count)
34542 , offset()
34543 {
34544 }
34545
34546
34547
34548
34549
34550 PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::clone(ASTContext &C) const {
34551 auto *A = new (C) PatchableFunctionEntryAttr(C, *this, count, offset);
34552 A->Inherited = Inherited;
34553 A->IsPackExpansion = IsPackExpansion;
34554 A->setImplicit(Implicit);
34555 return A;
34556 }
34557
34558 void PatchableFunctionEntryAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
34559 bool IsFirstArgument = true; (void)IsFirstArgument;
34560 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
34561 switch (getAttributeSpellingListIndex()) {
34562 default:
34563 llvm_unreachable("Unknown attribute spelling!");
34564 break;
34565 case 0 : {
34566 OS << "__attribute__((patchable_function_entry";
34567 DelimitAttributeArgument(OS, IsFirstArgument);
34568 OS << "" << getCount() << "";
34569 DelimitAttributeArgument(OS, IsFirstArgument);
34570 OS << "" << getOffset() << "";
34571 if (!IsFirstArgument)
34572 OS << ")";
34573 OS << "))";
34574 break;
34575 }
34576 case 1 : {
34577 OS << "[[gnu::patchable_function_entry";
34578 DelimitAttributeArgument(OS, IsFirstArgument);
34579 OS << "" << getCount() << "";
34580 DelimitAttributeArgument(OS, IsFirstArgument);
34581 OS << "" << getOffset() << "";
34582 if (!IsFirstArgument)
34583 OS << ")";
34584 OS << "]]";
34585 break;
34586 }
34587 case 2 : {
34588 OS << "[[gnu::patchable_function_entry";
34589 DelimitAttributeArgument(OS, IsFirstArgument);
34590 OS << "" << getCount() << "";
34591 DelimitAttributeArgument(OS, IsFirstArgument);
34592 OS << "" << getOffset() << "";
34593 if (!IsFirstArgument)
34594 OS << ")";
34595 OS << "]]";
34596 break;
34597 }
34598 }
34599 }
34600
34601 const char *PatchableFunctionEntryAttr::getSpelling() const {
34602 switch (getAttributeSpellingListIndex()) {
34603 default:
34604 llvm_unreachable("Unknown attribute spelling!");
34605 return "(No spelling)";
34606 case 0:
34607 return "patchable_function_entry";
34608 case 1:
34609 return "patchable_function_entry";
34610 case 2:
34611 return "patchable_function_entry";
34612 }
34613 }
34614
34615
34616 // PcsAttr implementation
34617
34618 PcsAttr *PcsAttr::CreateImplicit(ASTContext &Ctx, PcsAttr::PCSType PCS, const AttributeCommonInfo &CommonInfo) {
34619 auto *A = new (Ctx) PcsAttr(Ctx, CommonInfo, PCS);
34620 A->setImplicit(true);
34621 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34622 A->setAttributeSpellingListIndex(0);
34623 return A;
34624 }
34625
34626 PcsAttr *PcsAttr::Create(ASTContext &Ctx, PcsAttr::PCSType PCS, const AttributeCommonInfo &CommonInfo) {
34627 auto *A = new (Ctx) PcsAttr(Ctx, CommonInfo, PCS);
34628 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34629 A->setAttributeSpellingListIndex(0);
34630 return A;
34631 }
34632
34633 PcsAttr *PcsAttr::CreateImplicit(ASTContext &Ctx, PcsAttr::PCSType PCS, SourceRange Range, Spelling S) {
34634 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34635 switch (S) {
34636 case GNU_pcs:
34637 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34638 case CXX11_gnu_pcs:
34639 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34640 case C23_gnu_pcs:
34641 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34642 default:
34643 llvm_unreachable("Unknown attribute spelling!");
34644 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34645 }
34646 }());
34647 return CreateImplicit(Ctx, PCS, I);
34648 }
34649
34650 PcsAttr *PcsAttr::Create(ASTContext &Ctx, PcsAttr::PCSType PCS, SourceRange Range, Spelling S) {
34651 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
34652 switch (S) {
34653 case GNU_pcs:
34654 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34655 case CXX11_gnu_pcs:
34656 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34657 case C23_gnu_pcs:
34658 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34659 default:
34660 llvm_unreachable("Unknown attribute spelling!");
34661 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
34662 }
34663 }());
34664 return Create(Ctx, PCS, I);
34665 }
34666
34667 PcsAttr::PcsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34668 , PcsAttr::PCSType PCS
34669 )
34670 : InheritableAttr(Ctx, CommonInfo, attr::Pcs, /*IsLateParsed=*/false, false)
34671 , pCS(PCS)
34672 {
34673 }
34674
34675
34676
34677 bool PcsAttr::ConvertStrToPCSType(StringRef Val, PcsAttr::PCSType &Out) {
34678 std::optional<PcsAttr::PCSType> R = llvm::StringSwitch<std::optional<PcsAttr::PCSType>>(Val)
34679 .Case("aapcs", PcsAttr::PCSType::AAPCS)
34680 .Case("aapcs-vfp", PcsAttr::PCSType::AAPCS_VFP)
34681 .Default(std::optional<PcsAttr::PCSType>());
34682 if (R) {
34683 Out = *R;
34684 return true;
34685 }
34686 return false;
34687 }
34688
34689 const char *PcsAttr::ConvertPCSTypeToStr(PcsAttr::PCSType Val) {
34690 switch(Val) {
34691 case PcsAttr::PCSType::AAPCS: return "aapcs";
34692 case PcsAttr::PCSType::AAPCS_VFP: return "aapcs-vfp";
34693 }
34694 llvm_unreachable("No enumerator with that value");
34695 }
34696 PcsAttr *PcsAttr::clone(ASTContext &C) const {
34697 auto *A = new (C) PcsAttr(C, *this, pCS);
34698 A->Inherited = Inherited;
34699 A->IsPackExpansion = IsPackExpansion;
34700 A->setImplicit(Implicit);
34701 return A;
34702 }
34703
34704 void PcsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
34705 bool IsFirstArgument = true; (void)IsFirstArgument;
34706 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
34707 switch (getAttributeSpellingListIndex()) {
34708 default:
34709 llvm_unreachable("Unknown attribute spelling!");
34710 break;
34711 case 0 : {
34712 OS << "__attribute__((pcs";
34713 DelimitAttributeArgument(OS, IsFirstArgument);
34714 OS << "\"" << PcsAttr::ConvertPCSTypeToStr(getPCS()) << "\"";
34715 if (!IsFirstArgument)
34716 OS << ")";
34717 OS << "))";
34718 break;
34719 }
34720 case 1 : {
34721 OS << "[[gnu::pcs";
34722 DelimitAttributeArgument(OS, IsFirstArgument);
34723 OS << "\"" << PcsAttr::ConvertPCSTypeToStr(getPCS()) << "\"";
34724 if (!IsFirstArgument)
34725 OS << ")";
34726 OS << "]]";
34727 break;
34728 }
34729 case 2 : {
34730 OS << "[[gnu::pcs";
34731 DelimitAttributeArgument(OS, IsFirstArgument);
34732 OS << "\"" << PcsAttr::ConvertPCSTypeToStr(getPCS()) << "\"";
34733 if (!IsFirstArgument)
34734 OS << ")";
34735 OS << "]]";
34736 break;
34737 }
34738 }
34739 }
34740
34741 const char *PcsAttr::getSpelling() const {
34742 switch (getAttributeSpellingListIndex()) {
34743 default:
34744 llvm_unreachable("Unknown attribute spelling!");
34745 return "(No spelling)";
34746 case 0:
34747 return "pcs";
34748 case 1:
34749 return "pcs";
34750 case 2:
34751 return "pcs";
34752 }
34753 }
34754
34755
34756 // PointerAttr implementation
34757
34758 PointerAttr *PointerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) {
34759 auto *A = new (Ctx) PointerAttr(Ctx, CommonInfo, DerefType);
34760 A->setImplicit(true);
34761 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34762 A->setAttributeSpellingListIndex(0);
34763 return A;
34764 }
34765
34766 PointerAttr *PointerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) {
34767 auto *A = new (Ctx) PointerAttr(Ctx, CommonInfo, DerefType);
34768 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34769 A->setAttributeSpellingListIndex(0);
34770 return A;
34771 }
34772
34773 PointerAttr *PointerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range) {
34774 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
34775 return CreateImplicit(Ctx, DerefType, I);
34776 }
34777
34778 PointerAttr *PointerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range) {
34779 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
34780 return Create(Ctx, DerefType, I);
34781 }
34782
34783 PointerAttr::PointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34784 , TypeSourceInfo * DerefType
34785 )
34786 : InheritableAttr(Ctx, CommonInfo, attr::Pointer, /*IsLateParsed=*/false, false)
34787 , derefType(DerefType)
34788 {
34789 }
34790
34791 PointerAttr::PointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34792 )
34793 : InheritableAttr(Ctx, CommonInfo, attr::Pointer, /*IsLateParsed=*/false, false)
34794 , derefType()
34795 {
34796 }
34797
34798
34799
34800 PointerAttr *PointerAttr::clone(ASTContext &C) const {
34801 auto *A = new (C) PointerAttr(C, *this, derefType);
34802 A->Inherited = Inherited;
34803 A->IsPackExpansion = IsPackExpansion;
34804 A->setImplicit(Implicit);
34805 return A;
34806 }
34807
34808 void PointerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
34809 bool IsFirstArgument = true; (void)IsFirstArgument;
34810 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
34811 switch (getAttributeSpellingListIndex()) {
34812 default:
34813 llvm_unreachable("Unknown attribute spelling!");
34814 break;
34815 case 0 : {
34816 OS << "[[gsl::Pointer";
34817 if (!getDerefTypeLoc())
34818 ++TrailingOmittedArgs;
34819 if (!(!getDerefTypeLoc())) {
34820 DelimitAttributeArgument(OS, IsFirstArgument);
34821 OS << "" << getDerefType().getAsString() << "";
34822 }
34823 if (!IsFirstArgument)
34824 OS << ")";
34825 OS << "]]";
34826 break;
34827 }
34828 }
34829 }
34830
34831 const char *PointerAttr::getSpelling() const {
34832 switch (getAttributeSpellingListIndex()) {
34833 default:
34834 llvm_unreachable("Unknown attribute spelling!");
34835 return "(No spelling)";
34836 case 0:
34837 return "Pointer";
34838 }
34839 }
34840
34841
34842 // PragmaClangBSSSectionAttr implementation
34843
34844 PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
34845 auto *A = new (Ctx) PragmaClangBSSSectionAttr(Ctx, CommonInfo, Name);
34846 A->setImplicit(true);
34847 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34848 A->setAttributeSpellingListIndex(0);
34849 return A;
34850 }
34851
34852 PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
34853 auto *A = new (Ctx) PragmaClangBSSSectionAttr(Ctx, CommonInfo, Name);
34854 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34855 A->setAttributeSpellingListIndex(0);
34856 return A;
34857 }
34858
34859 PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
34860 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
34861 return CreateImplicit(Ctx, Name, I);
34862 }
34863
34864 PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
34865 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
34866 return Create(Ctx, Name, I);
34867 }
34868
34869 PragmaClangBSSSectionAttr::PragmaClangBSSSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34870 , llvm::StringRef Name
34871 )
34872 : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangBSSSection, /*IsLateParsed=*/false, false)
34873 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
34874 {
34875 if (!Name.empty())
34876 std::memcpy(name, Name.data(), nameLength);
34877 }
34878
34879
34880
34881 PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::clone(ASTContext &C) const {
34882 auto *A = new (C) PragmaClangBSSSectionAttr(C, *this, getName());
34883 A->Inherited = Inherited;
34884 A->IsPackExpansion = IsPackExpansion;
34885 A->setImplicit(Implicit);
34886 return A;
34887 }
34888
34889 void PragmaClangBSSSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
34890 }
34891
34892 const char *PragmaClangBSSSectionAttr::getSpelling() const {
34893 return "(No spelling)";
34894 }
34895
34896
34897 // PragmaClangDataSectionAttr implementation
34898
34899 PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
34900 auto *A = new (Ctx) PragmaClangDataSectionAttr(Ctx, CommonInfo, Name);
34901 A->setImplicit(true);
34902 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34903 A->setAttributeSpellingListIndex(0);
34904 return A;
34905 }
34906
34907 PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
34908 auto *A = new (Ctx) PragmaClangDataSectionAttr(Ctx, CommonInfo, Name);
34909 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34910 A->setAttributeSpellingListIndex(0);
34911 return A;
34912 }
34913
34914 PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
34915 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
34916 return CreateImplicit(Ctx, Name, I);
34917 }
34918
34919 PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
34920 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
34921 return Create(Ctx, Name, I);
34922 }
34923
34924 PragmaClangDataSectionAttr::PragmaClangDataSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34925 , llvm::StringRef Name
34926 )
34927 : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangDataSection, /*IsLateParsed=*/false, false)
34928 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
34929 {
34930 if (!Name.empty())
34931 std::memcpy(name, Name.data(), nameLength);
34932 }
34933
34934
34935
34936 PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::clone(ASTContext &C) const {
34937 auto *A = new (C) PragmaClangDataSectionAttr(C, *this, getName());
34938 A->Inherited = Inherited;
34939 A->IsPackExpansion = IsPackExpansion;
34940 A->setImplicit(Implicit);
34941 return A;
34942 }
34943
34944 void PragmaClangDataSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
34945 }
34946
34947 const char *PragmaClangDataSectionAttr::getSpelling() const {
34948 return "(No spelling)";
34949 }
34950
34951
34952 // PragmaClangRelroSectionAttr implementation
34953
34954 PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
34955 auto *A = new (Ctx) PragmaClangRelroSectionAttr(Ctx, CommonInfo, Name);
34956 A->setImplicit(true);
34957 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34958 A->setAttributeSpellingListIndex(0);
34959 return A;
34960 }
34961
34962 PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
34963 auto *A = new (Ctx) PragmaClangRelroSectionAttr(Ctx, CommonInfo, Name);
34964 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
34965 A->setAttributeSpellingListIndex(0);
34966 return A;
34967 }
34968
34969 PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
34970 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
34971 return CreateImplicit(Ctx, Name, I);
34972 }
34973
34974 PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
34975 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
34976 return Create(Ctx, Name, I);
34977 }
34978
34979 PragmaClangRelroSectionAttr::PragmaClangRelroSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
34980 , llvm::StringRef Name
34981 )
34982 : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangRelroSection, /*IsLateParsed=*/false, false)
34983 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
34984 {
34985 if (!Name.empty())
34986 std::memcpy(name, Name.data(), nameLength);
34987 }
34988
34989
34990
34991 PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::clone(ASTContext &C) const {
34992 auto *A = new (C) PragmaClangRelroSectionAttr(C, *this, getName());
34993 A->Inherited = Inherited;
34994 A->IsPackExpansion = IsPackExpansion;
34995 A->setImplicit(Implicit);
34996 return A;
34997 }
34998
34999 void PragmaClangRelroSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35000 }
35001
35002 const char *PragmaClangRelroSectionAttr::getSpelling() const {
35003 return "(No spelling)";
35004 }
35005
35006
35007 // PragmaClangRodataSectionAttr implementation
35008
35009 PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
35010 auto *A = new (Ctx) PragmaClangRodataSectionAttr(Ctx, CommonInfo, Name);
35011 A->setImplicit(true);
35012 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35013 A->setAttributeSpellingListIndex(0);
35014 return A;
35015 }
35016
35017 PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
35018 auto *A = new (Ctx) PragmaClangRodataSectionAttr(Ctx, CommonInfo, Name);
35019 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35020 A->setAttributeSpellingListIndex(0);
35021 return A;
35022 }
35023
35024 PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
35025 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
35026 return CreateImplicit(Ctx, Name, I);
35027 }
35028
35029 PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
35030 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
35031 return Create(Ctx, Name, I);
35032 }
35033
35034 PragmaClangRodataSectionAttr::PragmaClangRodataSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35035 , llvm::StringRef Name
35036 )
35037 : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangRodataSection, /*IsLateParsed=*/false, false)
35038 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
35039 {
35040 if (!Name.empty())
35041 std::memcpy(name, Name.data(), nameLength);
35042 }
35043
35044
35045
35046 PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::clone(ASTContext &C) const {
35047 auto *A = new (C) PragmaClangRodataSectionAttr(C, *this, getName());
35048 A->Inherited = Inherited;
35049 A->IsPackExpansion = IsPackExpansion;
35050 A->setImplicit(Implicit);
35051 return A;
35052 }
35053
35054 void PragmaClangRodataSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35055 }
35056
35057 const char *PragmaClangRodataSectionAttr::getSpelling() const {
35058 return "(No spelling)";
35059 }
35060
35061
35062 // PragmaClangTextSectionAttr implementation
35063
35064 PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
35065 auto *A = new (Ctx) PragmaClangTextSectionAttr(Ctx, CommonInfo, Name);
35066 A->setImplicit(true);
35067 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35068 A->setAttributeSpellingListIndex(0);
35069 return A;
35070 }
35071
35072 PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
35073 auto *A = new (Ctx) PragmaClangTextSectionAttr(Ctx, CommonInfo, Name);
35074 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35075 A->setAttributeSpellingListIndex(0);
35076 return A;
35077 }
35078
35079 PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
35080 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
35081 return CreateImplicit(Ctx, Name, I);
35082 }
35083
35084 PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
35085 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
35086 return Create(Ctx, Name, I);
35087 }
35088
35089 PragmaClangTextSectionAttr::PragmaClangTextSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35090 , llvm::StringRef Name
35091 )
35092 : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangTextSection, /*IsLateParsed=*/false, false)
35093 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
35094 {
35095 if (!Name.empty())
35096 std::memcpy(name, Name.data(), nameLength);
35097 }
35098
35099
35100
35101 PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::clone(ASTContext &C) const {
35102 auto *A = new (C) PragmaClangTextSectionAttr(C, *this, getName());
35103 A->Inherited = Inherited;
35104 A->IsPackExpansion = IsPackExpansion;
35105 A->setImplicit(Implicit);
35106 return A;
35107 }
35108
35109 void PragmaClangTextSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35110 }
35111
35112 const char *PragmaClangTextSectionAttr::getSpelling() const {
35113 return "(No spelling)";
35114 }
35115
35116
35117 // PreferredNameAttr implementation
35118
35119 PreferredNameAttr *PreferredNameAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypedefType, const AttributeCommonInfo &CommonInfo) {
35120 auto *A = new (Ctx) PreferredNameAttr(Ctx, CommonInfo, TypedefType);
35121 A->setImplicit(true);
35122 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35123 A->setAttributeSpellingListIndex(0);
35124 return A;
35125 }
35126
35127 PreferredNameAttr *PreferredNameAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypedefType, const AttributeCommonInfo &CommonInfo) {
35128 auto *A = new (Ctx) PreferredNameAttr(Ctx, CommonInfo, TypedefType);
35129 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35130 A->setAttributeSpellingListIndex(0);
35131 return A;
35132 }
35133
35134 PreferredNameAttr *PreferredNameAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypedefType, SourceRange Range, Spelling S) {
35135 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35136 switch (S) {
35137 case GNU_preferred_name:
35138 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preferred_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35139 case CXX11_clang_preferred_name:
35140 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preferred_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35141 default:
35142 llvm_unreachable("Unknown attribute spelling!");
35143 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35144 }
35145 }());
35146 return CreateImplicit(Ctx, TypedefType, I);
35147 }
35148
35149 PreferredNameAttr *PreferredNameAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypedefType, SourceRange Range, Spelling S) {
35150 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35151 switch (S) {
35152 case GNU_preferred_name:
35153 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preferred_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35154 case CXX11_clang_preferred_name:
35155 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preferred_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35156 default:
35157 llvm_unreachable("Unknown attribute spelling!");
35158 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35159 }
35160 }());
35161 return Create(Ctx, TypedefType, I);
35162 }
35163
35164 PreferredNameAttr::PreferredNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35165 , TypeSourceInfo * TypedefType
35166 )
35167 : InheritableAttr(Ctx, CommonInfo, attr::PreferredName, /*IsLateParsed=*/false, true)
35168 , typedefType(TypedefType)
35169 {
35170 }
35171
35172
35173
35174 PreferredNameAttr *PreferredNameAttr::clone(ASTContext &C) const {
35175 auto *A = new (C) PreferredNameAttr(C, *this, typedefType);
35176 A->Inherited = Inherited;
35177 A->IsPackExpansion = IsPackExpansion;
35178 A->setImplicit(Implicit);
35179 return A;
35180 }
35181
35182 void PreferredNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35183 bool IsFirstArgument = true; (void)IsFirstArgument;
35184 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
35185 switch (getAttributeSpellingListIndex()) {
35186 default:
35187 llvm_unreachable("Unknown attribute spelling!");
35188 break;
35189 case 0 : {
35190 OS << "__attribute__((preferred_name";
35191 DelimitAttributeArgument(OS, IsFirstArgument);
35192 OS << "" << getTypedefType().getAsString() << "";
35193 if (!IsFirstArgument)
35194 OS << ")";
35195 OS << "))";
35196 break;
35197 }
35198 case 1 : {
35199 OS << "[[clang::preferred_name";
35200 DelimitAttributeArgument(OS, IsFirstArgument);
35201 OS << "" << getTypedefType().getAsString() << "";
35202 if (!IsFirstArgument)
35203 OS << ")";
35204 OS << "]]";
35205 break;
35206 }
35207 }
35208 }
35209
35210 const char *PreferredNameAttr::getSpelling() const {
35211 switch (getAttributeSpellingListIndex()) {
35212 default:
35213 llvm_unreachable("Unknown attribute spelling!");
35214 return "(No spelling)";
35215 case 0:
35216 return "preferred_name";
35217 case 1:
35218 return "preferred_name";
35219 }
35220 }
35221
35222
35223 // PreferredTypeAttr implementation
35224
35225 PreferredTypeAttr *PreferredTypeAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Type, const AttributeCommonInfo &CommonInfo) {
35226 auto *A = new (Ctx) PreferredTypeAttr(Ctx, CommonInfo, Type);
35227 A->setImplicit(true);
35228 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35229 A->setAttributeSpellingListIndex(0);
35230 return A;
35231 }
35232
35233 PreferredTypeAttr *PreferredTypeAttr::Create(ASTContext &Ctx, TypeSourceInfo * Type, const AttributeCommonInfo &CommonInfo) {
35234 auto *A = new (Ctx) PreferredTypeAttr(Ctx, CommonInfo, Type);
35235 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35236 A->setAttributeSpellingListIndex(0);
35237 return A;
35238 }
35239
35240 PreferredTypeAttr *PreferredTypeAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Type, SourceRange Range, Spelling S) {
35241 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35242 switch (S) {
35243 case GNU_preferred_type:
35244 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35245 case CXX11_clang_preferred_type:
35246 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35247 case C23_clang_preferred_type:
35248 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35249 default:
35250 llvm_unreachable("Unknown attribute spelling!");
35251 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35252 }
35253 }());
35254 return CreateImplicit(Ctx, Type, I);
35255 }
35256
35257 PreferredTypeAttr *PreferredTypeAttr::Create(ASTContext &Ctx, TypeSourceInfo * Type, SourceRange Range, Spelling S) {
35258 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35259 switch (S) {
35260 case GNU_preferred_type:
35261 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35262 case CXX11_clang_preferred_type:
35263 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35264 case C23_clang_preferred_type:
35265 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35266 default:
35267 llvm_unreachable("Unknown attribute spelling!");
35268 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35269 }
35270 }());
35271 return Create(Ctx, Type, I);
35272 }
35273
35274 PreferredTypeAttr::PreferredTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35275 , TypeSourceInfo * Type
35276 )
35277 : InheritableAttr(Ctx, CommonInfo, attr::PreferredType, /*IsLateParsed=*/false, false)
35278 , type(Type)
35279 {
35280 }
35281
35282 PreferredTypeAttr::PreferredTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35283 )
35284 : InheritableAttr(Ctx, CommonInfo, attr::PreferredType, /*IsLateParsed=*/false, false)
35285 , type()
35286 {
35287 }
35288
35289
35290
35291 PreferredTypeAttr *PreferredTypeAttr::clone(ASTContext &C) const {
35292 auto *A = new (C) PreferredTypeAttr(C, *this, type);
35293 A->Inherited = Inherited;
35294 A->IsPackExpansion = IsPackExpansion;
35295 A->setImplicit(Implicit);
35296 return A;
35297 }
35298
35299 void PreferredTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35300 bool IsFirstArgument = true; (void)IsFirstArgument;
35301 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
35302 switch (getAttributeSpellingListIndex()) {
35303 default:
35304 llvm_unreachable("Unknown attribute spelling!");
35305 break;
35306 case 0 : {
35307 OS << "__attribute__((preferred_type";
35308 if (!getTypeLoc())
35309 ++TrailingOmittedArgs;
35310 if (!(!getTypeLoc())) {
35311 DelimitAttributeArgument(OS, IsFirstArgument);
35312 OS << "" << getType().getAsString() << "";
35313 }
35314 if (!IsFirstArgument)
35315 OS << ")";
35316 OS << "))";
35317 break;
35318 }
35319 case 1 : {
35320 OS << "[[clang::preferred_type";
35321 if (!getTypeLoc())
35322 ++TrailingOmittedArgs;
35323 if (!(!getTypeLoc())) {
35324 DelimitAttributeArgument(OS, IsFirstArgument);
35325 OS << "" << getType().getAsString() << "";
35326 }
35327 if (!IsFirstArgument)
35328 OS << ")";
35329 OS << "]]";
35330 break;
35331 }
35332 case 2 : {
35333 OS << "[[clang::preferred_type";
35334 if (!getTypeLoc())
35335 ++TrailingOmittedArgs;
35336 if (!(!getTypeLoc())) {
35337 DelimitAttributeArgument(OS, IsFirstArgument);
35338 OS << "" << getType().getAsString() << "";
35339 }
35340 if (!IsFirstArgument)
35341 OS << ")";
35342 OS << "]]";
35343 break;
35344 }
35345 }
35346 }
35347
35348 const char *PreferredTypeAttr::getSpelling() const {
35349 switch (getAttributeSpellingListIndex()) {
35350 default:
35351 llvm_unreachable("Unknown attribute spelling!");
35352 return "(No spelling)";
35353 case 0:
35354 return "preferred_type";
35355 case 1:
35356 return "preferred_type";
35357 case 2:
35358 return "preferred_type";
35359 }
35360 }
35361
35362
35363 // PreserveAllAttr implementation
35364
35365 PreserveAllAttr *PreserveAllAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35366 auto *A = new (Ctx) PreserveAllAttr(Ctx, CommonInfo);
35367 A->setImplicit(true);
35368 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35369 A->setAttributeSpellingListIndex(0);
35370 return A;
35371 }
35372
35373 PreserveAllAttr *PreserveAllAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35374 auto *A = new (Ctx) PreserveAllAttr(Ctx, CommonInfo);
35375 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35376 A->setAttributeSpellingListIndex(0);
35377 return A;
35378 }
35379
35380 PreserveAllAttr *PreserveAllAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
35381 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35382 switch (S) {
35383 case GNU_preserve_all:
35384 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35385 case CXX11_clang_preserve_all:
35386 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35387 case C23_clang_preserve_all:
35388 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35389 default:
35390 llvm_unreachable("Unknown attribute spelling!");
35391 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35392 }
35393 }());
35394 return CreateImplicit(Ctx, I);
35395 }
35396
35397 PreserveAllAttr *PreserveAllAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
35398 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35399 switch (S) {
35400 case GNU_preserve_all:
35401 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35402 case CXX11_clang_preserve_all:
35403 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35404 case C23_clang_preserve_all:
35405 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35406 default:
35407 llvm_unreachable("Unknown attribute spelling!");
35408 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35409 }
35410 }());
35411 return Create(Ctx, I);
35412 }
35413
35414 PreserveAllAttr::PreserveAllAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35415 )
35416 : InheritableAttr(Ctx, CommonInfo, attr::PreserveAll, /*IsLateParsed=*/false, false)
35417 {
35418 }
35419
35420 PreserveAllAttr *PreserveAllAttr::clone(ASTContext &C) const {
35421 auto *A = new (C) PreserveAllAttr(C, *this);
35422 A->Inherited = Inherited;
35423 A->IsPackExpansion = IsPackExpansion;
35424 A->setImplicit(Implicit);
35425 return A;
35426 }
35427
35428 void PreserveAllAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35429 bool IsFirstArgument = true; (void)IsFirstArgument;
35430 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
35431 switch (getAttributeSpellingListIndex()) {
35432 default:
35433 llvm_unreachable("Unknown attribute spelling!");
35434 break;
35435 case 0 : {
35436 OS << "__attribute__((preserve_all";
35437 OS << "))";
35438 break;
35439 }
35440 case 1 : {
35441 OS << "[[clang::preserve_all";
35442 OS << "]]";
35443 break;
35444 }
35445 case 2 : {
35446 OS << "[[clang::preserve_all";
35447 OS << "]]";
35448 break;
35449 }
35450 }
35451 }
35452
35453 const char *PreserveAllAttr::getSpelling() const {
35454 switch (getAttributeSpellingListIndex()) {
35455 default:
35456 llvm_unreachable("Unknown attribute spelling!");
35457 return "(No spelling)";
35458 case 0:
35459 return "preserve_all";
35460 case 1:
35461 return "preserve_all";
35462 case 2:
35463 return "preserve_all";
35464 }
35465 }
35466
35467
35468 // PreserveMostAttr implementation
35469
35470 PreserveMostAttr *PreserveMostAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35471 auto *A = new (Ctx) PreserveMostAttr(Ctx, CommonInfo);
35472 A->setImplicit(true);
35473 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35474 A->setAttributeSpellingListIndex(0);
35475 return A;
35476 }
35477
35478 PreserveMostAttr *PreserveMostAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35479 auto *A = new (Ctx) PreserveMostAttr(Ctx, CommonInfo);
35480 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35481 A->setAttributeSpellingListIndex(0);
35482 return A;
35483 }
35484
35485 PreserveMostAttr *PreserveMostAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
35486 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35487 switch (S) {
35488 case GNU_preserve_most:
35489 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35490 case CXX11_clang_preserve_most:
35491 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35492 case C23_clang_preserve_most:
35493 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35494 default:
35495 llvm_unreachable("Unknown attribute spelling!");
35496 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35497 }
35498 }());
35499 return CreateImplicit(Ctx, I);
35500 }
35501
35502 PreserveMostAttr *PreserveMostAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
35503 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35504 switch (S) {
35505 case GNU_preserve_most:
35506 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35507 case CXX11_clang_preserve_most:
35508 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35509 case C23_clang_preserve_most:
35510 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35511 default:
35512 llvm_unreachable("Unknown attribute spelling!");
35513 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35514 }
35515 }());
35516 return Create(Ctx, I);
35517 }
35518
35519 PreserveMostAttr::PreserveMostAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35520 )
35521 : InheritableAttr(Ctx, CommonInfo, attr::PreserveMost, /*IsLateParsed=*/false, false)
35522 {
35523 }
35524
35525 PreserveMostAttr *PreserveMostAttr::clone(ASTContext &C) const {
35526 auto *A = new (C) PreserveMostAttr(C, *this);
35527 A->Inherited = Inherited;
35528 A->IsPackExpansion = IsPackExpansion;
35529 A->setImplicit(Implicit);
35530 return A;
35531 }
35532
35533 void PreserveMostAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35534 bool IsFirstArgument = true; (void)IsFirstArgument;
35535 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
35536 switch (getAttributeSpellingListIndex()) {
35537 default:
35538 llvm_unreachable("Unknown attribute spelling!");
35539 break;
35540 case 0 : {
35541 OS << "__attribute__((preserve_most";
35542 OS << "))";
35543 break;
35544 }
35545 case 1 : {
35546 OS << "[[clang::preserve_most";
35547 OS << "]]";
35548 break;
35549 }
35550 case 2 : {
35551 OS << "[[clang::preserve_most";
35552 OS << "]]";
35553 break;
35554 }
35555 }
35556 }
35557
35558 const char *PreserveMostAttr::getSpelling() const {
35559 switch (getAttributeSpellingListIndex()) {
35560 default:
35561 llvm_unreachable("Unknown attribute spelling!");
35562 return "(No spelling)";
35563 case 0:
35564 return "preserve_most";
35565 case 1:
35566 return "preserve_most";
35567 case 2:
35568 return "preserve_most";
35569 }
35570 }
35571
35572
35573 // PreserveNoneAttr implementation
35574
35575 PreserveNoneAttr *PreserveNoneAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35576 auto *A = new (Ctx) PreserveNoneAttr(Ctx, CommonInfo);
35577 A->setImplicit(true);
35578 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35579 A->setAttributeSpellingListIndex(0);
35580 return A;
35581 }
35582
35583 PreserveNoneAttr *PreserveNoneAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35584 auto *A = new (Ctx) PreserveNoneAttr(Ctx, CommonInfo);
35585 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35586 A->setAttributeSpellingListIndex(0);
35587 return A;
35588 }
35589
35590 PreserveNoneAttr *PreserveNoneAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
35591 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35592 switch (S) {
35593 case GNU_preserve_none:
35594 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35595 case CXX11_clang_preserve_none:
35596 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35597 case C23_clang_preserve_none:
35598 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35599 default:
35600 llvm_unreachable("Unknown attribute spelling!");
35601 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35602 }
35603 }());
35604 return CreateImplicit(Ctx, I);
35605 }
35606
35607 PreserveNoneAttr *PreserveNoneAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
35608 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35609 switch (S) {
35610 case GNU_preserve_none:
35611 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35612 case CXX11_clang_preserve_none:
35613 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35614 case C23_clang_preserve_none:
35615 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35616 default:
35617 llvm_unreachable("Unknown attribute spelling!");
35618 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35619 }
35620 }());
35621 return Create(Ctx, I);
35622 }
35623
35624 PreserveNoneAttr::PreserveNoneAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35625 )
35626 : InheritableAttr(Ctx, CommonInfo, attr::PreserveNone, /*IsLateParsed=*/false, false)
35627 {
35628 }
35629
35630 PreserveNoneAttr *PreserveNoneAttr::clone(ASTContext &C) const {
35631 auto *A = new (C) PreserveNoneAttr(C, *this);
35632 A->Inherited = Inherited;
35633 A->IsPackExpansion = IsPackExpansion;
35634 A->setImplicit(Implicit);
35635 return A;
35636 }
35637
35638 void PreserveNoneAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35639 bool IsFirstArgument = true; (void)IsFirstArgument;
35640 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
35641 switch (getAttributeSpellingListIndex()) {
35642 default:
35643 llvm_unreachable("Unknown attribute spelling!");
35644 break;
35645 case 0 : {
35646 OS << "__attribute__((preserve_none";
35647 OS << "))";
35648 break;
35649 }
35650 case 1 : {
35651 OS << "[[clang::preserve_none";
35652 OS << "]]";
35653 break;
35654 }
35655 case 2 : {
35656 OS << "[[clang::preserve_none";
35657 OS << "]]";
35658 break;
35659 }
35660 }
35661 }
35662
35663 const char *PreserveNoneAttr::getSpelling() const {
35664 switch (getAttributeSpellingListIndex()) {
35665 default:
35666 llvm_unreachable("Unknown attribute spelling!");
35667 return "(No spelling)";
35668 case 0:
35669 return "preserve_none";
35670 case 1:
35671 return "preserve_none";
35672 case 2:
35673 return "preserve_none";
35674 }
35675 }
35676
35677
35678 // PtGuardedByAttr implementation
35679
35680 PtGuardedByAttr *PtGuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) {
35681 auto *A = new (Ctx) PtGuardedByAttr(Ctx, CommonInfo, Arg);
35682 A->setImplicit(true);
35683 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35684 A->setAttributeSpellingListIndex(0);
35685 return A;
35686 }
35687
35688 PtGuardedByAttr *PtGuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) {
35689 auto *A = new (Ctx) PtGuardedByAttr(Ctx, CommonInfo, Arg);
35690 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35691 A->setAttributeSpellingListIndex(0);
35692 return A;
35693 }
35694
35695 PtGuardedByAttr *PtGuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Range) {
35696 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
35697 return CreateImplicit(Ctx, Arg, I);
35698 }
35699
35700 PtGuardedByAttr *PtGuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, SourceRange Range) {
35701 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
35702 return Create(Ctx, Arg, I);
35703 }
35704
35705 PtGuardedByAttr::PtGuardedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35706 , Expr * Arg
35707 )
35708 : InheritableAttr(Ctx, CommonInfo, attr::PtGuardedBy, /*IsLateParsed=*/true, true)
35709 , arg(Arg)
35710 {
35711 }
35712
35713
35714
35715 PtGuardedByAttr *PtGuardedByAttr::clone(ASTContext &C) const {
35716 auto *A = new (C) PtGuardedByAttr(C, *this, arg);
35717 A->Inherited = Inherited;
35718 A->IsPackExpansion = IsPackExpansion;
35719 A->setImplicit(Implicit);
35720 return A;
35721 }
35722
35723 void PtGuardedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35724 bool IsFirstArgument = true; (void)IsFirstArgument;
35725 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
35726 switch (getAttributeSpellingListIndex()) {
35727 default:
35728 llvm_unreachable("Unknown attribute spelling!");
35729 break;
35730 case 0 : {
35731 OS << "__attribute__((pt_guarded_by";
35732 DelimitAttributeArgument(OS, IsFirstArgument);
35733 OS << "";
35734 getArg()->printPretty(OS, nullptr, Policy);
35735 OS << "";
35736 if (!IsFirstArgument)
35737 OS << ")";
35738 OS << "))";
35739 break;
35740 }
35741 }
35742 }
35743
35744 const char *PtGuardedByAttr::getSpelling() const {
35745 switch (getAttributeSpellingListIndex()) {
35746 default:
35747 llvm_unreachable("Unknown attribute spelling!");
35748 return "(No spelling)";
35749 case 0:
35750 return "pt_guarded_by";
35751 }
35752 }
35753
35754
35755 // PtGuardedVarAttr implementation
35756
35757 PtGuardedVarAttr *PtGuardedVarAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35758 auto *A = new (Ctx) PtGuardedVarAttr(Ctx, CommonInfo);
35759 A->setImplicit(true);
35760 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35761 A->setAttributeSpellingListIndex(0);
35762 return A;
35763 }
35764
35765 PtGuardedVarAttr *PtGuardedVarAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35766 auto *A = new (Ctx) PtGuardedVarAttr(Ctx, CommonInfo);
35767 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35768 A->setAttributeSpellingListIndex(0);
35769 return A;
35770 }
35771
35772 PtGuardedVarAttr *PtGuardedVarAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
35773 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35774 switch (S) {
35775 case GNU_pt_guarded_var:
35776 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pt_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35777 case CXX11_clang_pt_guarded_var:
35778 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pt_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35779 default:
35780 llvm_unreachable("Unknown attribute spelling!");
35781 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35782 }
35783 }());
35784 return CreateImplicit(Ctx, I);
35785 }
35786
35787 PtGuardedVarAttr *PtGuardedVarAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
35788 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
35789 switch (S) {
35790 case GNU_pt_guarded_var:
35791 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pt_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35792 case CXX11_clang_pt_guarded_var:
35793 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pt_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35794 default:
35795 llvm_unreachable("Unknown attribute spelling!");
35796 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
35797 }
35798 }());
35799 return Create(Ctx, I);
35800 }
35801
35802 PtGuardedVarAttr::PtGuardedVarAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35803 )
35804 : InheritableAttr(Ctx, CommonInfo, attr::PtGuardedVar, /*IsLateParsed=*/false, false)
35805 {
35806 }
35807
35808 PtGuardedVarAttr *PtGuardedVarAttr::clone(ASTContext &C) const {
35809 auto *A = new (C) PtGuardedVarAttr(C, *this);
35810 A->Inherited = Inherited;
35811 A->IsPackExpansion = IsPackExpansion;
35812 A->setImplicit(Implicit);
35813 return A;
35814 }
35815
35816 void PtGuardedVarAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35817 bool IsFirstArgument = true; (void)IsFirstArgument;
35818 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
35819 switch (getAttributeSpellingListIndex()) {
35820 default:
35821 llvm_unreachable("Unknown attribute spelling!");
35822 break;
35823 case 0 : {
35824 OS << "__attribute__((pt_guarded_var";
35825 OS << "))";
35826 break;
35827 }
35828 case 1 : {
35829 OS << "[[clang::pt_guarded_var";
35830 OS << "]]";
35831 break;
35832 }
35833 }
35834 }
35835
35836 const char *PtGuardedVarAttr::getSpelling() const {
35837 switch (getAttributeSpellingListIndex()) {
35838 default:
35839 llvm_unreachable("Unknown attribute spelling!");
35840 return "(No spelling)";
35841 case 0:
35842 return "pt_guarded_var";
35843 case 1:
35844 return "pt_guarded_var";
35845 }
35846 }
35847
35848
35849 // Ptr32Attr implementation
35850
35851 Ptr32Attr *Ptr32Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35852 auto *A = new (Ctx) Ptr32Attr(Ctx, CommonInfo);
35853 A->setImplicit(true);
35854 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35855 A->setAttributeSpellingListIndex(0);
35856 return A;
35857 }
35858
35859 Ptr32Attr *Ptr32Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35860 auto *A = new (Ctx) Ptr32Attr(Ctx, CommonInfo);
35861 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35862 A->setAttributeSpellingListIndex(0);
35863 return A;
35864 }
35865
35866 Ptr32Attr *Ptr32Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
35867 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
35868 return CreateImplicit(Ctx, I);
35869 }
35870
35871 Ptr32Attr *Ptr32Attr::Create(ASTContext &Ctx, SourceRange Range) {
35872 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
35873 return Create(Ctx, I);
35874 }
35875
35876 Ptr32Attr::Ptr32Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35877 )
35878 : TypeAttr(Ctx, CommonInfo, attr::Ptr32, /*IsLateParsed=*/false)
35879 {
35880 }
35881
35882 Ptr32Attr *Ptr32Attr::clone(ASTContext &C) const {
35883 auto *A = new (C) Ptr32Attr(C, *this);
35884 A->Inherited = Inherited;
35885 A->IsPackExpansion = IsPackExpansion;
35886 A->setImplicit(Implicit);
35887 return A;
35888 }
35889
35890 void Ptr32Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35891 bool IsFirstArgument = true; (void)IsFirstArgument;
35892 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
35893 switch (getAttributeSpellingListIndex()) {
35894 default:
35895 llvm_unreachable("Unknown attribute spelling!");
35896 break;
35897 case 0 : {
35898 OS << "__ptr32";
35899 OS << "";
35900 break;
35901 }
35902 }
35903 }
35904
35905 const char *Ptr32Attr::getSpelling() const {
35906 switch (getAttributeSpellingListIndex()) {
35907 default:
35908 llvm_unreachable("Unknown attribute spelling!");
35909 return "(No spelling)";
35910 case 0:
35911 return "__ptr32";
35912 }
35913 }
35914
35915
35916 // Ptr64Attr implementation
35917
35918 Ptr64Attr *Ptr64Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35919 auto *A = new (Ctx) Ptr64Attr(Ctx, CommonInfo);
35920 A->setImplicit(true);
35921 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35922 A->setAttributeSpellingListIndex(0);
35923 return A;
35924 }
35925
35926 Ptr64Attr *Ptr64Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35927 auto *A = new (Ctx) Ptr64Attr(Ctx, CommonInfo);
35928 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35929 A->setAttributeSpellingListIndex(0);
35930 return A;
35931 }
35932
35933 Ptr64Attr *Ptr64Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
35934 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
35935 return CreateImplicit(Ctx, I);
35936 }
35937
35938 Ptr64Attr *Ptr64Attr::Create(ASTContext &Ctx, SourceRange Range) {
35939 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
35940 return Create(Ctx, I);
35941 }
35942
35943 Ptr64Attr::Ptr64Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
35944 )
35945 : TypeAttr(Ctx, CommonInfo, attr::Ptr64, /*IsLateParsed=*/false)
35946 {
35947 }
35948
35949 Ptr64Attr *Ptr64Attr::clone(ASTContext &C) const {
35950 auto *A = new (C) Ptr64Attr(C, *this);
35951 A->Inherited = Inherited;
35952 A->IsPackExpansion = IsPackExpansion;
35953 A->setImplicit(Implicit);
35954 return A;
35955 }
35956
35957 void Ptr64Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
35958 bool IsFirstArgument = true; (void)IsFirstArgument;
35959 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
35960 switch (getAttributeSpellingListIndex()) {
35961 default:
35962 llvm_unreachable("Unknown attribute spelling!");
35963 break;
35964 case 0 : {
35965 OS << "__ptr64";
35966 OS << "";
35967 break;
35968 }
35969 }
35970 }
35971
35972 const char *Ptr64Attr::getSpelling() const {
35973 switch (getAttributeSpellingListIndex()) {
35974 default:
35975 llvm_unreachable("Unknown attribute spelling!");
35976 return "(No spelling)";
35977 case 0:
35978 return "__ptr64";
35979 }
35980 }
35981
35982
35983 // PureAttr implementation
35984
35985 PureAttr *PureAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35986 auto *A = new (Ctx) PureAttr(Ctx, CommonInfo);
35987 A->setImplicit(true);
35988 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35989 A->setAttributeSpellingListIndex(0);
35990 return A;
35991 }
35992
35993 PureAttr *PureAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
35994 auto *A = new (Ctx) PureAttr(Ctx, CommonInfo);
35995 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
35996 A->setAttributeSpellingListIndex(0);
35997 return A;
35998 }
35999
36000 PureAttr *PureAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
36001 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36002 switch (S) {
36003 case GNU_pure:
36004 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36005 case CXX11_gnu_pure:
36006 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36007 case C23_gnu_pure:
36008 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36009 default:
36010 llvm_unreachable("Unknown attribute spelling!");
36011 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36012 }
36013 }());
36014 return CreateImplicit(Ctx, I);
36015 }
36016
36017 PureAttr *PureAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
36018 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36019 switch (S) {
36020 case GNU_pure:
36021 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36022 case CXX11_gnu_pure:
36023 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36024 case C23_gnu_pure:
36025 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36026 default:
36027 llvm_unreachable("Unknown attribute spelling!");
36028 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36029 }
36030 }());
36031 return Create(Ctx, I);
36032 }
36033
36034 PureAttr::PureAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36035 )
36036 : InheritableAttr(Ctx, CommonInfo, attr::Pure, /*IsLateParsed=*/false, false)
36037 {
36038 }
36039
36040 PureAttr *PureAttr::clone(ASTContext &C) const {
36041 auto *A = new (C) PureAttr(C, *this);
36042 A->Inherited = Inherited;
36043 A->IsPackExpansion = IsPackExpansion;
36044 A->setImplicit(Implicit);
36045 return A;
36046 }
36047
36048 void PureAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
36049 bool IsFirstArgument = true; (void)IsFirstArgument;
36050 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
36051 switch (getAttributeSpellingListIndex()) {
36052 default:
36053 llvm_unreachable("Unknown attribute spelling!");
36054 break;
36055 case 0 : {
36056 OS << "__attribute__((pure";
36057 OS << "))";
36058 break;
36059 }
36060 case 1 : {
36061 OS << "[[gnu::pure";
36062 OS << "]]";
36063 break;
36064 }
36065 case 2 : {
36066 OS << "[[gnu::pure";
36067 OS << "]]";
36068 break;
36069 }
36070 }
36071 }
36072
36073 const char *PureAttr::getSpelling() const {
36074 switch (getAttributeSpellingListIndex()) {
36075 default:
36076 llvm_unreachable("Unknown attribute spelling!");
36077 return "(No spelling)";
36078 case 0:
36079 return "pure";
36080 case 1:
36081 return "pure";
36082 case 2:
36083 return "pure";
36084 }
36085 }
36086
36087
36088 // RISCVInterruptAttr implementation
36089
36090 RISCVInterruptAttr *RISCVInterruptAttr::CreateImplicit(ASTContext &Ctx, RISCVInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) {
36091 auto *A = new (Ctx) RISCVInterruptAttr(Ctx, CommonInfo, Interrupt);
36092 A->setImplicit(true);
36093 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36094 A->setAttributeSpellingListIndex(0);
36095 return A;
36096 }
36097
36098 RISCVInterruptAttr *RISCVInterruptAttr::Create(ASTContext &Ctx, RISCVInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) {
36099 auto *A = new (Ctx) RISCVInterruptAttr(Ctx, CommonInfo, Interrupt);
36100 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36101 A->setAttributeSpellingListIndex(0);
36102 return A;
36103 }
36104
36105 RISCVInterruptAttr *RISCVInterruptAttr::CreateImplicit(ASTContext &Ctx, RISCVInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) {
36106 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36107 switch (S) {
36108 case GNU_interrupt:
36109 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36110 case CXX11_gnu_interrupt:
36111 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36112 case C23_gnu_interrupt:
36113 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36114 default:
36115 llvm_unreachable("Unknown attribute spelling!");
36116 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36117 }
36118 }());
36119 return CreateImplicit(Ctx, Interrupt, I);
36120 }
36121
36122 RISCVInterruptAttr *RISCVInterruptAttr::Create(ASTContext &Ctx, RISCVInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) {
36123 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36124 switch (S) {
36125 case GNU_interrupt:
36126 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36127 case CXX11_gnu_interrupt:
36128 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36129 case C23_gnu_interrupt:
36130 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36131 default:
36132 llvm_unreachable("Unknown attribute spelling!");
36133 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36134 }
36135 }());
36136 return Create(Ctx, Interrupt, I);
36137 }
36138
36139 RISCVInterruptAttr::RISCVInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36140 , RISCVInterruptAttr::InterruptType Interrupt
36141 )
36142 : InheritableAttr(Ctx, CommonInfo, attr::RISCVInterrupt, /*IsLateParsed=*/false, false)
36143 , interrupt(Interrupt)
36144 {
36145 }
36146
36147 RISCVInterruptAttr::RISCVInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36148 )
36149 : InheritableAttr(Ctx, CommonInfo, attr::RISCVInterrupt, /*IsLateParsed=*/false, false)
36150 , interrupt(RISCVInterruptAttr::InterruptType(0))
36151 {
36152 }
36153
36154
36155
36156 bool RISCVInterruptAttr::ConvertStrToInterruptType(StringRef Val, RISCVInterruptAttr::InterruptType &Out) {
36157 std::optional<RISCVInterruptAttr::InterruptType> R = llvm::StringSwitch<std::optional<RISCVInterruptAttr::InterruptType>>(Val)
36158 .Case("supervisor", RISCVInterruptAttr::InterruptType::supervisor)
36159 .Case("machine", RISCVInterruptAttr::InterruptType::machine)
36160 .Default(std::optional<RISCVInterruptAttr::InterruptType>());
36161 if (R) {
36162 Out = *R;
36163 return true;
36164 }
36165 return false;
36166 }
36167
36168 const char *RISCVInterruptAttr::ConvertInterruptTypeToStr(RISCVInterruptAttr::InterruptType Val) {
36169 switch(Val) {
36170 case RISCVInterruptAttr::InterruptType::supervisor: return "supervisor";
36171 case RISCVInterruptAttr::InterruptType::machine: return "machine";
36172 }
36173 llvm_unreachable("No enumerator with that value");
36174 }
36175 RISCVInterruptAttr *RISCVInterruptAttr::clone(ASTContext &C) const {
36176 auto *A = new (C) RISCVInterruptAttr(C, *this, interrupt);
36177 A->Inherited = Inherited;
36178 A->IsPackExpansion = IsPackExpansion;
36179 A->setImplicit(Implicit);
36180 return A;
36181 }
36182
36183 void RISCVInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
36184 bool IsFirstArgument = true; (void)IsFirstArgument;
36185 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
36186 switch (getAttributeSpellingListIndex()) {
36187 default:
36188 llvm_unreachable("Unknown attribute spelling!");
36189 break;
36190 case 0 : {
36191 OS << "__attribute__((interrupt";
36192 DelimitAttributeArgument(OS, IsFirstArgument);
36193 OS << "\"" << RISCVInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\"";
36194 if (!IsFirstArgument)
36195 OS << ")";
36196 OS << "))";
36197 break;
36198 }
36199 case 1 : {
36200 OS << "[[gnu::interrupt";
36201 DelimitAttributeArgument(OS, IsFirstArgument);
36202 OS << "\"" << RISCVInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\"";
36203 if (!IsFirstArgument)
36204 OS << ")";
36205 OS << "]]";
36206 break;
36207 }
36208 case 2 : {
36209 OS << "[[gnu::interrupt";
36210 DelimitAttributeArgument(OS, IsFirstArgument);
36211 OS << "\"" << RISCVInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\"";
36212 if (!IsFirstArgument)
36213 OS << ")";
36214 OS << "]]";
36215 break;
36216 }
36217 }
36218 }
36219
36220 const char *RISCVInterruptAttr::getSpelling() const {
36221 switch (getAttributeSpellingListIndex()) {
36222 default:
36223 llvm_unreachable("Unknown attribute spelling!");
36224 return "(No spelling)";
36225 case 0:
36226 return "interrupt";
36227 case 1:
36228 return "interrupt";
36229 case 2:
36230 return "interrupt";
36231 }
36232 }
36233
36234
36235 // RISCVVectorCCAttr implementation
36236
36237 RISCVVectorCCAttr *RISCVVectorCCAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36238 auto *A = new (Ctx) RISCVVectorCCAttr(Ctx, CommonInfo);
36239 A->setImplicit(true);
36240 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36241 A->setAttributeSpellingListIndex(0);
36242 return A;
36243 }
36244
36245 RISCVVectorCCAttr *RISCVVectorCCAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36246 auto *A = new (Ctx) RISCVVectorCCAttr(Ctx, CommonInfo);
36247 return A;
36248 }
36249
36250 RISCVVectorCCAttr *RISCVVectorCCAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
36251 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36252 switch (S) {
36253 case CXX11_riscv_vector_cc:
36254 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36255 case C23_riscv_vector_cc:
36256 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36257 case GNU_riscv_vector_cc:
36258 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36259 case CXX11_clang_riscv_vector_cc:
36260 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36261 case C23_clang_riscv_vector_cc:
36262 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36263 default:
36264 llvm_unreachable("Unknown attribute spelling!");
36265 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36266 }
36267 }());
36268 return CreateImplicit(Ctx, I);
36269 }
36270
36271 RISCVVectorCCAttr *RISCVVectorCCAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
36272 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36273 switch (S) {
36274 case CXX11_riscv_vector_cc:
36275 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36276 case C23_riscv_vector_cc:
36277 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36278 case GNU_riscv_vector_cc:
36279 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36280 case CXX11_clang_riscv_vector_cc:
36281 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36282 case C23_clang_riscv_vector_cc:
36283 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36284 default:
36285 llvm_unreachable("Unknown attribute spelling!");
36286 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36287 }
36288 }());
36289 return Create(Ctx, I);
36290 }
36291
36292 RISCVVectorCCAttr::RISCVVectorCCAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36293 )
36294 : InheritableAttr(Ctx, CommonInfo, attr::RISCVVectorCC, /*IsLateParsed=*/false, false)
36295 {
36296 }
36297
36298 RISCVVectorCCAttr::Spelling RISCVVectorCCAttr::getSemanticSpelling() const {
36299 switch (getAttributeSpellingListIndex()) {
36300 default: llvm_unreachable("Unknown spelling list index");
36301 case 0: return CXX11_riscv_vector_cc;
36302 case 1: return C23_riscv_vector_cc;
36303 case 2: return GNU_riscv_vector_cc;
36304 case 3: return CXX11_clang_riscv_vector_cc;
36305 case 4: return C23_clang_riscv_vector_cc;
36306 }
36307 }
36308 RISCVVectorCCAttr *RISCVVectorCCAttr::clone(ASTContext &C) const {
36309 auto *A = new (C) RISCVVectorCCAttr(C, *this);
36310 A->Inherited = Inherited;
36311 A->IsPackExpansion = IsPackExpansion;
36312 A->setImplicit(Implicit);
36313 return A;
36314 }
36315
36316 void RISCVVectorCCAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
36317 bool IsFirstArgument = true; (void)IsFirstArgument;
36318 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
36319 switch (getAttributeSpellingListIndex()) {
36320 default:
36321 llvm_unreachable("Unknown attribute spelling!");
36322 break;
36323 case 0 : {
36324 OS << "[[riscv::vector_cc";
36325 OS << "]]";
36326 break;
36327 }
36328 case 1 : {
36329 OS << "[[riscv::vector_cc";
36330 OS << "]]";
36331 break;
36332 }
36333 case 2 : {
36334 OS << "__attribute__((riscv_vector_cc";
36335 OS << "))";
36336 break;
36337 }
36338 case 3 : {
36339 OS << "[[clang::riscv_vector_cc";
36340 OS << "]]";
36341 break;
36342 }
36343 case 4 : {
36344 OS << "[[clang::riscv_vector_cc";
36345 OS << "]]";
36346 break;
36347 }
36348 }
36349 }
36350
36351 const char *RISCVVectorCCAttr::getSpelling() const {
36352 switch (getAttributeSpellingListIndex()) {
36353 default:
36354 llvm_unreachable("Unknown attribute spelling!");
36355 return "(No spelling)";
36356 case 0:
36357 return "vector_cc";
36358 case 1:
36359 return "vector_cc";
36360 case 2:
36361 return "riscv_vector_cc";
36362 case 3:
36363 return "riscv_vector_cc";
36364 case 4:
36365 return "riscv_vector_cc";
36366 }
36367 }
36368
36369
36370 // RandomizeLayoutAttr implementation
36371
36372 RandomizeLayoutAttr *RandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36373 auto *A = new (Ctx) RandomizeLayoutAttr(Ctx, CommonInfo);
36374 A->setImplicit(true);
36375 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36376 A->setAttributeSpellingListIndex(0);
36377 return A;
36378 }
36379
36380 RandomizeLayoutAttr *RandomizeLayoutAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36381 auto *A = new (Ctx) RandomizeLayoutAttr(Ctx, CommonInfo);
36382 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36383 A->setAttributeSpellingListIndex(0);
36384 return A;
36385 }
36386
36387 RandomizeLayoutAttr *RandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
36388 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36389 switch (S) {
36390 case GNU_randomize_layout:
36391 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36392 case CXX11_gnu_randomize_layout:
36393 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36394 case C23_gnu_randomize_layout:
36395 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36396 default:
36397 llvm_unreachable("Unknown attribute spelling!");
36398 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36399 }
36400 }());
36401 return CreateImplicit(Ctx, I);
36402 }
36403
36404 RandomizeLayoutAttr *RandomizeLayoutAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
36405 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36406 switch (S) {
36407 case GNU_randomize_layout:
36408 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36409 case CXX11_gnu_randomize_layout:
36410 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36411 case C23_gnu_randomize_layout:
36412 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36413 default:
36414 llvm_unreachable("Unknown attribute spelling!");
36415 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36416 }
36417 }());
36418 return Create(Ctx, I);
36419 }
36420
36421 RandomizeLayoutAttr::RandomizeLayoutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36422 )
36423 : InheritableAttr(Ctx, CommonInfo, attr::RandomizeLayout, /*IsLateParsed=*/false, false)
36424 {
36425 }
36426
36427 RandomizeLayoutAttr *RandomizeLayoutAttr::clone(ASTContext &C) const {
36428 auto *A = new (C) RandomizeLayoutAttr(C, *this);
36429 A->Inherited = Inherited;
36430 A->IsPackExpansion = IsPackExpansion;
36431 A->setImplicit(Implicit);
36432 return A;
36433 }
36434
36435 void RandomizeLayoutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
36436 bool IsFirstArgument = true; (void)IsFirstArgument;
36437 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
36438 switch (getAttributeSpellingListIndex()) {
36439 default:
36440 llvm_unreachable("Unknown attribute spelling!");
36441 break;
36442 case 0 : {
36443 OS << "__attribute__((randomize_layout";
36444 OS << "))";
36445 break;
36446 }
36447 case 1 : {
36448 OS << "[[gnu::randomize_layout";
36449 OS << "]]";
36450 break;
36451 }
36452 case 2 : {
36453 OS << "[[gnu::randomize_layout";
36454 OS << "]]";
36455 break;
36456 }
36457 }
36458 }
36459
36460 const char *RandomizeLayoutAttr::getSpelling() const {
36461 switch (getAttributeSpellingListIndex()) {
36462 default:
36463 llvm_unreachable("Unknown attribute spelling!");
36464 return "(No spelling)";
36465 case 0:
36466 return "randomize_layout";
36467 case 1:
36468 return "randomize_layout";
36469 case 2:
36470 return "randomize_layout";
36471 }
36472 }
36473
36474
36475 // ReadOnlyPlacementAttr implementation
36476
36477 ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36478 auto *A = new (Ctx) ReadOnlyPlacementAttr(Ctx, CommonInfo);
36479 A->setImplicit(true);
36480 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36481 A->setAttributeSpellingListIndex(0);
36482 return A;
36483 }
36484
36485 ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36486 auto *A = new (Ctx) ReadOnlyPlacementAttr(Ctx, CommonInfo);
36487 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36488 A->setAttributeSpellingListIndex(0);
36489 return A;
36490 }
36491
36492 ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
36493 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36494 switch (S) {
36495 case GNU_enforce_read_only_placement:
36496 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36497 case CXX11_clang_enforce_read_only_placement:
36498 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36499 case C23_clang_enforce_read_only_placement:
36500 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36501 default:
36502 llvm_unreachable("Unknown attribute spelling!");
36503 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36504 }
36505 }());
36506 return CreateImplicit(Ctx, I);
36507 }
36508
36509 ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
36510 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36511 switch (S) {
36512 case GNU_enforce_read_only_placement:
36513 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36514 case CXX11_clang_enforce_read_only_placement:
36515 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36516 case C23_clang_enforce_read_only_placement:
36517 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36518 default:
36519 llvm_unreachable("Unknown attribute spelling!");
36520 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36521 }
36522 }());
36523 return Create(Ctx, I);
36524 }
36525
36526 ReadOnlyPlacementAttr::ReadOnlyPlacementAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36527 )
36528 : InheritableAttr(Ctx, CommonInfo, attr::ReadOnlyPlacement, /*IsLateParsed=*/false, false)
36529 {
36530 }
36531
36532 ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::clone(ASTContext &C) const {
36533 auto *A = new (C) ReadOnlyPlacementAttr(C, *this);
36534 A->Inherited = Inherited;
36535 A->IsPackExpansion = IsPackExpansion;
36536 A->setImplicit(Implicit);
36537 return A;
36538 }
36539
36540 void ReadOnlyPlacementAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
36541 bool IsFirstArgument = true; (void)IsFirstArgument;
36542 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
36543 switch (getAttributeSpellingListIndex()) {
36544 default:
36545 llvm_unreachable("Unknown attribute spelling!");
36546 break;
36547 case 0 : {
36548 OS << "__attribute__((enforce_read_only_placement";
36549 OS << "))";
36550 break;
36551 }
36552 case 1 : {
36553 OS << "[[clang::enforce_read_only_placement";
36554 OS << "]]";
36555 break;
36556 }
36557 case 2 : {
36558 OS << "[[clang::enforce_read_only_placement";
36559 OS << "]]";
36560 break;
36561 }
36562 }
36563 }
36564
36565 const char *ReadOnlyPlacementAttr::getSpelling() const {
36566 switch (getAttributeSpellingListIndex()) {
36567 default:
36568 llvm_unreachable("Unknown attribute spelling!");
36569 return "(No spelling)";
36570 case 0:
36571 return "enforce_read_only_placement";
36572 case 1:
36573 return "enforce_read_only_placement";
36574 case 2:
36575 return "enforce_read_only_placement";
36576 }
36577 }
36578
36579
36580 // RegCallAttr implementation
36581
36582 RegCallAttr *RegCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36583 auto *A = new (Ctx) RegCallAttr(Ctx, CommonInfo);
36584 A->setImplicit(true);
36585 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36586 A->setAttributeSpellingListIndex(0);
36587 return A;
36588 }
36589
36590 RegCallAttr *RegCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36591 auto *A = new (Ctx) RegCallAttr(Ctx, CommonInfo);
36592 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36593 A->setAttributeSpellingListIndex(0);
36594 return A;
36595 }
36596
36597 RegCallAttr *RegCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
36598 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36599 switch (S) {
36600 case GNU_regcall:
36601 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36602 case CXX11_gnu_regcall:
36603 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36604 case C23_gnu_regcall:
36605 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36606 case Keyword_regcall:
36607 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36608 default:
36609 llvm_unreachable("Unknown attribute spelling!");
36610 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36611 }
36612 }());
36613 return CreateImplicit(Ctx, I);
36614 }
36615
36616 RegCallAttr *RegCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
36617 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36618 switch (S) {
36619 case GNU_regcall:
36620 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36621 case CXX11_gnu_regcall:
36622 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36623 case C23_gnu_regcall:
36624 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36625 case Keyword_regcall:
36626 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36627 default:
36628 llvm_unreachable("Unknown attribute spelling!");
36629 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36630 }
36631 }());
36632 return Create(Ctx, I);
36633 }
36634
36635 RegCallAttr::RegCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36636 )
36637 : InheritableAttr(Ctx, CommonInfo, attr::RegCall, /*IsLateParsed=*/false, false)
36638 {
36639 }
36640
36641 RegCallAttr *RegCallAttr::clone(ASTContext &C) const {
36642 auto *A = new (C) RegCallAttr(C, *this);
36643 A->Inherited = Inherited;
36644 A->IsPackExpansion = IsPackExpansion;
36645 A->setImplicit(Implicit);
36646 return A;
36647 }
36648
36649 void RegCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
36650 bool IsFirstArgument = true; (void)IsFirstArgument;
36651 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
36652 switch (getAttributeSpellingListIndex()) {
36653 default:
36654 llvm_unreachable("Unknown attribute spelling!");
36655 break;
36656 case 0 : {
36657 OS << "__attribute__((regcall";
36658 OS << "))";
36659 break;
36660 }
36661 case 1 : {
36662 OS << "[[gnu::regcall";
36663 OS << "]]";
36664 break;
36665 }
36666 case 2 : {
36667 OS << "[[gnu::regcall";
36668 OS << "]]";
36669 break;
36670 }
36671 case 3 : {
36672 OS << "__regcall";
36673 OS << "";
36674 break;
36675 }
36676 }
36677 }
36678
36679 const char *RegCallAttr::getSpelling() const {
36680 switch (getAttributeSpellingListIndex()) {
36681 default:
36682 llvm_unreachable("Unknown attribute spelling!");
36683 return "(No spelling)";
36684 case 0:
36685 return "regcall";
36686 case 1:
36687 return "regcall";
36688 case 2:
36689 return "regcall";
36690 case 3:
36691 return "__regcall";
36692 }
36693 }
36694
36695
36696 // ReinitializesAttr implementation
36697
36698 ReinitializesAttr *ReinitializesAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36699 auto *A = new (Ctx) ReinitializesAttr(Ctx, CommonInfo);
36700 A->setImplicit(true);
36701 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36702 A->setAttributeSpellingListIndex(0);
36703 return A;
36704 }
36705
36706 ReinitializesAttr *ReinitializesAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
36707 auto *A = new (Ctx) ReinitializesAttr(Ctx, CommonInfo);
36708 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36709 A->setAttributeSpellingListIndex(0);
36710 return A;
36711 }
36712
36713 ReinitializesAttr *ReinitializesAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
36714 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36715 switch (S) {
36716 case GNU_reinitializes:
36717 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_reinitializes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36718 case CXX11_clang_reinitializes:
36719 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_reinitializes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36720 default:
36721 llvm_unreachable("Unknown attribute spelling!");
36722 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36723 }
36724 }());
36725 return CreateImplicit(Ctx, I);
36726 }
36727
36728 ReinitializesAttr *ReinitializesAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
36729 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36730 switch (S) {
36731 case GNU_reinitializes:
36732 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_reinitializes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36733 case CXX11_clang_reinitializes:
36734 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_reinitializes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36735 default:
36736 llvm_unreachable("Unknown attribute spelling!");
36737 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36738 }
36739 }());
36740 return Create(Ctx, I);
36741 }
36742
36743 ReinitializesAttr::ReinitializesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36744 )
36745 : InheritableAttr(Ctx, CommonInfo, attr::Reinitializes, /*IsLateParsed=*/false, false)
36746 {
36747 }
36748
36749 ReinitializesAttr *ReinitializesAttr::clone(ASTContext &C) const {
36750 auto *A = new (C) ReinitializesAttr(C, *this);
36751 A->Inherited = Inherited;
36752 A->IsPackExpansion = IsPackExpansion;
36753 A->setImplicit(Implicit);
36754 return A;
36755 }
36756
36757 void ReinitializesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
36758 bool IsFirstArgument = true; (void)IsFirstArgument;
36759 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
36760 switch (getAttributeSpellingListIndex()) {
36761 default:
36762 llvm_unreachable("Unknown attribute spelling!");
36763 break;
36764 case 0 : {
36765 OS << "__attribute__((reinitializes";
36766 OS << "))";
36767 break;
36768 }
36769 case 1 : {
36770 OS << "[[clang::reinitializes";
36771 OS << "]]";
36772 break;
36773 }
36774 }
36775 }
36776
36777 const char *ReinitializesAttr::getSpelling() const {
36778 switch (getAttributeSpellingListIndex()) {
36779 default:
36780 llvm_unreachable("Unknown attribute spelling!");
36781 return "(No spelling)";
36782 case 0:
36783 return "reinitializes";
36784 case 1:
36785 return "reinitializes";
36786 }
36787 }
36788
36789
36790 // ReleaseCapabilityAttr implementation
36791
36792 ReleaseCapabilityAttr *ReleaseCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
36793 auto *A = new (Ctx) ReleaseCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize);
36794 A->setImplicit(true);
36795 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
36796 A->setAttributeSpellingListIndex(0);
36797 return A;
36798 }
36799
36800 ReleaseCapabilityAttr *ReleaseCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
36801 auto *A = new (Ctx) ReleaseCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize);
36802 return A;
36803 }
36804
36805 ReleaseCapabilityAttr *ReleaseCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
36806 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36807 switch (S) {
36808 case GNU_release_capability:
36809 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36810 case CXX11_clang_release_capability:
36811 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36812 case GNU_release_shared_capability:
36813 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36814 case CXX11_clang_release_shared_capability:
36815 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36816 case GNU_release_generic_capability:
36817 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_generic_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36818 case CXX11_clang_release_generic_capability:
36819 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_generic_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36820 case GNU_unlock_function:
36821 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unlock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36822 case CXX11_clang_unlock_function:
36823 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unlock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36824 default:
36825 llvm_unreachable("Unknown attribute spelling!");
36826 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36827 }
36828 }());
36829 return CreateImplicit(Ctx, Args, ArgsSize, I);
36830 }
36831
36832 ReleaseCapabilityAttr *ReleaseCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
36833 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
36834 switch (S) {
36835 case GNU_release_capability:
36836 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36837 case CXX11_clang_release_capability:
36838 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36839 case GNU_release_shared_capability:
36840 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36841 case CXX11_clang_release_shared_capability:
36842 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36843 case GNU_release_generic_capability:
36844 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_generic_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36845 case CXX11_clang_release_generic_capability:
36846 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_generic_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36847 case GNU_unlock_function:
36848 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unlock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36849 case CXX11_clang_unlock_function:
36850 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unlock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36851 default:
36852 llvm_unreachable("Unknown attribute spelling!");
36853 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
36854 }
36855 }());
36856 return Create(Ctx, Args, ArgsSize, I);
36857 }
36858
36859 ReleaseCapabilityAttr::ReleaseCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36860 , Expr * *Args, unsigned ArgsSize
36861 )
36862 : InheritableAttr(Ctx, CommonInfo, attr::ReleaseCapability, /*IsLateParsed=*/true, true)
36863 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
36864 {
36865 std::copy(Args, Args + args_Size, args_);
36866 }
36867
36868 ReleaseCapabilityAttr::ReleaseCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
36869 )
36870 : InheritableAttr(Ctx, CommonInfo, attr::ReleaseCapability, /*IsLateParsed=*/true, true)
36871 , args_Size(0), args_(nullptr)
36872 {
36873 }
36874
36875 ReleaseCapabilityAttr::Spelling ReleaseCapabilityAttr::getSemanticSpelling() const {
36876 switch (getAttributeSpellingListIndex()) {
36877 default: llvm_unreachable("Unknown spelling list index");
36878 case 0: return GNU_release_capability;
36879 case 1: return CXX11_clang_release_capability;
36880 case 2: return GNU_release_shared_capability;
36881 case 3: return CXX11_clang_release_shared_capability;
36882 case 4: return GNU_release_generic_capability;
36883 case 5: return CXX11_clang_release_generic_capability;
36884 case 6: return GNU_unlock_function;
36885 case 7: return CXX11_clang_unlock_function;
36886 }
36887 }
36888
36889
36890 ReleaseCapabilityAttr *ReleaseCapabilityAttr::clone(ASTContext &C) const {
36891 auto *A = new (C) ReleaseCapabilityAttr(C, *this, args_, args_Size);
36892 A->Inherited = Inherited;
36893 A->IsPackExpansion = IsPackExpansion;
36894 A->setImplicit(Implicit);
36895 return A;
36896 }
36897
36898 void ReleaseCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
36899 bool IsFirstArgument = true; (void)IsFirstArgument;
36900 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
36901 switch (getAttributeSpellingListIndex()) {
36902 default:
36903 llvm_unreachable("Unknown attribute spelling!");
36904 break;
36905 case 0 : {
36906 OS << "__attribute__((release_capability";
36907 OS << "";
36908 for (const auto &Val : args()) {
36909 DelimitAttributeArgument(OS, IsFirstArgument);
36910 OS << Val;
36911 }
36912 OS << "";
36913 if (!IsFirstArgument)
36914 OS << ")";
36915 OS << "))";
36916 break;
36917 }
36918 case 1 : {
36919 OS << "[[clang::release_capability";
36920 OS << "";
36921 for (const auto &Val : args()) {
36922 DelimitAttributeArgument(OS, IsFirstArgument);
36923 OS << Val;
36924 }
36925 OS << "";
36926 if (!IsFirstArgument)
36927 OS << ")";
36928 OS << "]]";
36929 break;
36930 }
36931 case 2 : {
36932 OS << "__attribute__((release_shared_capability";
36933 OS << "";
36934 for (const auto &Val : args()) {
36935 DelimitAttributeArgument(OS, IsFirstArgument);
36936 OS << Val;
36937 }
36938 OS << "";
36939 if (!IsFirstArgument)
36940 OS << ")";
36941 OS << "))";
36942 break;
36943 }
36944 case 3 : {
36945 OS << "[[clang::release_shared_capability";
36946 OS << "";
36947 for (const auto &Val : args()) {
36948 DelimitAttributeArgument(OS, IsFirstArgument);
36949 OS << Val;
36950 }
36951 OS << "";
36952 if (!IsFirstArgument)
36953 OS << ")";
36954 OS << "]]";
36955 break;
36956 }
36957 case 4 : {
36958 OS << "__attribute__((release_generic_capability";
36959 OS << "";
36960 for (const auto &Val : args()) {
36961 DelimitAttributeArgument(OS, IsFirstArgument);
36962 OS << Val;
36963 }
36964 OS << "";
36965 if (!IsFirstArgument)
36966 OS << ")";
36967 OS << "))";
36968 break;
36969 }
36970 case 5 : {
36971 OS << "[[clang::release_generic_capability";
36972 OS << "";
36973 for (const auto &Val : args()) {
36974 DelimitAttributeArgument(OS, IsFirstArgument);
36975 OS << Val;
36976 }
36977 OS << "";
36978 if (!IsFirstArgument)
36979 OS << ")";
36980 OS << "]]";
36981 break;
36982 }
36983 case 6 : {
36984 OS << "__attribute__((unlock_function";
36985 OS << "";
36986 for (const auto &Val : args()) {
36987 DelimitAttributeArgument(OS, IsFirstArgument);
36988 OS << Val;
36989 }
36990 OS << "";
36991 if (!IsFirstArgument)
36992 OS << ")";
36993 OS << "))";
36994 break;
36995 }
36996 case 7 : {
36997 OS << "[[clang::unlock_function";
36998 OS << "";
36999 for (const auto &Val : args()) {
37000 DelimitAttributeArgument(OS, IsFirstArgument);
37001 OS << Val;
37002 }
37003 OS << "";
37004 if (!IsFirstArgument)
37005 OS << ")";
37006 OS << "]]";
37007 break;
37008 }
37009 }
37010 }
37011
37012 const char *ReleaseCapabilityAttr::getSpelling() const {
37013 switch (getAttributeSpellingListIndex()) {
37014 default:
37015 llvm_unreachable("Unknown attribute spelling!");
37016 return "(No spelling)";
37017 case 0:
37018 return "release_capability";
37019 case 1:
37020 return "release_capability";
37021 case 2:
37022 return "release_shared_capability";
37023 case 3:
37024 return "release_shared_capability";
37025 case 4:
37026 return "release_generic_capability";
37027 case 5:
37028 return "release_generic_capability";
37029 case 6:
37030 return "unlock_function";
37031 case 7:
37032 return "unlock_function";
37033 }
37034 }
37035
37036
37037 // ReleaseHandleAttr implementation
37038
37039 ReleaseHandleAttr *ReleaseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) {
37040 auto *A = new (Ctx) ReleaseHandleAttr(Ctx, CommonInfo, HandleType);
37041 A->setImplicit(true);
37042 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37043 A->setAttributeSpellingListIndex(0);
37044 return A;
37045 }
37046
37047 ReleaseHandleAttr *ReleaseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) {
37048 auto *A = new (Ctx) ReleaseHandleAttr(Ctx, CommonInfo, HandleType);
37049 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37050 A->setAttributeSpellingListIndex(0);
37051 return A;
37052 }
37053
37054 ReleaseHandleAttr *ReleaseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) {
37055 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37056 switch (S) {
37057 case GNU_release_handle:
37058 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37059 case CXX11_clang_release_handle:
37060 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37061 case C23_clang_release_handle:
37062 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37063 default:
37064 llvm_unreachable("Unknown attribute spelling!");
37065 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37066 }
37067 }());
37068 return CreateImplicit(Ctx, HandleType, I);
37069 }
37070
37071 ReleaseHandleAttr *ReleaseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) {
37072 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37073 switch (S) {
37074 case GNU_release_handle:
37075 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37076 case CXX11_clang_release_handle:
37077 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37078 case C23_clang_release_handle:
37079 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37080 default:
37081 llvm_unreachable("Unknown attribute spelling!");
37082 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37083 }
37084 }());
37085 return Create(Ctx, HandleType, I);
37086 }
37087
37088 ReleaseHandleAttr::ReleaseHandleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
37089 , llvm::StringRef HandleType
37090 )
37091 : InheritableParamAttr(Ctx, CommonInfo, attr::ReleaseHandle, /*IsLateParsed=*/false, false)
37092 , handleTypeLength(HandleType.size()),handleType(new (Ctx, 1) char[handleTypeLength])
37093 {
37094 if (!HandleType.empty())
37095 std::memcpy(handleType, HandleType.data(), handleTypeLength);
37096 }
37097
37098
37099
37100 ReleaseHandleAttr *ReleaseHandleAttr::clone(ASTContext &C) const {
37101 auto *A = new (C) ReleaseHandleAttr(C, *this, getHandleType());
37102 A->Inherited = Inherited;
37103 A->IsPackExpansion = IsPackExpansion;
37104 A->setImplicit(Implicit);
37105 return A;
37106 }
37107
37108 void ReleaseHandleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
37109 bool IsFirstArgument = true; (void)IsFirstArgument;
37110 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
37111 switch (getAttributeSpellingListIndex()) {
37112 default:
37113 llvm_unreachable("Unknown attribute spelling!");
37114 break;
37115 case 0 : {
37116 OS << "__attribute__((release_handle";
37117 DelimitAttributeArgument(OS, IsFirstArgument);
37118 OS << "\"" << getHandleType() << "\"";
37119 if (!IsFirstArgument)
37120 OS << ")";
37121 OS << "))";
37122 break;
37123 }
37124 case 1 : {
37125 OS << "[[clang::release_handle";
37126 DelimitAttributeArgument(OS, IsFirstArgument);
37127 OS << "\"" << getHandleType() << "\"";
37128 if (!IsFirstArgument)
37129 OS << ")";
37130 OS << "]]";
37131 break;
37132 }
37133 case 2 : {
37134 OS << "[[clang::release_handle";
37135 DelimitAttributeArgument(OS, IsFirstArgument);
37136 OS << "\"" << getHandleType() << "\"";
37137 if (!IsFirstArgument)
37138 OS << ")";
37139 OS << "]]";
37140 break;
37141 }
37142 }
37143 }
37144
37145 const char *ReleaseHandleAttr::getSpelling() const {
37146 switch (getAttributeSpellingListIndex()) {
37147 default:
37148 llvm_unreachable("Unknown attribute spelling!");
37149 return "(No spelling)";
37150 case 0:
37151 return "release_handle";
37152 case 1:
37153 return "release_handle";
37154 case 2:
37155 return "release_handle";
37156 }
37157 }
37158
37159
37160 // ReqdWorkGroupSizeAttr implementation
37161
37162 ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) {
37163 auto *A = new (Ctx) ReqdWorkGroupSizeAttr(Ctx, CommonInfo, XDim, YDim, ZDim);
37164 A->setImplicit(true);
37165 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37166 A->setAttributeSpellingListIndex(0);
37167 return A;
37168 }
37169
37170 ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) {
37171 auto *A = new (Ctx) ReqdWorkGroupSizeAttr(Ctx, CommonInfo, XDim, YDim, ZDim);
37172 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37173 A->setAttributeSpellingListIndex(0);
37174 return A;
37175 }
37176
37177 ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range) {
37178 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
37179 return CreateImplicit(Ctx, XDim, YDim, ZDim, I);
37180 }
37181
37182 ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range) {
37183 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
37184 return Create(Ctx, XDim, YDim, ZDim, I);
37185 }
37186
37187 ReqdWorkGroupSizeAttr::ReqdWorkGroupSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
37188 , unsigned XDim
37189 , unsigned YDim
37190 , unsigned ZDim
37191 )
37192 : InheritableAttr(Ctx, CommonInfo, attr::ReqdWorkGroupSize, /*IsLateParsed=*/false, false)
37193 , xDim(XDim)
37194 , yDim(YDim)
37195 , zDim(ZDim)
37196 {
37197 }
37198
37199
37200
37201
37202
37203
37204
37205 ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::clone(ASTContext &C) const {
37206 auto *A = new (C) ReqdWorkGroupSizeAttr(C, *this, xDim, yDim, zDim);
37207 A->Inherited = Inherited;
37208 A->IsPackExpansion = IsPackExpansion;
37209 A->setImplicit(Implicit);
37210 return A;
37211 }
37212
37213 void ReqdWorkGroupSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
37214 bool IsFirstArgument = true; (void)IsFirstArgument;
37215 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
37216 switch (getAttributeSpellingListIndex()) {
37217 default:
37218 llvm_unreachable("Unknown attribute spelling!");
37219 break;
37220 case 0 : {
37221 OS << "__attribute__((reqd_work_group_size";
37222 DelimitAttributeArgument(OS, IsFirstArgument);
37223 OS << "" << getXDim() << "";
37224 DelimitAttributeArgument(OS, IsFirstArgument);
37225 OS << "" << getYDim() << "";
37226 DelimitAttributeArgument(OS, IsFirstArgument);
37227 OS << "" << getZDim() << "";
37228 if (!IsFirstArgument)
37229 OS << ")";
37230 OS << "))";
37231 break;
37232 }
37233 }
37234 }
37235
37236 const char *ReqdWorkGroupSizeAttr::getSpelling() const {
37237 switch (getAttributeSpellingListIndex()) {
37238 default:
37239 llvm_unreachable("Unknown attribute spelling!");
37240 return "(No spelling)";
37241 case 0:
37242 return "reqd_work_group_size";
37243 }
37244 }
37245
37246
37247 // RequiresCapabilityAttr implementation
37248
37249 RequiresCapabilityAttr *RequiresCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
37250 auto *A = new (Ctx) RequiresCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize);
37251 A->setImplicit(true);
37252 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37253 A->setAttributeSpellingListIndex(0);
37254 return A;
37255 }
37256
37257 RequiresCapabilityAttr *RequiresCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
37258 auto *A = new (Ctx) RequiresCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize);
37259 return A;
37260 }
37261
37262 RequiresCapabilityAttr *RequiresCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
37263 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37264 switch (S) {
37265 case GNU_requires_capability:
37266 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_requires_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37267 case CXX11_clang_requires_capability:
37268 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_requires_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37269 case GNU_exclusive_locks_required:
37270 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclusive_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37271 case CXX11_clang_exclusive_locks_required:
37272 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_exclusive_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37273 case GNU_requires_shared_capability:
37274 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_requires_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37275 case CXX11_clang_requires_shared_capability:
37276 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_requires_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37277 case GNU_shared_locks_required:
37278 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37279 case CXX11_clang_shared_locks_required:
37280 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_shared_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37281 default:
37282 llvm_unreachable("Unknown attribute spelling!");
37283 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37284 }
37285 }());
37286 return CreateImplicit(Ctx, Args, ArgsSize, I);
37287 }
37288
37289 RequiresCapabilityAttr *RequiresCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
37290 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37291 switch (S) {
37292 case GNU_requires_capability:
37293 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_requires_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37294 case CXX11_clang_requires_capability:
37295 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_requires_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37296 case GNU_exclusive_locks_required:
37297 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclusive_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37298 case CXX11_clang_exclusive_locks_required:
37299 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_exclusive_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37300 case GNU_requires_shared_capability:
37301 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_requires_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37302 case CXX11_clang_requires_shared_capability:
37303 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_requires_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37304 case GNU_shared_locks_required:
37305 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37306 case CXX11_clang_shared_locks_required:
37307 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_shared_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37308 default:
37309 llvm_unreachable("Unknown attribute spelling!");
37310 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37311 }
37312 }());
37313 return Create(Ctx, Args, ArgsSize, I);
37314 }
37315
37316 RequiresCapabilityAttr::RequiresCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
37317 , Expr * *Args, unsigned ArgsSize
37318 )
37319 : InheritableAttr(Ctx, CommonInfo, attr::RequiresCapability, /*IsLateParsed=*/true, true)
37320 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
37321 {
37322 std::copy(Args, Args + args_Size, args_);
37323 }
37324
37325 RequiresCapabilityAttr::RequiresCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
37326 )
37327 : InheritableAttr(Ctx, CommonInfo, attr::RequiresCapability, /*IsLateParsed=*/true, true)
37328 , args_Size(0), args_(nullptr)
37329 {
37330 }
37331
37332 RequiresCapabilityAttr::Spelling RequiresCapabilityAttr::getSemanticSpelling() const {
37333 switch (getAttributeSpellingListIndex()) {
37334 default: llvm_unreachable("Unknown spelling list index");
37335 case 0: return GNU_requires_capability;
37336 case 1: return CXX11_clang_requires_capability;
37337 case 2: return GNU_exclusive_locks_required;
37338 case 3: return CXX11_clang_exclusive_locks_required;
37339 case 4: return GNU_requires_shared_capability;
37340 case 5: return CXX11_clang_requires_shared_capability;
37341 case 6: return GNU_shared_locks_required;
37342 case 7: return CXX11_clang_shared_locks_required;
37343 }
37344 }
37345
37346
37347 RequiresCapabilityAttr *RequiresCapabilityAttr::clone(ASTContext &C) const {
37348 auto *A = new (C) RequiresCapabilityAttr(C, *this, args_, args_Size);
37349 A->Inherited = Inherited;
37350 A->IsPackExpansion = IsPackExpansion;
37351 A->setImplicit(Implicit);
37352 return A;
37353 }
37354
37355 void RequiresCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
37356 bool IsFirstArgument = true; (void)IsFirstArgument;
37357 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
37358 switch (getAttributeSpellingListIndex()) {
37359 default:
37360 llvm_unreachable("Unknown attribute spelling!");
37361 break;
37362 case 0 : {
37363 OS << "__attribute__((requires_capability";
37364 OS << "";
37365 for (const auto &Val : args()) {
37366 DelimitAttributeArgument(OS, IsFirstArgument);
37367 OS << Val;
37368 }
37369 OS << "";
37370 if (!IsFirstArgument)
37371 OS << ")";
37372 OS << "))";
37373 break;
37374 }
37375 case 1 : {
37376 OS << "[[clang::requires_capability";
37377 OS << "";
37378 for (const auto &Val : args()) {
37379 DelimitAttributeArgument(OS, IsFirstArgument);
37380 OS << Val;
37381 }
37382 OS << "";
37383 if (!IsFirstArgument)
37384 OS << ")";
37385 OS << "]]";
37386 break;
37387 }
37388 case 2 : {
37389 OS << "__attribute__((exclusive_locks_required";
37390 OS << "";
37391 for (const auto &Val : args()) {
37392 DelimitAttributeArgument(OS, IsFirstArgument);
37393 OS << Val;
37394 }
37395 OS << "";
37396 if (!IsFirstArgument)
37397 OS << ")";
37398 OS << "))";
37399 break;
37400 }
37401 case 3 : {
37402 OS << "[[clang::exclusive_locks_required";
37403 OS << "";
37404 for (const auto &Val : args()) {
37405 DelimitAttributeArgument(OS, IsFirstArgument);
37406 OS << Val;
37407 }
37408 OS << "";
37409 if (!IsFirstArgument)
37410 OS << ")";
37411 OS << "]]";
37412 break;
37413 }
37414 case 4 : {
37415 OS << "__attribute__((requires_shared_capability";
37416 OS << "";
37417 for (const auto &Val : args()) {
37418 DelimitAttributeArgument(OS, IsFirstArgument);
37419 OS << Val;
37420 }
37421 OS << "";
37422 if (!IsFirstArgument)
37423 OS << ")";
37424 OS << "))";
37425 break;
37426 }
37427 case 5 : {
37428 OS << "[[clang::requires_shared_capability";
37429 OS << "";
37430 for (const auto &Val : args()) {
37431 DelimitAttributeArgument(OS, IsFirstArgument);
37432 OS << Val;
37433 }
37434 OS << "";
37435 if (!IsFirstArgument)
37436 OS << ")";
37437 OS << "]]";
37438 break;
37439 }
37440 case 6 : {
37441 OS << "__attribute__((shared_locks_required";
37442 OS << "";
37443 for (const auto &Val : args()) {
37444 DelimitAttributeArgument(OS, IsFirstArgument);
37445 OS << Val;
37446 }
37447 OS << "";
37448 if (!IsFirstArgument)
37449 OS << ")";
37450 OS << "))";
37451 break;
37452 }
37453 case 7 : {
37454 OS << "[[clang::shared_locks_required";
37455 OS << "";
37456 for (const auto &Val : args()) {
37457 DelimitAttributeArgument(OS, IsFirstArgument);
37458 OS << Val;
37459 }
37460 OS << "";
37461 if (!IsFirstArgument)
37462 OS << ")";
37463 OS << "]]";
37464 break;
37465 }
37466 }
37467 }
37468
37469 const char *RequiresCapabilityAttr::getSpelling() const {
37470 switch (getAttributeSpellingListIndex()) {
37471 default:
37472 llvm_unreachable("Unknown attribute spelling!");
37473 return "(No spelling)";
37474 case 0:
37475 return "requires_capability";
37476 case 1:
37477 return "requires_capability";
37478 case 2:
37479 return "exclusive_locks_required";
37480 case 3:
37481 return "exclusive_locks_required";
37482 case 4:
37483 return "requires_shared_capability";
37484 case 5:
37485 return "requires_shared_capability";
37486 case 6:
37487 return "shared_locks_required";
37488 case 7:
37489 return "shared_locks_required";
37490 }
37491 }
37492
37493
37494 // RestrictAttr implementation
37495
37496 RestrictAttr *RestrictAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
37497 auto *A = new (Ctx) RestrictAttr(Ctx, CommonInfo);
37498 A->setImplicit(true);
37499 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37500 A->setAttributeSpellingListIndex(0);
37501 return A;
37502 }
37503
37504 RestrictAttr *RestrictAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
37505 auto *A = new (Ctx) RestrictAttr(Ctx, CommonInfo);
37506 return A;
37507 }
37508
37509 RestrictAttr *RestrictAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
37510 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37511 switch (S) {
37512 case Declspec_restrict:
37513 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_restrict, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37514 case GNU_malloc:
37515 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37516 case CXX11_gnu_malloc:
37517 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37518 case C23_gnu_malloc:
37519 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37520 default:
37521 llvm_unreachable("Unknown attribute spelling!");
37522 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37523 }
37524 }());
37525 return CreateImplicit(Ctx, I);
37526 }
37527
37528 RestrictAttr *RestrictAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
37529 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37530 switch (S) {
37531 case Declspec_restrict:
37532 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_restrict, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37533 case GNU_malloc:
37534 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37535 case CXX11_gnu_malloc:
37536 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37537 case C23_gnu_malloc:
37538 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37539 default:
37540 llvm_unreachable("Unknown attribute spelling!");
37541 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37542 }
37543 }());
37544 return Create(Ctx, I);
37545 }
37546
37547 RestrictAttr::RestrictAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
37548 )
37549 : InheritableAttr(Ctx, CommonInfo, attr::Restrict, /*IsLateParsed=*/false, false)
37550 {
37551 }
37552
37553 RestrictAttr::Spelling RestrictAttr::getSemanticSpelling() const {
37554 switch (getAttributeSpellingListIndex()) {
37555 default: llvm_unreachable("Unknown spelling list index");
37556 case 0: return Declspec_restrict;
37557 case 1: return GNU_malloc;
37558 case 2: return CXX11_gnu_malloc;
37559 case 3: return C23_gnu_malloc;
37560 }
37561 }
37562 RestrictAttr *RestrictAttr::clone(ASTContext &C) const {
37563 auto *A = new (C) RestrictAttr(C, *this);
37564 A->Inherited = Inherited;
37565 A->IsPackExpansion = IsPackExpansion;
37566 A->setImplicit(Implicit);
37567 return A;
37568 }
37569
37570 void RestrictAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
37571 bool IsFirstArgument = true; (void)IsFirstArgument;
37572 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
37573 switch (getAttributeSpellingListIndex()) {
37574 default:
37575 llvm_unreachable("Unknown attribute spelling!");
37576 break;
37577 case 0 : {
37578 OS << "__declspec(restrict";
37579 OS << ")";
37580 break;
37581 }
37582 case 1 : {
37583 OS << "__attribute__((malloc";
37584 OS << "))";
37585 break;
37586 }
37587 case 2 : {
37588 OS << "[[gnu::malloc";
37589 OS << "]]";
37590 break;
37591 }
37592 case 3 : {
37593 OS << "[[gnu::malloc";
37594 OS << "]]";
37595 break;
37596 }
37597 }
37598 }
37599
37600 const char *RestrictAttr::getSpelling() const {
37601 switch (getAttributeSpellingListIndex()) {
37602 default:
37603 llvm_unreachable("Unknown attribute spelling!");
37604 return "(No spelling)";
37605 case 0:
37606 return "restrict";
37607 case 1:
37608 return "malloc";
37609 case 2:
37610 return "malloc";
37611 case 3:
37612 return "malloc";
37613 }
37614 }
37615
37616
37617 // RetainAttr implementation
37618
37619 RetainAttr *RetainAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
37620 auto *A = new (Ctx) RetainAttr(Ctx, CommonInfo);
37621 A->setImplicit(true);
37622 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37623 A->setAttributeSpellingListIndex(0);
37624 return A;
37625 }
37626
37627 RetainAttr *RetainAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
37628 auto *A = new (Ctx) RetainAttr(Ctx, CommonInfo);
37629 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37630 A->setAttributeSpellingListIndex(0);
37631 return A;
37632 }
37633
37634 RetainAttr *RetainAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
37635 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37636 switch (S) {
37637 case GNU_retain:
37638 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37639 case CXX11_gnu_retain:
37640 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37641 case C23_gnu_retain:
37642 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37643 default:
37644 llvm_unreachable("Unknown attribute spelling!");
37645 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37646 }
37647 }());
37648 return CreateImplicit(Ctx, I);
37649 }
37650
37651 RetainAttr *RetainAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
37652 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37653 switch (S) {
37654 case GNU_retain:
37655 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37656 case CXX11_gnu_retain:
37657 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37658 case C23_gnu_retain:
37659 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37660 default:
37661 llvm_unreachable("Unknown attribute spelling!");
37662 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37663 }
37664 }());
37665 return Create(Ctx, I);
37666 }
37667
37668 RetainAttr::RetainAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
37669 )
37670 : InheritableAttr(Ctx, CommonInfo, attr::Retain, /*IsLateParsed=*/false, false)
37671 {
37672 }
37673
37674 RetainAttr *RetainAttr::clone(ASTContext &C) const {
37675 auto *A = new (C) RetainAttr(C, *this);
37676 A->Inherited = Inherited;
37677 A->IsPackExpansion = IsPackExpansion;
37678 A->setImplicit(Implicit);
37679 return A;
37680 }
37681
37682 void RetainAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
37683 bool IsFirstArgument = true; (void)IsFirstArgument;
37684 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
37685 switch (getAttributeSpellingListIndex()) {
37686 default:
37687 llvm_unreachable("Unknown attribute spelling!");
37688 break;
37689 case 0 : {
37690 OS << "__attribute__((retain";
37691 OS << "))";
37692 break;
37693 }
37694 case 1 : {
37695 OS << "[[gnu::retain";
37696 OS << "]]";
37697 break;
37698 }
37699 case 2 : {
37700 OS << "[[gnu::retain";
37701 OS << "]]";
37702 break;
37703 }
37704 }
37705 }
37706
37707 const char *RetainAttr::getSpelling() const {
37708 switch (getAttributeSpellingListIndex()) {
37709 default:
37710 llvm_unreachable("Unknown attribute spelling!");
37711 return "(No spelling)";
37712 case 0:
37713 return "retain";
37714 case 1:
37715 return "retain";
37716 case 2:
37717 return "retain";
37718 }
37719 }
37720
37721
37722 // ReturnTypestateAttr implementation
37723
37724 ReturnTypestateAttr *ReturnTypestateAttr::CreateImplicit(ASTContext &Ctx, ReturnTypestateAttr::ConsumedState State, const AttributeCommonInfo &CommonInfo) {
37725 auto *A = new (Ctx) ReturnTypestateAttr(Ctx, CommonInfo, State);
37726 A->setImplicit(true);
37727 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37728 A->setAttributeSpellingListIndex(0);
37729 return A;
37730 }
37731
37732 ReturnTypestateAttr *ReturnTypestateAttr::Create(ASTContext &Ctx, ReturnTypestateAttr::ConsumedState State, const AttributeCommonInfo &CommonInfo) {
37733 auto *A = new (Ctx) ReturnTypestateAttr(Ctx, CommonInfo, State);
37734 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37735 A->setAttributeSpellingListIndex(0);
37736 return A;
37737 }
37738
37739 ReturnTypestateAttr *ReturnTypestateAttr::CreateImplicit(ASTContext &Ctx, ReturnTypestateAttr::ConsumedState State, SourceRange Range, Spelling S) {
37740 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37741 switch (S) {
37742 case GNU_return_typestate:
37743 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_return_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37744 case CXX11_clang_return_typestate:
37745 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_return_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37746 default:
37747 llvm_unreachable("Unknown attribute spelling!");
37748 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37749 }
37750 }());
37751 return CreateImplicit(Ctx, State, I);
37752 }
37753
37754 ReturnTypestateAttr *ReturnTypestateAttr::Create(ASTContext &Ctx, ReturnTypestateAttr::ConsumedState State, SourceRange Range, Spelling S) {
37755 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37756 switch (S) {
37757 case GNU_return_typestate:
37758 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_return_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37759 case CXX11_clang_return_typestate:
37760 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_return_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37761 default:
37762 llvm_unreachable("Unknown attribute spelling!");
37763 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37764 }
37765 }());
37766 return Create(Ctx, State, I);
37767 }
37768
37769 ReturnTypestateAttr::ReturnTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
37770 , ReturnTypestateAttr::ConsumedState State
37771 )
37772 : InheritableAttr(Ctx, CommonInfo, attr::ReturnTypestate, /*IsLateParsed=*/false, false)
37773 , state(State)
37774 {
37775 }
37776
37777
37778
37779 bool ReturnTypestateAttr::ConvertStrToConsumedState(StringRef Val, ReturnTypestateAttr::ConsumedState &Out) {
37780 std::optional<ReturnTypestateAttr::ConsumedState> R = llvm::StringSwitch<std::optional<ReturnTypestateAttr::ConsumedState>>(Val)
37781 .Case("unknown", ReturnTypestateAttr::ConsumedState::Unknown)
37782 .Case("consumed", ReturnTypestateAttr::ConsumedState::Consumed)
37783 .Case("unconsumed", ReturnTypestateAttr::ConsumedState::Unconsumed)
37784 .Default(std::optional<ReturnTypestateAttr::ConsumedState>());
37785 if (R) {
37786 Out = *R;
37787 return true;
37788 }
37789 return false;
37790 }
37791
37792 const char *ReturnTypestateAttr::ConvertConsumedStateToStr(ReturnTypestateAttr::ConsumedState Val) {
37793 switch(Val) {
37794 case ReturnTypestateAttr::ConsumedState::Unknown: return "unknown";
37795 case ReturnTypestateAttr::ConsumedState::Consumed: return "consumed";
37796 case ReturnTypestateAttr::ConsumedState::Unconsumed: return "unconsumed";
37797 }
37798 llvm_unreachable("No enumerator with that value");
37799 }
37800 ReturnTypestateAttr *ReturnTypestateAttr::clone(ASTContext &C) const {
37801 auto *A = new (C) ReturnTypestateAttr(C, *this, state);
37802 A->Inherited = Inherited;
37803 A->IsPackExpansion = IsPackExpansion;
37804 A->setImplicit(Implicit);
37805 return A;
37806 }
37807
37808 void ReturnTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
37809 bool IsFirstArgument = true; (void)IsFirstArgument;
37810 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
37811 switch (getAttributeSpellingListIndex()) {
37812 default:
37813 llvm_unreachable("Unknown attribute spelling!");
37814 break;
37815 case 0 : {
37816 OS << "__attribute__((return_typestate";
37817 DelimitAttributeArgument(OS, IsFirstArgument);
37818 OS << "\"" << ReturnTypestateAttr::ConvertConsumedStateToStr(getState()) << "\"";
37819 if (!IsFirstArgument)
37820 OS << ")";
37821 OS << "))";
37822 break;
37823 }
37824 case 1 : {
37825 OS << "[[clang::return_typestate";
37826 DelimitAttributeArgument(OS, IsFirstArgument);
37827 OS << "\"" << ReturnTypestateAttr::ConvertConsumedStateToStr(getState()) << "\"";
37828 if (!IsFirstArgument)
37829 OS << ")";
37830 OS << "]]";
37831 break;
37832 }
37833 }
37834 }
37835
37836 const char *ReturnTypestateAttr::getSpelling() const {
37837 switch (getAttributeSpellingListIndex()) {
37838 default:
37839 llvm_unreachable("Unknown attribute spelling!");
37840 return "(No spelling)";
37841 case 0:
37842 return "return_typestate";
37843 case 1:
37844 return "return_typestate";
37845 }
37846 }
37847
37848
37849 // ReturnsNonNullAttr implementation
37850
37851 ReturnsNonNullAttr *ReturnsNonNullAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
37852 auto *A = new (Ctx) ReturnsNonNullAttr(Ctx, CommonInfo);
37853 A->setImplicit(true);
37854 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37855 A->setAttributeSpellingListIndex(0);
37856 return A;
37857 }
37858
37859 ReturnsNonNullAttr *ReturnsNonNullAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
37860 auto *A = new (Ctx) ReturnsNonNullAttr(Ctx, CommonInfo);
37861 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37862 A->setAttributeSpellingListIndex(0);
37863 return A;
37864 }
37865
37866 ReturnsNonNullAttr *ReturnsNonNullAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
37867 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37868 switch (S) {
37869 case GNU_returns_nonnull:
37870 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37871 case CXX11_gnu_returns_nonnull:
37872 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37873 case C23_gnu_returns_nonnull:
37874 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37875 default:
37876 llvm_unreachable("Unknown attribute spelling!");
37877 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37878 }
37879 }());
37880 return CreateImplicit(Ctx, I);
37881 }
37882
37883 ReturnsNonNullAttr *ReturnsNonNullAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
37884 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37885 switch (S) {
37886 case GNU_returns_nonnull:
37887 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37888 case CXX11_gnu_returns_nonnull:
37889 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37890 case C23_gnu_returns_nonnull:
37891 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37892 default:
37893 llvm_unreachable("Unknown attribute spelling!");
37894 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37895 }
37896 }());
37897 return Create(Ctx, I);
37898 }
37899
37900 ReturnsNonNullAttr::ReturnsNonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
37901 )
37902 : InheritableAttr(Ctx, CommonInfo, attr::ReturnsNonNull, /*IsLateParsed=*/false, false)
37903 {
37904 }
37905
37906 ReturnsNonNullAttr *ReturnsNonNullAttr::clone(ASTContext &C) const {
37907 auto *A = new (C) ReturnsNonNullAttr(C, *this);
37908 A->Inherited = Inherited;
37909 A->IsPackExpansion = IsPackExpansion;
37910 A->setImplicit(Implicit);
37911 return A;
37912 }
37913
37914 void ReturnsNonNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
37915 bool IsFirstArgument = true; (void)IsFirstArgument;
37916 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
37917 switch (getAttributeSpellingListIndex()) {
37918 default:
37919 llvm_unreachable("Unknown attribute spelling!");
37920 break;
37921 case 0 : {
37922 OS << "__attribute__((returns_nonnull";
37923 OS << "))";
37924 break;
37925 }
37926 case 1 : {
37927 OS << "[[gnu::returns_nonnull";
37928 OS << "]]";
37929 break;
37930 }
37931 case 2 : {
37932 OS << "[[gnu::returns_nonnull";
37933 OS << "]]";
37934 break;
37935 }
37936 }
37937 }
37938
37939 const char *ReturnsNonNullAttr::getSpelling() const {
37940 switch (getAttributeSpellingListIndex()) {
37941 default:
37942 llvm_unreachable("Unknown attribute spelling!");
37943 return "(No spelling)";
37944 case 0:
37945 return "returns_nonnull";
37946 case 1:
37947 return "returns_nonnull";
37948 case 2:
37949 return "returns_nonnull";
37950 }
37951 }
37952
37953
37954 // ReturnsTwiceAttr implementation
37955
37956 ReturnsTwiceAttr *ReturnsTwiceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
37957 auto *A = new (Ctx) ReturnsTwiceAttr(Ctx, CommonInfo);
37958 A->setImplicit(true);
37959 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37960 A->setAttributeSpellingListIndex(0);
37961 return A;
37962 }
37963
37964 ReturnsTwiceAttr *ReturnsTwiceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
37965 auto *A = new (Ctx) ReturnsTwiceAttr(Ctx, CommonInfo);
37966 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
37967 A->setAttributeSpellingListIndex(0);
37968 return A;
37969 }
37970
37971 ReturnsTwiceAttr *ReturnsTwiceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
37972 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37973 switch (S) {
37974 case GNU_returns_twice:
37975 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37976 case CXX11_gnu_returns_twice:
37977 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37978 case C23_gnu_returns_twice:
37979 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37980 default:
37981 llvm_unreachable("Unknown attribute spelling!");
37982 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37983 }
37984 }());
37985 return CreateImplicit(Ctx, I);
37986 }
37987
37988 ReturnsTwiceAttr *ReturnsTwiceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
37989 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
37990 switch (S) {
37991 case GNU_returns_twice:
37992 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37993 case CXX11_gnu_returns_twice:
37994 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37995 case C23_gnu_returns_twice:
37996 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
37997 default:
37998 llvm_unreachable("Unknown attribute spelling!");
37999 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38000 }
38001 }());
38002 return Create(Ctx, I);
38003 }
38004
38005 ReturnsTwiceAttr::ReturnsTwiceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38006 )
38007 : InheritableAttr(Ctx, CommonInfo, attr::ReturnsTwice, /*IsLateParsed=*/false, false)
38008 {
38009 }
38010
38011 ReturnsTwiceAttr *ReturnsTwiceAttr::clone(ASTContext &C) const {
38012 auto *A = new (C) ReturnsTwiceAttr(C, *this);
38013 A->Inherited = Inherited;
38014 A->IsPackExpansion = IsPackExpansion;
38015 A->setImplicit(Implicit);
38016 return A;
38017 }
38018
38019 void ReturnsTwiceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
38020 bool IsFirstArgument = true; (void)IsFirstArgument;
38021 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
38022 switch (getAttributeSpellingListIndex()) {
38023 default:
38024 llvm_unreachable("Unknown attribute spelling!");
38025 break;
38026 case 0 : {
38027 OS << "__attribute__((returns_twice";
38028 OS << "))";
38029 break;
38030 }
38031 case 1 : {
38032 OS << "[[gnu::returns_twice";
38033 OS << "]]";
38034 break;
38035 }
38036 case 2 : {
38037 OS << "[[gnu::returns_twice";
38038 OS << "]]";
38039 break;
38040 }
38041 }
38042 }
38043
38044 const char *ReturnsTwiceAttr::getSpelling() const {
38045 switch (getAttributeSpellingListIndex()) {
38046 default:
38047 llvm_unreachable("Unknown attribute spelling!");
38048 return "(No spelling)";
38049 case 0:
38050 return "returns_twice";
38051 case 1:
38052 return "returns_twice";
38053 case 2:
38054 return "returns_twice";
38055 }
38056 }
38057
38058
38059 // SPtrAttr implementation
38060
38061 SPtrAttr *SPtrAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38062 auto *A = new (Ctx) SPtrAttr(Ctx, CommonInfo);
38063 A->setImplicit(true);
38064 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38065 A->setAttributeSpellingListIndex(0);
38066 return A;
38067 }
38068
38069 SPtrAttr *SPtrAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38070 auto *A = new (Ctx) SPtrAttr(Ctx, CommonInfo);
38071 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38072 A->setAttributeSpellingListIndex(0);
38073 return A;
38074 }
38075
38076 SPtrAttr *SPtrAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
38077 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
38078 return CreateImplicit(Ctx, I);
38079 }
38080
38081 SPtrAttr *SPtrAttr::Create(ASTContext &Ctx, SourceRange Range) {
38082 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
38083 return Create(Ctx, I);
38084 }
38085
38086 SPtrAttr::SPtrAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38087 )
38088 : TypeAttr(Ctx, CommonInfo, attr::SPtr, /*IsLateParsed=*/false)
38089 {
38090 }
38091
38092 SPtrAttr *SPtrAttr::clone(ASTContext &C) const {
38093 auto *A = new (C) SPtrAttr(C, *this);
38094 A->Inherited = Inherited;
38095 A->IsPackExpansion = IsPackExpansion;
38096 A->setImplicit(Implicit);
38097 return A;
38098 }
38099
38100 void SPtrAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
38101 bool IsFirstArgument = true; (void)IsFirstArgument;
38102 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
38103 switch (getAttributeSpellingListIndex()) {
38104 default:
38105 llvm_unreachable("Unknown attribute spelling!");
38106 break;
38107 case 0 : {
38108 OS << "__sptr";
38109 OS << "";
38110 break;
38111 }
38112 }
38113 }
38114
38115 const char *SPtrAttr::getSpelling() const {
38116 switch (getAttributeSpellingListIndex()) {
38117 default:
38118 llvm_unreachable("Unknown attribute spelling!");
38119 return "(No spelling)";
38120 case 0:
38121 return "__sptr";
38122 }
38123 }
38124
38125
38126 // SYCLKernelAttr implementation
38127
38128 SYCLKernelAttr *SYCLKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38129 auto *A = new (Ctx) SYCLKernelAttr(Ctx, CommonInfo);
38130 A->setImplicit(true);
38131 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38132 A->setAttributeSpellingListIndex(0);
38133 return A;
38134 }
38135
38136 SYCLKernelAttr *SYCLKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38137 auto *A = new (Ctx) SYCLKernelAttr(Ctx, CommonInfo);
38138 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38139 A->setAttributeSpellingListIndex(0);
38140 return A;
38141 }
38142
38143 SYCLKernelAttr *SYCLKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
38144 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38145 switch (S) {
38146 case GNU_sycl_kernel:
38147 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38148 case CXX11_clang_sycl_kernel:
38149 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38150 case C23_clang_sycl_kernel:
38151 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38152 default:
38153 llvm_unreachable("Unknown attribute spelling!");
38154 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38155 }
38156 }());
38157 return CreateImplicit(Ctx, I);
38158 }
38159
38160 SYCLKernelAttr *SYCLKernelAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
38161 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38162 switch (S) {
38163 case GNU_sycl_kernel:
38164 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38165 case CXX11_clang_sycl_kernel:
38166 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38167 case C23_clang_sycl_kernel:
38168 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38169 default:
38170 llvm_unreachable("Unknown attribute spelling!");
38171 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38172 }
38173 }());
38174 return Create(Ctx, I);
38175 }
38176
38177 SYCLKernelAttr::SYCLKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38178 )
38179 : InheritableAttr(Ctx, CommonInfo, attr::SYCLKernel, /*IsLateParsed=*/false, false)
38180 {
38181 }
38182
38183 SYCLKernelAttr *SYCLKernelAttr::clone(ASTContext &C) const {
38184 auto *A = new (C) SYCLKernelAttr(C, *this);
38185 A->Inherited = Inherited;
38186 A->IsPackExpansion = IsPackExpansion;
38187 A->setImplicit(Implicit);
38188 return A;
38189 }
38190
38191 void SYCLKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
38192 bool IsFirstArgument = true; (void)IsFirstArgument;
38193 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
38194 switch (getAttributeSpellingListIndex()) {
38195 default:
38196 llvm_unreachable("Unknown attribute spelling!");
38197 break;
38198 case 0 : {
38199 OS << "__attribute__((sycl_kernel";
38200 OS << "))";
38201 break;
38202 }
38203 case 1 : {
38204 OS << "[[clang::sycl_kernel";
38205 OS << "]]";
38206 break;
38207 }
38208 case 2 : {
38209 OS << "[[clang::sycl_kernel";
38210 OS << "]]";
38211 break;
38212 }
38213 }
38214 }
38215
38216 const char *SYCLKernelAttr::getSpelling() const {
38217 switch (getAttributeSpellingListIndex()) {
38218 default:
38219 llvm_unreachable("Unknown attribute spelling!");
38220 return "(No spelling)";
38221 case 0:
38222 return "sycl_kernel";
38223 case 1:
38224 return "sycl_kernel";
38225 case 2:
38226 return "sycl_kernel";
38227 }
38228 }
38229
38230
38231 // SYCLKernelEntryPointAttr implementation
38232
38233 SYCLKernelEntryPointAttr *SYCLKernelEntryPointAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * KernelName, bool Invalid, const AttributeCommonInfo &CommonInfo) {
38234 auto *A = new (Ctx) SYCLKernelEntryPointAttr(Ctx, CommonInfo, KernelName, Invalid);
38235 A->setImplicit(true);
38236 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38237 A->setAttributeSpellingListIndex(0);
38238 return A;
38239 }
38240
38241 SYCLKernelEntryPointAttr *SYCLKernelEntryPointAttr::Create(ASTContext &Ctx, TypeSourceInfo * KernelName, bool Invalid, const AttributeCommonInfo &CommonInfo) {
38242 auto *A = new (Ctx) SYCLKernelEntryPointAttr(Ctx, CommonInfo, KernelName, Invalid);
38243 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38244 A->setAttributeSpellingListIndex(0);
38245 return A;
38246 }
38247
38248 SYCLKernelEntryPointAttr *SYCLKernelEntryPointAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * KernelName, bool Invalid, SourceRange Range, Spelling S) {
38249 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38250 switch (S) {
38251 case GNU_sycl_kernel_entry_point:
38252 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38253 case CXX11_clang_sycl_kernel_entry_point:
38254 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38255 case C23_clang_sycl_kernel_entry_point:
38256 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38257 default:
38258 llvm_unreachable("Unknown attribute spelling!");
38259 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38260 }
38261 }());
38262 return CreateImplicit(Ctx, KernelName, Invalid, I);
38263 }
38264
38265 SYCLKernelEntryPointAttr *SYCLKernelEntryPointAttr::Create(ASTContext &Ctx, TypeSourceInfo * KernelName, bool Invalid, SourceRange Range, Spelling S) {
38266 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38267 switch (S) {
38268 case GNU_sycl_kernel_entry_point:
38269 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38270 case CXX11_clang_sycl_kernel_entry_point:
38271 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38272 case C23_clang_sycl_kernel_entry_point:
38273 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38274 default:
38275 llvm_unreachable("Unknown attribute spelling!");
38276 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38277 }
38278 }());
38279 return Create(Ctx, KernelName, Invalid, I);
38280 }
38281
38282 SYCLKernelEntryPointAttr *SYCLKernelEntryPointAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * KernelName, const AttributeCommonInfo &CommonInfo) {
38283 auto *A = new (Ctx) SYCLKernelEntryPointAttr(Ctx, CommonInfo, KernelName);
38284 A->setImplicit(true);
38285 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38286 A->setAttributeSpellingListIndex(0);
38287 return A;
38288 }
38289
38290 SYCLKernelEntryPointAttr *SYCLKernelEntryPointAttr::Create(ASTContext &Ctx, TypeSourceInfo * KernelName, const AttributeCommonInfo &CommonInfo) {
38291 auto *A = new (Ctx) SYCLKernelEntryPointAttr(Ctx, CommonInfo, KernelName);
38292 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38293 A->setAttributeSpellingListIndex(0);
38294 return A;
38295 }
38296
38297 SYCLKernelEntryPointAttr *SYCLKernelEntryPointAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * KernelName, SourceRange Range, Spelling S) {
38298 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38299 switch (S) {
38300 case GNU_sycl_kernel_entry_point:
38301 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38302 case CXX11_clang_sycl_kernel_entry_point:
38303 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38304 case C23_clang_sycl_kernel_entry_point:
38305 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38306 default:
38307 llvm_unreachable("Unknown attribute spelling!");
38308 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38309 }
38310 }());
38311 return CreateImplicit(Ctx, KernelName, I);
38312 }
38313
38314 SYCLKernelEntryPointAttr *SYCLKernelEntryPointAttr::Create(ASTContext &Ctx, TypeSourceInfo * KernelName, SourceRange Range, Spelling S) {
38315 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38316 switch (S) {
38317 case GNU_sycl_kernel_entry_point:
38318 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38319 case CXX11_clang_sycl_kernel_entry_point:
38320 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38321 case C23_clang_sycl_kernel_entry_point:
38322 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_kernel_entry_point, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38323 default:
38324 llvm_unreachable("Unknown attribute spelling!");
38325 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38326 }
38327 }());
38328 return Create(Ctx, KernelName, I);
38329 }
38330
38331 SYCLKernelEntryPointAttr::SYCLKernelEntryPointAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38332 , TypeSourceInfo * KernelName
38333 , bool Invalid
38334 )
38335 : InheritableAttr(Ctx, CommonInfo, attr::SYCLKernelEntryPoint, /*IsLateParsed=*/false, false)
38336 , kernelName(KernelName)
38337 , invalid(Invalid)
38338 {
38339 }
38340
38341 SYCLKernelEntryPointAttr::SYCLKernelEntryPointAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38342 , TypeSourceInfo * KernelName
38343 )
38344 : InheritableAttr(Ctx, CommonInfo, attr::SYCLKernelEntryPoint, /*IsLateParsed=*/false, false)
38345 , kernelName(KernelName)
38346 , invalid()
38347 {
38348 }
38349
38350
38351
38352
38353
38354 SYCLKernelEntryPointAttr *SYCLKernelEntryPointAttr::clone(ASTContext &C) const {
38355 auto *A = new (C) SYCLKernelEntryPointAttr(C, *this, kernelName, invalid);
38356 A->Inherited = Inherited;
38357 A->IsPackExpansion = IsPackExpansion;
38358 A->setImplicit(Implicit);
38359 return A;
38360 }
38361
38362 void SYCLKernelEntryPointAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
38363 bool IsFirstArgument = true; (void)IsFirstArgument;
38364 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
38365 switch (getAttributeSpellingListIndex()) {
38366 default:
38367 llvm_unreachable("Unknown attribute spelling!");
38368 break;
38369 case 0 : {
38370 OS << "__attribute__((sycl_kernel_entry_point";
38371 DelimitAttributeArgument(OS, IsFirstArgument);
38372 OS << "" << getKernelName().getAsString() << "";
38373 if (!IsFirstArgument)
38374 OS << ")";
38375 OS << "))";
38376 break;
38377 }
38378 case 1 : {
38379 OS << "[[clang::sycl_kernel_entry_point";
38380 DelimitAttributeArgument(OS, IsFirstArgument);
38381 OS << "" << getKernelName().getAsString() << "";
38382 if (!IsFirstArgument)
38383 OS << ")";
38384 OS << "]]";
38385 break;
38386 }
38387 case 2 : {
38388 OS << "[[clang::sycl_kernel_entry_point";
38389 DelimitAttributeArgument(OS, IsFirstArgument);
38390 OS << "" << getKernelName().getAsString() << "";
38391 if (!IsFirstArgument)
38392 OS << ")";
38393 OS << "]]";
38394 break;
38395 }
38396 }
38397 }
38398
38399 const char *SYCLKernelEntryPointAttr::getSpelling() const {
38400 switch (getAttributeSpellingListIndex()) {
38401 default:
38402 llvm_unreachable("Unknown attribute spelling!");
38403 return "(No spelling)";
38404 case 0:
38405 return "sycl_kernel_entry_point";
38406 case 1:
38407 return "sycl_kernel_entry_point";
38408 case 2:
38409 return "sycl_kernel_entry_point";
38410 }
38411 }
38412
38413
38414 // SYCLSpecialClassAttr implementation
38415
38416 SYCLSpecialClassAttr *SYCLSpecialClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38417 auto *A = new (Ctx) SYCLSpecialClassAttr(Ctx, CommonInfo);
38418 A->setImplicit(true);
38419 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38420 A->setAttributeSpellingListIndex(0);
38421 return A;
38422 }
38423
38424 SYCLSpecialClassAttr *SYCLSpecialClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38425 auto *A = new (Ctx) SYCLSpecialClassAttr(Ctx, CommonInfo);
38426 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38427 A->setAttributeSpellingListIndex(0);
38428 return A;
38429 }
38430
38431 SYCLSpecialClassAttr *SYCLSpecialClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
38432 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38433 switch (S) {
38434 case GNU_sycl_special_class:
38435 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38436 case CXX11_clang_sycl_special_class:
38437 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38438 case C23_clang_sycl_special_class:
38439 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38440 default:
38441 llvm_unreachable("Unknown attribute spelling!");
38442 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38443 }
38444 }());
38445 return CreateImplicit(Ctx, I);
38446 }
38447
38448 SYCLSpecialClassAttr *SYCLSpecialClassAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
38449 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38450 switch (S) {
38451 case GNU_sycl_special_class:
38452 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38453 case CXX11_clang_sycl_special_class:
38454 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38455 case C23_clang_sycl_special_class:
38456 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38457 default:
38458 llvm_unreachable("Unknown attribute spelling!");
38459 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38460 }
38461 }());
38462 return Create(Ctx, I);
38463 }
38464
38465 SYCLSpecialClassAttr::SYCLSpecialClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38466 )
38467 : InheritableAttr(Ctx, CommonInfo, attr::SYCLSpecialClass, /*IsLateParsed=*/false, false)
38468 {
38469 }
38470
38471 SYCLSpecialClassAttr *SYCLSpecialClassAttr::clone(ASTContext &C) const {
38472 auto *A = new (C) SYCLSpecialClassAttr(C, *this);
38473 A->Inherited = Inherited;
38474 A->IsPackExpansion = IsPackExpansion;
38475 A->setImplicit(Implicit);
38476 return A;
38477 }
38478
38479 void SYCLSpecialClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
38480 bool IsFirstArgument = true; (void)IsFirstArgument;
38481 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
38482 switch (getAttributeSpellingListIndex()) {
38483 default:
38484 llvm_unreachable("Unknown attribute spelling!");
38485 break;
38486 case 0 : {
38487 OS << "__attribute__((sycl_special_class";
38488 OS << "))";
38489 break;
38490 }
38491 case 1 : {
38492 OS << "[[clang::sycl_special_class";
38493 OS << "]]";
38494 break;
38495 }
38496 case 2 : {
38497 OS << "[[clang::sycl_special_class";
38498 OS << "]]";
38499 break;
38500 }
38501 }
38502 }
38503
38504 const char *SYCLSpecialClassAttr::getSpelling() const {
38505 switch (getAttributeSpellingListIndex()) {
38506 default:
38507 llvm_unreachable("Unknown attribute spelling!");
38508 return "(No spelling)";
38509 case 0:
38510 return "sycl_special_class";
38511 case 1:
38512 return "sycl_special_class";
38513 case 2:
38514 return "sycl_special_class";
38515 }
38516 }
38517
38518
38519 // ScopedLockableAttr implementation
38520
38521 ScopedLockableAttr *ScopedLockableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38522 auto *A = new (Ctx) ScopedLockableAttr(Ctx, CommonInfo);
38523 A->setImplicit(true);
38524 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38525 A->setAttributeSpellingListIndex(0);
38526 return A;
38527 }
38528
38529 ScopedLockableAttr *ScopedLockableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38530 auto *A = new (Ctx) ScopedLockableAttr(Ctx, CommonInfo);
38531 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38532 A->setAttributeSpellingListIndex(0);
38533 return A;
38534 }
38535
38536 ScopedLockableAttr *ScopedLockableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
38537 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38538 switch (S) {
38539 case GNU_scoped_lockable:
38540 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_scoped_lockable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38541 case CXX11_clang_scoped_lockable:
38542 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_scoped_lockable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38543 default:
38544 llvm_unreachable("Unknown attribute spelling!");
38545 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38546 }
38547 }());
38548 return CreateImplicit(Ctx, I);
38549 }
38550
38551 ScopedLockableAttr *ScopedLockableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
38552 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38553 switch (S) {
38554 case GNU_scoped_lockable:
38555 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_scoped_lockable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38556 case CXX11_clang_scoped_lockable:
38557 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_scoped_lockable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38558 default:
38559 llvm_unreachable("Unknown attribute spelling!");
38560 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38561 }
38562 }());
38563 return Create(Ctx, I);
38564 }
38565
38566 ScopedLockableAttr::ScopedLockableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38567 )
38568 : InheritableAttr(Ctx, CommonInfo, attr::ScopedLockable, /*IsLateParsed=*/false, false)
38569 {
38570 }
38571
38572 ScopedLockableAttr *ScopedLockableAttr::clone(ASTContext &C) const {
38573 auto *A = new (C) ScopedLockableAttr(C, *this);
38574 A->Inherited = Inherited;
38575 A->IsPackExpansion = IsPackExpansion;
38576 A->setImplicit(Implicit);
38577 return A;
38578 }
38579
38580 void ScopedLockableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
38581 bool IsFirstArgument = true; (void)IsFirstArgument;
38582 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
38583 switch (getAttributeSpellingListIndex()) {
38584 default:
38585 llvm_unreachable("Unknown attribute spelling!");
38586 break;
38587 case 0 : {
38588 OS << "__attribute__((scoped_lockable";
38589 OS << "))";
38590 break;
38591 }
38592 case 1 : {
38593 OS << "[[clang::scoped_lockable";
38594 OS << "]]";
38595 break;
38596 }
38597 }
38598 }
38599
38600 const char *ScopedLockableAttr::getSpelling() const {
38601 switch (getAttributeSpellingListIndex()) {
38602 default:
38603 llvm_unreachable("Unknown attribute spelling!");
38604 return "(No spelling)";
38605 case 0:
38606 return "scoped_lockable";
38607 case 1:
38608 return "scoped_lockable";
38609 }
38610 }
38611
38612
38613 // SectionAttr implementation
38614
38615 SectionAttr *SectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
38616 auto *A = new (Ctx) SectionAttr(Ctx, CommonInfo, Name);
38617 A->setImplicit(true);
38618 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38619 A->setAttributeSpellingListIndex(0);
38620 return A;
38621 }
38622
38623 SectionAttr *SectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
38624 auto *A = new (Ctx) SectionAttr(Ctx, CommonInfo, Name);
38625 return A;
38626 }
38627
38628 SectionAttr *SectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, Spelling S) {
38629 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38630 switch (S) {
38631 case GNU_section:
38632 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38633 case CXX11_gnu_section:
38634 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38635 case C23_gnu_section:
38636 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38637 case Declspec_allocate:
38638 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_allocate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38639 default:
38640 llvm_unreachable("Unknown attribute spelling!");
38641 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38642 }
38643 }());
38644 return CreateImplicit(Ctx, Name, I);
38645 }
38646
38647 SectionAttr *SectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, Spelling S) {
38648 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38649 switch (S) {
38650 case GNU_section:
38651 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38652 case CXX11_gnu_section:
38653 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38654 case C23_gnu_section:
38655 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38656 case Declspec_allocate:
38657 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_allocate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38658 default:
38659 llvm_unreachable("Unknown attribute spelling!");
38660 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38661 }
38662 }());
38663 return Create(Ctx, Name, I);
38664 }
38665
38666 SectionAttr::SectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38667 , llvm::StringRef Name
38668 )
38669 : InheritableAttr(Ctx, CommonInfo, attr::Section, /*IsLateParsed=*/false, false)
38670 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
38671 {
38672 if (!Name.empty())
38673 std::memcpy(name, Name.data(), nameLength);
38674 }
38675
38676 SectionAttr::Spelling SectionAttr::getSemanticSpelling() const {
38677 switch (getAttributeSpellingListIndex()) {
38678 default: llvm_unreachable("Unknown spelling list index");
38679 case 0: return GNU_section;
38680 case 1: return CXX11_gnu_section;
38681 case 2: return C23_gnu_section;
38682 case 3: return Declspec_allocate;
38683 }
38684 }
38685
38686
38687 SectionAttr *SectionAttr::clone(ASTContext &C) const {
38688 auto *A = new (C) SectionAttr(C, *this, getName());
38689 A->Inherited = Inherited;
38690 A->IsPackExpansion = IsPackExpansion;
38691 A->setImplicit(Implicit);
38692 return A;
38693 }
38694
38695 void SectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
38696 bool IsFirstArgument = true; (void)IsFirstArgument;
38697 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
38698 switch (getAttributeSpellingListIndex()) {
38699 default:
38700 llvm_unreachable("Unknown attribute spelling!");
38701 break;
38702 case 0 : {
38703 OS << "__attribute__((section";
38704 DelimitAttributeArgument(OS, IsFirstArgument);
38705 OS << "\"" << getName() << "\"";
38706 if (!IsFirstArgument)
38707 OS << ")";
38708 OS << "))";
38709 break;
38710 }
38711 case 1 : {
38712 OS << "[[gnu::section";
38713 DelimitAttributeArgument(OS, IsFirstArgument);
38714 OS << "\"" << getName() << "\"";
38715 if (!IsFirstArgument)
38716 OS << ")";
38717 OS << "]]";
38718 break;
38719 }
38720 case 2 : {
38721 OS << "[[gnu::section";
38722 DelimitAttributeArgument(OS, IsFirstArgument);
38723 OS << "\"" << getName() << "\"";
38724 if (!IsFirstArgument)
38725 OS << ")";
38726 OS << "]]";
38727 break;
38728 }
38729 case 3 : {
38730 OS << "__declspec(allocate";
38731 DelimitAttributeArgument(OS, IsFirstArgument);
38732 OS << "\"" << getName() << "\"";
38733 if (!IsFirstArgument)
38734 OS << ")";
38735 OS << ")";
38736 break;
38737 }
38738 }
38739 }
38740
38741 const char *SectionAttr::getSpelling() const {
38742 switch (getAttributeSpellingListIndex()) {
38743 default:
38744 llvm_unreachable("Unknown attribute spelling!");
38745 return "(No spelling)";
38746 case 0:
38747 return "section";
38748 case 1:
38749 return "section";
38750 case 2:
38751 return "section";
38752 case 3:
38753 return "allocate";
38754 }
38755 }
38756
38757
38758 // SelectAnyAttr implementation
38759
38760 SelectAnyAttr *SelectAnyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38761 auto *A = new (Ctx) SelectAnyAttr(Ctx, CommonInfo);
38762 A->setImplicit(true);
38763 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38764 A->setAttributeSpellingListIndex(0);
38765 return A;
38766 }
38767
38768 SelectAnyAttr *SelectAnyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
38769 auto *A = new (Ctx) SelectAnyAttr(Ctx, CommonInfo);
38770 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38771 A->setAttributeSpellingListIndex(0);
38772 return A;
38773 }
38774
38775 SelectAnyAttr *SelectAnyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
38776 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38777 switch (S) {
38778 case Declspec_selectany:
38779 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38780 case GNU_selectany:
38781 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38782 case CXX11_gnu_selectany:
38783 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38784 case C23_gnu_selectany:
38785 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38786 default:
38787 llvm_unreachable("Unknown attribute spelling!");
38788 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38789 }
38790 }());
38791 return CreateImplicit(Ctx, I);
38792 }
38793
38794 SelectAnyAttr *SelectAnyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
38795 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38796 switch (S) {
38797 case Declspec_selectany:
38798 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38799 case GNU_selectany:
38800 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38801 case CXX11_gnu_selectany:
38802 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38803 case C23_gnu_selectany:
38804 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38805 default:
38806 llvm_unreachable("Unknown attribute spelling!");
38807 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38808 }
38809 }());
38810 return Create(Ctx, I);
38811 }
38812
38813 SelectAnyAttr::SelectAnyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38814 )
38815 : InheritableAttr(Ctx, CommonInfo, attr::SelectAny, /*IsLateParsed=*/false, false)
38816 {
38817 }
38818
38819 SelectAnyAttr *SelectAnyAttr::clone(ASTContext &C) const {
38820 auto *A = new (C) SelectAnyAttr(C, *this);
38821 A->Inherited = Inherited;
38822 A->IsPackExpansion = IsPackExpansion;
38823 A->setImplicit(Implicit);
38824 return A;
38825 }
38826
38827 void SelectAnyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
38828 bool IsFirstArgument = true; (void)IsFirstArgument;
38829 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
38830 switch (getAttributeSpellingListIndex()) {
38831 default:
38832 llvm_unreachable("Unknown attribute spelling!");
38833 break;
38834 case 0 : {
38835 OS << "__declspec(selectany";
38836 OS << ")";
38837 break;
38838 }
38839 case 1 : {
38840 OS << "__attribute__((selectany";
38841 OS << "))";
38842 break;
38843 }
38844 case 2 : {
38845 OS << "[[gnu::selectany";
38846 OS << "]]";
38847 break;
38848 }
38849 case 3 : {
38850 OS << "[[gnu::selectany";
38851 OS << "]]";
38852 break;
38853 }
38854 }
38855 }
38856
38857 const char *SelectAnyAttr::getSpelling() const {
38858 switch (getAttributeSpellingListIndex()) {
38859 default:
38860 llvm_unreachable("Unknown attribute spelling!");
38861 return "(No spelling)";
38862 case 0:
38863 return "selectany";
38864 case 1:
38865 return "selectany";
38866 case 2:
38867 return "selectany";
38868 case 3:
38869 return "selectany";
38870 }
38871 }
38872
38873
38874 // SentinelAttr implementation
38875
38876 SentinelAttr *SentinelAttr::CreateImplicit(ASTContext &Ctx, int Sentinel, int NullPos, const AttributeCommonInfo &CommonInfo) {
38877 auto *A = new (Ctx) SentinelAttr(Ctx, CommonInfo, Sentinel, NullPos);
38878 A->setImplicit(true);
38879 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38880 A->setAttributeSpellingListIndex(0);
38881 return A;
38882 }
38883
38884 SentinelAttr *SentinelAttr::Create(ASTContext &Ctx, int Sentinel, int NullPos, const AttributeCommonInfo &CommonInfo) {
38885 auto *A = new (Ctx) SentinelAttr(Ctx, CommonInfo, Sentinel, NullPos);
38886 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
38887 A->setAttributeSpellingListIndex(0);
38888 return A;
38889 }
38890
38891 SentinelAttr *SentinelAttr::CreateImplicit(ASTContext &Ctx, int Sentinel, int NullPos, SourceRange Range, Spelling S) {
38892 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38893 switch (S) {
38894 case GNU_sentinel:
38895 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38896 case CXX11_gnu_sentinel:
38897 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38898 case C23_gnu_sentinel:
38899 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38900 default:
38901 llvm_unreachable("Unknown attribute spelling!");
38902 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38903 }
38904 }());
38905 return CreateImplicit(Ctx, Sentinel, NullPos, I);
38906 }
38907
38908 SentinelAttr *SentinelAttr::Create(ASTContext &Ctx, int Sentinel, int NullPos, SourceRange Range, Spelling S) {
38909 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
38910 switch (S) {
38911 case GNU_sentinel:
38912 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38913 case CXX11_gnu_sentinel:
38914 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38915 case C23_gnu_sentinel:
38916 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38917 default:
38918 llvm_unreachable("Unknown attribute spelling!");
38919 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
38920 }
38921 }());
38922 return Create(Ctx, Sentinel, NullPos, I);
38923 }
38924
38925 SentinelAttr::SentinelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38926 , int Sentinel
38927 , int NullPos
38928 )
38929 : InheritableAttr(Ctx, CommonInfo, attr::Sentinel, /*IsLateParsed=*/false, false)
38930 , sentinel(Sentinel)
38931 , nullPos(NullPos)
38932 {
38933 }
38934
38935 SentinelAttr::SentinelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
38936 )
38937 : InheritableAttr(Ctx, CommonInfo, attr::Sentinel, /*IsLateParsed=*/false, false)
38938 , sentinel()
38939 , nullPos()
38940 {
38941 }
38942
38943
38944
38945
38946
38947 SentinelAttr *SentinelAttr::clone(ASTContext &C) const {
38948 auto *A = new (C) SentinelAttr(C, *this, sentinel, nullPos);
38949 A->Inherited = Inherited;
38950 A->IsPackExpansion = IsPackExpansion;
38951 A->setImplicit(Implicit);
38952 return A;
38953 }
38954
38955 void SentinelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
38956 bool IsFirstArgument = true; (void)IsFirstArgument;
38957 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
38958 switch (getAttributeSpellingListIndex()) {
38959 default:
38960 llvm_unreachable("Unknown attribute spelling!");
38961 break;
38962 case 0 : {
38963 OS << "__attribute__((sentinel";
38964 DelimitAttributeArgument(OS, IsFirstArgument);
38965 OS << "" << getSentinel() << "";
38966 DelimitAttributeArgument(OS, IsFirstArgument);
38967 OS << "" << getNullPos() << "";
38968 if (!IsFirstArgument)
38969 OS << ")";
38970 OS << "))";
38971 break;
38972 }
38973 case 1 : {
38974 OS << "[[gnu::sentinel";
38975 DelimitAttributeArgument(OS, IsFirstArgument);
38976 OS << "" << getSentinel() << "";
38977 DelimitAttributeArgument(OS, IsFirstArgument);
38978 OS << "" << getNullPos() << "";
38979 if (!IsFirstArgument)
38980 OS << ")";
38981 OS << "]]";
38982 break;
38983 }
38984 case 2 : {
38985 OS << "[[gnu::sentinel";
38986 DelimitAttributeArgument(OS, IsFirstArgument);
38987 OS << "" << getSentinel() << "";
38988 DelimitAttributeArgument(OS, IsFirstArgument);
38989 OS << "" << getNullPos() << "";
38990 if (!IsFirstArgument)
38991 OS << ")";
38992 OS << "]]";
38993 break;
38994 }
38995 }
38996 }
38997
38998 const char *SentinelAttr::getSpelling() const {
38999 switch (getAttributeSpellingListIndex()) {
39000 default:
39001 llvm_unreachable("Unknown attribute spelling!");
39002 return "(No spelling)";
39003 case 0:
39004 return "sentinel";
39005 case 1:
39006 return "sentinel";
39007 case 2:
39008 return "sentinel";
39009 }
39010 }
39011
39012
39013 // SetTypestateAttr implementation
39014
39015 SetTypestateAttr *SetTypestateAttr::CreateImplicit(ASTContext &Ctx, SetTypestateAttr::ConsumedState NewState, const AttributeCommonInfo &CommonInfo) {
39016 auto *A = new (Ctx) SetTypestateAttr(Ctx, CommonInfo, NewState);
39017 A->setImplicit(true);
39018 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39019 A->setAttributeSpellingListIndex(0);
39020 return A;
39021 }
39022
39023 SetTypestateAttr *SetTypestateAttr::Create(ASTContext &Ctx, SetTypestateAttr::ConsumedState NewState, const AttributeCommonInfo &CommonInfo) {
39024 auto *A = new (Ctx) SetTypestateAttr(Ctx, CommonInfo, NewState);
39025 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39026 A->setAttributeSpellingListIndex(0);
39027 return A;
39028 }
39029
39030 SetTypestateAttr *SetTypestateAttr::CreateImplicit(ASTContext &Ctx, SetTypestateAttr::ConsumedState NewState, SourceRange Range, Spelling S) {
39031 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39032 switch (S) {
39033 case GNU_set_typestate:
39034 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_set_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39035 case CXX11_clang_set_typestate:
39036 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_set_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39037 default:
39038 llvm_unreachable("Unknown attribute spelling!");
39039 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39040 }
39041 }());
39042 return CreateImplicit(Ctx, NewState, I);
39043 }
39044
39045 SetTypestateAttr *SetTypestateAttr::Create(ASTContext &Ctx, SetTypestateAttr::ConsumedState NewState, SourceRange Range, Spelling S) {
39046 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39047 switch (S) {
39048 case GNU_set_typestate:
39049 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_set_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39050 case CXX11_clang_set_typestate:
39051 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_set_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39052 default:
39053 llvm_unreachable("Unknown attribute spelling!");
39054 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39055 }
39056 }());
39057 return Create(Ctx, NewState, I);
39058 }
39059
39060 SetTypestateAttr::SetTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39061 , SetTypestateAttr::ConsumedState NewState
39062 )
39063 : InheritableAttr(Ctx, CommonInfo, attr::SetTypestate, /*IsLateParsed=*/false, false)
39064 , newState(NewState)
39065 {
39066 }
39067
39068
39069
39070 bool SetTypestateAttr::ConvertStrToConsumedState(StringRef Val, SetTypestateAttr::ConsumedState &Out) {
39071 std::optional<SetTypestateAttr::ConsumedState> R = llvm::StringSwitch<std::optional<SetTypestateAttr::ConsumedState>>(Val)
39072 .Case("unknown", SetTypestateAttr::ConsumedState::Unknown)
39073 .Case("consumed", SetTypestateAttr::ConsumedState::Consumed)
39074 .Case("unconsumed", SetTypestateAttr::ConsumedState::Unconsumed)
39075 .Default(std::optional<SetTypestateAttr::ConsumedState>());
39076 if (R) {
39077 Out = *R;
39078 return true;
39079 }
39080 return false;
39081 }
39082
39083 const char *SetTypestateAttr::ConvertConsumedStateToStr(SetTypestateAttr::ConsumedState Val) {
39084 switch(Val) {
39085 case SetTypestateAttr::ConsumedState::Unknown: return "unknown";
39086 case SetTypestateAttr::ConsumedState::Consumed: return "consumed";
39087 case SetTypestateAttr::ConsumedState::Unconsumed: return "unconsumed";
39088 }
39089 llvm_unreachable("No enumerator with that value");
39090 }
39091 SetTypestateAttr *SetTypestateAttr::clone(ASTContext &C) const {
39092 auto *A = new (C) SetTypestateAttr(C, *this, newState);
39093 A->Inherited = Inherited;
39094 A->IsPackExpansion = IsPackExpansion;
39095 A->setImplicit(Implicit);
39096 return A;
39097 }
39098
39099 void SetTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
39100 bool IsFirstArgument = true; (void)IsFirstArgument;
39101 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
39102 switch (getAttributeSpellingListIndex()) {
39103 default:
39104 llvm_unreachable("Unknown attribute spelling!");
39105 break;
39106 case 0 : {
39107 OS << "__attribute__((set_typestate";
39108 DelimitAttributeArgument(OS, IsFirstArgument);
39109 OS << "\"" << SetTypestateAttr::ConvertConsumedStateToStr(getNewState()) << "\"";
39110 if (!IsFirstArgument)
39111 OS << ")";
39112 OS << "))";
39113 break;
39114 }
39115 case 1 : {
39116 OS << "[[clang::set_typestate";
39117 DelimitAttributeArgument(OS, IsFirstArgument);
39118 OS << "\"" << SetTypestateAttr::ConvertConsumedStateToStr(getNewState()) << "\"";
39119 if (!IsFirstArgument)
39120 OS << ")";
39121 OS << "]]";
39122 break;
39123 }
39124 }
39125 }
39126
39127 const char *SetTypestateAttr::getSpelling() const {
39128 switch (getAttributeSpellingListIndex()) {
39129 default:
39130 llvm_unreachable("Unknown attribute spelling!");
39131 return "(No spelling)";
39132 case 0:
39133 return "set_typestate";
39134 case 1:
39135 return "set_typestate";
39136 }
39137 }
39138
39139
39140 // SharedTrylockFunctionAttr implementation
39141
39142 SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
39143 auto *A = new (Ctx) SharedTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize);
39144 A->setImplicit(true);
39145 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39146 A->setAttributeSpellingListIndex(0);
39147 return A;
39148 }
39149
39150 SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
39151 auto *A = new (Ctx) SharedTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize);
39152 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39153 A->setAttributeSpellingListIndex(0);
39154 return A;
39155 }
39156
39157 SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
39158 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
39159 return CreateImplicit(Ctx, SuccessValue, Args, ArgsSize, I);
39160 }
39161
39162 SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range) {
39163 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
39164 return Create(Ctx, SuccessValue, Args, ArgsSize, I);
39165 }
39166
39167 SharedTrylockFunctionAttr::SharedTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39168 , Expr * SuccessValue
39169 , Expr * *Args, unsigned ArgsSize
39170 )
39171 : InheritableAttr(Ctx, CommonInfo, attr::SharedTrylockFunction, /*IsLateParsed=*/true, true)
39172 , successValue(SuccessValue)
39173 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
39174 {
39175 std::copy(Args, Args + args_Size, args_);
39176 }
39177
39178 SharedTrylockFunctionAttr::SharedTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39179 , Expr * SuccessValue
39180 )
39181 : InheritableAttr(Ctx, CommonInfo, attr::SharedTrylockFunction, /*IsLateParsed=*/true, true)
39182 , successValue(SuccessValue)
39183 , args_Size(0), args_(nullptr)
39184 {
39185 }
39186
39187
39188
39189
39190
39191 SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::clone(ASTContext &C) const {
39192 auto *A = new (C) SharedTrylockFunctionAttr(C, *this, successValue, args_, args_Size);
39193 A->Inherited = Inherited;
39194 A->IsPackExpansion = IsPackExpansion;
39195 A->setImplicit(Implicit);
39196 return A;
39197 }
39198
39199 void SharedTrylockFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
39200 bool IsFirstArgument = true; (void)IsFirstArgument;
39201 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
39202 switch (getAttributeSpellingListIndex()) {
39203 default:
39204 llvm_unreachable("Unknown attribute spelling!");
39205 break;
39206 case 0 : {
39207 OS << "__attribute__((shared_trylock_function";
39208 DelimitAttributeArgument(OS, IsFirstArgument);
39209 OS << "";
39210 getSuccessValue()->printPretty(OS, nullptr, Policy);
39211 OS << "";
39212 OS << "";
39213 for (const auto &Val : args()) {
39214 DelimitAttributeArgument(OS, IsFirstArgument);
39215 OS << Val;
39216 }
39217 OS << "";
39218 if (!IsFirstArgument)
39219 OS << ")";
39220 OS << "))";
39221 break;
39222 }
39223 }
39224 }
39225
39226 const char *SharedTrylockFunctionAttr::getSpelling() const {
39227 switch (getAttributeSpellingListIndex()) {
39228 default:
39229 llvm_unreachable("Unknown attribute spelling!");
39230 return "(No spelling)";
39231 case 0:
39232 return "shared_trylock_function";
39233 }
39234 }
39235
39236
39237 // SizedByAttr implementation
39238
39239 SizedByAttr *SizedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Size, int NestedLevel, const AttributeCommonInfo &CommonInfo) {
39240 auto *A = new (Ctx) SizedByAttr(Ctx, CommonInfo, Size, NestedLevel);
39241 A->setImplicit(true);
39242 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39243 A->setAttributeSpellingListIndex(0);
39244 return A;
39245 }
39246
39247 SizedByAttr *SizedByAttr::Create(ASTContext &Ctx, Expr * Size, int NestedLevel, const AttributeCommonInfo &CommonInfo) {
39248 auto *A = new (Ctx) SizedByAttr(Ctx, CommonInfo, Size, NestedLevel);
39249 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39250 A->setAttributeSpellingListIndex(0);
39251 return A;
39252 }
39253
39254 SizedByAttr *SizedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Size, int NestedLevel, SourceRange Range, Spelling S) {
39255 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39256 switch (S) {
39257 case GNU_sized_by:
39258 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39259 case CXX11_clang_sized_by:
39260 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39261 case C23_clang_sized_by:
39262 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39263 default:
39264 llvm_unreachable("Unknown attribute spelling!");
39265 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39266 }
39267 }());
39268 return CreateImplicit(Ctx, Size, NestedLevel, I);
39269 }
39270
39271 SizedByAttr *SizedByAttr::Create(ASTContext &Ctx, Expr * Size, int NestedLevel, SourceRange Range, Spelling S) {
39272 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39273 switch (S) {
39274 case GNU_sized_by:
39275 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39276 case CXX11_clang_sized_by:
39277 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39278 case C23_clang_sized_by:
39279 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39280 default:
39281 llvm_unreachable("Unknown attribute spelling!");
39282 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39283 }
39284 }());
39285 return Create(Ctx, Size, NestedLevel, I);
39286 }
39287
39288 SizedByAttr::SizedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39289 , Expr * Size
39290 , int NestedLevel
39291 )
39292 : InheritableAttr(Ctx, CommonInfo, attr::SizedBy, /*IsLateParsed=*/true, false)
39293 , size(Size)
39294 , nestedLevel(NestedLevel)
39295 {
39296 }
39297
39298 SizedByAttr::SizedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39299 , Expr * Size
39300 )
39301 : InheritableAttr(Ctx, CommonInfo, attr::SizedBy, /*IsLateParsed=*/true, false)
39302 , size(Size)
39303 , nestedLevel()
39304 {
39305 }
39306
39307
39308
39309
39310
39311 SizedByAttr *SizedByAttr::clone(ASTContext &C) const {
39312 auto *A = new (C) SizedByAttr(C, *this, size, nestedLevel);
39313 A->Inherited = Inherited;
39314 A->IsPackExpansion = IsPackExpansion;
39315 A->setImplicit(Implicit);
39316 return A;
39317 }
39318
39319 void SizedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
39320 bool IsFirstArgument = true; (void)IsFirstArgument;
39321 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
39322 switch (getAttributeSpellingListIndex()) {
39323 default:
39324 llvm_unreachable("Unknown attribute spelling!");
39325 break;
39326 case 0 : {
39327 OS << "__attribute__((sized_by";
39328 DelimitAttributeArgument(OS, IsFirstArgument);
39329 OS << "";
39330 getSize()->printPretty(OS, nullptr, Policy);
39331 OS << "";
39332 DelimitAttributeArgument(OS, IsFirstArgument);
39333 OS << "" << getNestedLevel() << "";
39334 if (!IsFirstArgument)
39335 OS << ")";
39336 OS << "))";
39337 break;
39338 }
39339 case 1 : {
39340 OS << "[[clang::sized_by";
39341 DelimitAttributeArgument(OS, IsFirstArgument);
39342 OS << "";
39343 getSize()->printPretty(OS, nullptr, Policy);
39344 OS << "";
39345 DelimitAttributeArgument(OS, IsFirstArgument);
39346 OS << "" << getNestedLevel() << "";
39347 if (!IsFirstArgument)
39348 OS << ")";
39349 OS << "]]";
39350 break;
39351 }
39352 case 2 : {
39353 OS << "[[clang::sized_by";
39354 DelimitAttributeArgument(OS, IsFirstArgument);
39355 OS << "";
39356 getSize()->printPretty(OS, nullptr, Policy);
39357 OS << "";
39358 DelimitAttributeArgument(OS, IsFirstArgument);
39359 OS << "" << getNestedLevel() << "";
39360 if (!IsFirstArgument)
39361 OS << ")";
39362 OS << "]]";
39363 break;
39364 }
39365 }
39366 }
39367
39368 const char *SizedByAttr::getSpelling() const {
39369 switch (getAttributeSpellingListIndex()) {
39370 default:
39371 llvm_unreachable("Unknown attribute spelling!");
39372 return "(No spelling)";
39373 case 0:
39374 return "sized_by";
39375 case 1:
39376 return "sized_by";
39377 case 2:
39378 return "sized_by";
39379 }
39380 }
39381
39382
39383 // SizedByOrNullAttr implementation
39384
39385 SizedByOrNullAttr *SizedByOrNullAttr::CreateImplicit(ASTContext &Ctx, Expr * Size, int NestedLevel, const AttributeCommonInfo &CommonInfo) {
39386 auto *A = new (Ctx) SizedByOrNullAttr(Ctx, CommonInfo, Size, NestedLevel);
39387 A->setImplicit(true);
39388 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39389 A->setAttributeSpellingListIndex(0);
39390 return A;
39391 }
39392
39393 SizedByOrNullAttr *SizedByOrNullAttr::Create(ASTContext &Ctx, Expr * Size, int NestedLevel, const AttributeCommonInfo &CommonInfo) {
39394 auto *A = new (Ctx) SizedByOrNullAttr(Ctx, CommonInfo, Size, NestedLevel);
39395 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39396 A->setAttributeSpellingListIndex(0);
39397 return A;
39398 }
39399
39400 SizedByOrNullAttr *SizedByOrNullAttr::CreateImplicit(ASTContext &Ctx, Expr * Size, int NestedLevel, SourceRange Range, Spelling S) {
39401 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39402 switch (S) {
39403 case GNU_sized_by_or_null:
39404 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39405 case CXX11_clang_sized_by_or_null:
39406 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39407 case C23_clang_sized_by_or_null:
39408 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39409 default:
39410 llvm_unreachable("Unknown attribute spelling!");
39411 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39412 }
39413 }());
39414 return CreateImplicit(Ctx, Size, NestedLevel, I);
39415 }
39416
39417 SizedByOrNullAttr *SizedByOrNullAttr::Create(ASTContext &Ctx, Expr * Size, int NestedLevel, SourceRange Range, Spelling S) {
39418 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39419 switch (S) {
39420 case GNU_sized_by_or_null:
39421 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39422 case CXX11_clang_sized_by_or_null:
39423 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39424 case C23_clang_sized_by_or_null:
39425 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39426 default:
39427 llvm_unreachable("Unknown attribute spelling!");
39428 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39429 }
39430 }());
39431 return Create(Ctx, Size, NestedLevel, I);
39432 }
39433
39434 SizedByOrNullAttr::SizedByOrNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39435 , Expr * Size
39436 , int NestedLevel
39437 )
39438 : InheritableAttr(Ctx, CommonInfo, attr::SizedByOrNull, /*IsLateParsed=*/true, false)
39439 , size(Size)
39440 , nestedLevel(NestedLevel)
39441 {
39442 }
39443
39444 SizedByOrNullAttr::SizedByOrNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39445 , Expr * Size
39446 )
39447 : InheritableAttr(Ctx, CommonInfo, attr::SizedByOrNull, /*IsLateParsed=*/true, false)
39448 , size(Size)
39449 , nestedLevel()
39450 {
39451 }
39452
39453
39454
39455
39456
39457 SizedByOrNullAttr *SizedByOrNullAttr::clone(ASTContext &C) const {
39458 auto *A = new (C) SizedByOrNullAttr(C, *this, size, nestedLevel);
39459 A->Inherited = Inherited;
39460 A->IsPackExpansion = IsPackExpansion;
39461 A->setImplicit(Implicit);
39462 return A;
39463 }
39464
39465 void SizedByOrNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
39466 bool IsFirstArgument = true; (void)IsFirstArgument;
39467 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
39468 switch (getAttributeSpellingListIndex()) {
39469 default:
39470 llvm_unreachable("Unknown attribute spelling!");
39471 break;
39472 case 0 : {
39473 OS << "__attribute__((sized_by_or_null";
39474 DelimitAttributeArgument(OS, IsFirstArgument);
39475 OS << "";
39476 getSize()->printPretty(OS, nullptr, Policy);
39477 OS << "";
39478 DelimitAttributeArgument(OS, IsFirstArgument);
39479 OS << "" << getNestedLevel() << "";
39480 if (!IsFirstArgument)
39481 OS << ")";
39482 OS << "))";
39483 break;
39484 }
39485 case 1 : {
39486 OS << "[[clang::sized_by_or_null";
39487 DelimitAttributeArgument(OS, IsFirstArgument);
39488 OS << "";
39489 getSize()->printPretty(OS, nullptr, Policy);
39490 OS << "";
39491 DelimitAttributeArgument(OS, IsFirstArgument);
39492 OS << "" << getNestedLevel() << "";
39493 if (!IsFirstArgument)
39494 OS << ")";
39495 OS << "]]";
39496 break;
39497 }
39498 case 2 : {
39499 OS << "[[clang::sized_by_or_null";
39500 DelimitAttributeArgument(OS, IsFirstArgument);
39501 OS << "";
39502 getSize()->printPretty(OS, nullptr, Policy);
39503 OS << "";
39504 DelimitAttributeArgument(OS, IsFirstArgument);
39505 OS << "" << getNestedLevel() << "";
39506 if (!IsFirstArgument)
39507 OS << ")";
39508 OS << "]]";
39509 break;
39510 }
39511 }
39512 }
39513
39514 const char *SizedByOrNullAttr::getSpelling() const {
39515 switch (getAttributeSpellingListIndex()) {
39516 default:
39517 llvm_unreachable("Unknown attribute spelling!");
39518 return "(No spelling)";
39519 case 0:
39520 return "sized_by_or_null";
39521 case 1:
39522 return "sized_by_or_null";
39523 case 2:
39524 return "sized_by_or_null";
39525 }
39526 }
39527
39528
39529 // SpeculativeLoadHardeningAttr implementation
39530
39531 SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39532 auto *A = new (Ctx) SpeculativeLoadHardeningAttr(Ctx, CommonInfo);
39533 A->setImplicit(true);
39534 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39535 A->setAttributeSpellingListIndex(0);
39536 return A;
39537 }
39538
39539 SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39540 auto *A = new (Ctx) SpeculativeLoadHardeningAttr(Ctx, CommonInfo);
39541 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39542 A->setAttributeSpellingListIndex(0);
39543 return A;
39544 }
39545
39546 SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
39547 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39548 switch (S) {
39549 case GNU_speculative_load_hardening:
39550 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39551 case CXX11_clang_speculative_load_hardening:
39552 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39553 case C23_clang_speculative_load_hardening:
39554 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39555 default:
39556 llvm_unreachable("Unknown attribute spelling!");
39557 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39558 }
39559 }());
39560 return CreateImplicit(Ctx, I);
39561 }
39562
39563 SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
39564 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39565 switch (S) {
39566 case GNU_speculative_load_hardening:
39567 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39568 case CXX11_clang_speculative_load_hardening:
39569 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39570 case C23_clang_speculative_load_hardening:
39571 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39572 default:
39573 llvm_unreachable("Unknown attribute spelling!");
39574 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39575 }
39576 }());
39577 return Create(Ctx, I);
39578 }
39579
39580 SpeculativeLoadHardeningAttr::SpeculativeLoadHardeningAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39581 )
39582 : InheritableAttr(Ctx, CommonInfo, attr::SpeculativeLoadHardening, /*IsLateParsed=*/false, false)
39583 {
39584 }
39585
39586 SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::clone(ASTContext &C) const {
39587 auto *A = new (C) SpeculativeLoadHardeningAttr(C, *this);
39588 A->Inherited = Inherited;
39589 A->IsPackExpansion = IsPackExpansion;
39590 A->setImplicit(Implicit);
39591 return A;
39592 }
39593
39594 void SpeculativeLoadHardeningAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
39595 bool IsFirstArgument = true; (void)IsFirstArgument;
39596 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
39597 switch (getAttributeSpellingListIndex()) {
39598 default:
39599 llvm_unreachable("Unknown attribute spelling!");
39600 break;
39601 case 0 : {
39602 OS << "__attribute__((speculative_load_hardening";
39603 OS << "))";
39604 break;
39605 }
39606 case 1 : {
39607 OS << "[[clang::speculative_load_hardening";
39608 OS << "]]";
39609 break;
39610 }
39611 case 2 : {
39612 OS << "[[clang::speculative_load_hardening";
39613 OS << "]]";
39614 break;
39615 }
39616 }
39617 }
39618
39619 const char *SpeculativeLoadHardeningAttr::getSpelling() const {
39620 switch (getAttributeSpellingListIndex()) {
39621 default:
39622 llvm_unreachable("Unknown attribute spelling!");
39623 return "(No spelling)";
39624 case 0:
39625 return "speculative_load_hardening";
39626 case 1:
39627 return "speculative_load_hardening";
39628 case 2:
39629 return "speculative_load_hardening";
39630 }
39631 }
39632
39633
39634 // StandaloneDebugAttr implementation
39635
39636 StandaloneDebugAttr *StandaloneDebugAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39637 auto *A = new (Ctx) StandaloneDebugAttr(Ctx, CommonInfo);
39638 A->setImplicit(true);
39639 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39640 A->setAttributeSpellingListIndex(0);
39641 return A;
39642 }
39643
39644 StandaloneDebugAttr *StandaloneDebugAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39645 auto *A = new (Ctx) StandaloneDebugAttr(Ctx, CommonInfo);
39646 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39647 A->setAttributeSpellingListIndex(0);
39648 return A;
39649 }
39650
39651 StandaloneDebugAttr *StandaloneDebugAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
39652 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39653 switch (S) {
39654 case GNU_standalone_debug:
39655 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_standalone_debug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39656 case CXX11_clang_standalone_debug:
39657 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_standalone_debug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39658 default:
39659 llvm_unreachable("Unknown attribute spelling!");
39660 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39661 }
39662 }());
39663 return CreateImplicit(Ctx, I);
39664 }
39665
39666 StandaloneDebugAttr *StandaloneDebugAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
39667 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39668 switch (S) {
39669 case GNU_standalone_debug:
39670 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_standalone_debug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39671 case CXX11_clang_standalone_debug:
39672 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_standalone_debug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39673 default:
39674 llvm_unreachable("Unknown attribute spelling!");
39675 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39676 }
39677 }());
39678 return Create(Ctx, I);
39679 }
39680
39681 StandaloneDebugAttr::StandaloneDebugAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39682 )
39683 : InheritableAttr(Ctx, CommonInfo, attr::StandaloneDebug, /*IsLateParsed=*/false, false)
39684 {
39685 }
39686
39687 StandaloneDebugAttr *StandaloneDebugAttr::clone(ASTContext &C) const {
39688 auto *A = new (C) StandaloneDebugAttr(C, *this);
39689 A->Inherited = Inherited;
39690 A->IsPackExpansion = IsPackExpansion;
39691 A->setImplicit(Implicit);
39692 return A;
39693 }
39694
39695 void StandaloneDebugAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
39696 bool IsFirstArgument = true; (void)IsFirstArgument;
39697 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
39698 switch (getAttributeSpellingListIndex()) {
39699 default:
39700 llvm_unreachable("Unknown attribute spelling!");
39701 break;
39702 case 0 : {
39703 OS << "__attribute__((standalone_debug";
39704 OS << "))";
39705 break;
39706 }
39707 case 1 : {
39708 OS << "[[clang::standalone_debug";
39709 OS << "]]";
39710 break;
39711 }
39712 }
39713 }
39714
39715 const char *StandaloneDebugAttr::getSpelling() const {
39716 switch (getAttributeSpellingListIndex()) {
39717 default:
39718 llvm_unreachable("Unknown attribute spelling!");
39719 return "(No spelling)";
39720 case 0:
39721 return "standalone_debug";
39722 case 1:
39723 return "standalone_debug";
39724 }
39725 }
39726
39727
39728 // StdCallAttr implementation
39729
39730 StdCallAttr *StdCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39731 auto *A = new (Ctx) StdCallAttr(Ctx, CommonInfo);
39732 A->setImplicit(true);
39733 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39734 A->setAttributeSpellingListIndex(0);
39735 return A;
39736 }
39737
39738 StdCallAttr *StdCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39739 auto *A = new (Ctx) StdCallAttr(Ctx, CommonInfo);
39740 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39741 A->setAttributeSpellingListIndex(0);
39742 return A;
39743 }
39744
39745 StdCallAttr *StdCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
39746 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39747 switch (S) {
39748 case GNU_stdcall:
39749 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39750 case CXX11_gnu_stdcall:
39751 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39752 case C23_gnu_stdcall:
39753 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39754 case Keyword_stdcall:
39755 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39756 default:
39757 llvm_unreachable("Unknown attribute spelling!");
39758 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39759 }
39760 }());
39761 return CreateImplicit(Ctx, I);
39762 }
39763
39764 StdCallAttr *StdCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
39765 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39766 switch (S) {
39767 case GNU_stdcall:
39768 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39769 case CXX11_gnu_stdcall:
39770 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39771 case C23_gnu_stdcall:
39772 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39773 case Keyword_stdcall:
39774 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39775 default:
39776 llvm_unreachable("Unknown attribute spelling!");
39777 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39778 }
39779 }());
39780 return Create(Ctx, I);
39781 }
39782
39783 StdCallAttr::StdCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39784 )
39785 : InheritableAttr(Ctx, CommonInfo, attr::StdCall, /*IsLateParsed=*/false, false)
39786 {
39787 }
39788
39789 StdCallAttr *StdCallAttr::clone(ASTContext &C) const {
39790 auto *A = new (C) StdCallAttr(C, *this);
39791 A->Inherited = Inherited;
39792 A->IsPackExpansion = IsPackExpansion;
39793 A->setImplicit(Implicit);
39794 return A;
39795 }
39796
39797 void StdCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
39798 bool IsFirstArgument = true; (void)IsFirstArgument;
39799 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
39800 switch (getAttributeSpellingListIndex()) {
39801 default:
39802 llvm_unreachable("Unknown attribute spelling!");
39803 break;
39804 case 0 : {
39805 OS << "__attribute__((stdcall";
39806 OS << "))";
39807 break;
39808 }
39809 case 1 : {
39810 OS << "[[gnu::stdcall";
39811 OS << "]]";
39812 break;
39813 }
39814 case 2 : {
39815 OS << "[[gnu::stdcall";
39816 OS << "]]";
39817 break;
39818 }
39819 case 3 : {
39820 OS << "__stdcall";
39821 OS << "";
39822 break;
39823 }
39824 case 4 : {
39825 OS << "_stdcall";
39826 OS << "";
39827 break;
39828 }
39829 }
39830 }
39831
39832 const char *StdCallAttr::getSpelling() const {
39833 switch (getAttributeSpellingListIndex()) {
39834 default:
39835 llvm_unreachable("Unknown attribute spelling!");
39836 return "(No spelling)";
39837 case 0:
39838 return "stdcall";
39839 case 1:
39840 return "stdcall";
39841 case 2:
39842 return "stdcall";
39843 case 3:
39844 return "__stdcall";
39845 case 4:
39846 return "_stdcall";
39847 }
39848 }
39849
39850
39851 // StrictFPAttr implementation
39852
39853 StrictFPAttr *StrictFPAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39854 auto *A = new (Ctx) StrictFPAttr(Ctx, CommonInfo);
39855 A->setImplicit(true);
39856 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39857 A->setAttributeSpellingListIndex(0);
39858 return A;
39859 }
39860
39861 StrictFPAttr *StrictFPAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39862 auto *A = new (Ctx) StrictFPAttr(Ctx, CommonInfo);
39863 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39864 A->setAttributeSpellingListIndex(0);
39865 return A;
39866 }
39867
39868 StrictFPAttr *StrictFPAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
39869 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
39870 return CreateImplicit(Ctx, I);
39871 }
39872
39873 StrictFPAttr *StrictFPAttr::Create(ASTContext &Ctx, SourceRange Range) {
39874 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
39875 return Create(Ctx, I);
39876 }
39877
39878 StrictFPAttr::StrictFPAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39879 )
39880 : InheritableAttr(Ctx, CommonInfo, attr::StrictFP, /*IsLateParsed=*/false, false)
39881 {
39882 }
39883
39884 StrictFPAttr *StrictFPAttr::clone(ASTContext &C) const {
39885 auto *A = new (C) StrictFPAttr(C, *this);
39886 A->Inherited = Inherited;
39887 A->IsPackExpansion = IsPackExpansion;
39888 A->setImplicit(Implicit);
39889 return A;
39890 }
39891
39892 void StrictFPAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
39893 }
39894
39895 const char *StrictFPAttr::getSpelling() const {
39896 return "(No spelling)";
39897 }
39898
39899
39900 // StrictGuardStackCheckAttr implementation
39901
39902 StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39903 auto *A = new (Ctx) StrictGuardStackCheckAttr(Ctx, CommonInfo);
39904 A->setImplicit(true);
39905 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39906 A->setAttributeSpellingListIndex(0);
39907 return A;
39908 }
39909
39910 StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
39911 auto *A = new (Ctx) StrictGuardStackCheckAttr(Ctx, CommonInfo);
39912 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39913 A->setAttributeSpellingListIndex(0);
39914 return A;
39915 }
39916
39917 StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
39918 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
39919 return CreateImplicit(Ctx, I);
39920 }
39921
39922 StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::Create(ASTContext &Ctx, SourceRange Range) {
39923 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
39924 return Create(Ctx, I);
39925 }
39926
39927 StrictGuardStackCheckAttr::StrictGuardStackCheckAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
39928 )
39929 : InheritableAttr(Ctx, CommonInfo, attr::StrictGuardStackCheck, /*IsLateParsed=*/false, false)
39930 {
39931 }
39932
39933 StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::clone(ASTContext &C) const {
39934 auto *A = new (C) StrictGuardStackCheckAttr(C, *this);
39935 A->Inherited = Inherited;
39936 A->IsPackExpansion = IsPackExpansion;
39937 A->setImplicit(Implicit);
39938 return A;
39939 }
39940
39941 void StrictGuardStackCheckAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
39942 bool IsFirstArgument = true; (void)IsFirstArgument;
39943 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
39944 switch (getAttributeSpellingListIndex()) {
39945 default:
39946 llvm_unreachable("Unknown attribute spelling!");
39947 break;
39948 case 0 : {
39949 OS << "__declspec(strict_gs_check";
39950 OS << ")";
39951 break;
39952 }
39953 }
39954 }
39955
39956 const char *StrictGuardStackCheckAttr::getSpelling() const {
39957 switch (getAttributeSpellingListIndex()) {
39958 default:
39959 llvm_unreachable("Unknown attribute spelling!");
39960 return "(No spelling)";
39961 case 0:
39962 return "strict_gs_check";
39963 }
39964 }
39965
39966
39967 // SuppressAttr implementation
39968
39969 SuppressAttr *SuppressAttr::CreateImplicit(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, const AttributeCommonInfo &CommonInfo) {
39970 auto *A = new (Ctx) SuppressAttr(Ctx, CommonInfo, DiagnosticIdentifiers, DiagnosticIdentifiersSize);
39971 A->setImplicit(true);
39972 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39973 A->setAttributeSpellingListIndex(0);
39974 return A;
39975 }
39976
39977 SuppressAttr *SuppressAttr::Create(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, const AttributeCommonInfo &CommonInfo) {
39978 auto *A = new (Ctx) SuppressAttr(Ctx, CommonInfo, DiagnosticIdentifiers, DiagnosticIdentifiersSize);
39979 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
39980 A->setAttributeSpellingListIndex(0);
39981 return A;
39982 }
39983
39984 SuppressAttr *SuppressAttr::CreateImplicit(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, SourceRange Range, Spelling S) {
39985 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
39986 switch (S) {
39987 case CXX11_gsl_suppress:
39988 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gsl_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39989 case GNU_suppress:
39990 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39991 case CXX11_clang_suppress:
39992 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39993 case C23_clang_suppress:
39994 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39995 default:
39996 llvm_unreachable("Unknown attribute spelling!");
39997 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
39998 }
39999 }());
40000 return CreateImplicit(Ctx, DiagnosticIdentifiers, DiagnosticIdentifiersSize, I);
40001 }
40002
40003 SuppressAttr *SuppressAttr::Create(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, SourceRange Range, Spelling S) {
40004 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40005 switch (S) {
40006 case CXX11_gsl_suppress:
40007 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gsl_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40008 case GNU_suppress:
40009 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40010 case CXX11_clang_suppress:
40011 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40012 case C23_clang_suppress:
40013 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40014 default:
40015 llvm_unreachable("Unknown attribute spelling!");
40016 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40017 }
40018 }());
40019 return Create(Ctx, DiagnosticIdentifiers, DiagnosticIdentifiersSize, I);
40020 }
40021
40022 SuppressAttr::SuppressAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40023 , StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize
40024 )
40025 : DeclOrStmtAttr(Ctx, CommonInfo, attr::Suppress, /*IsLateParsed=*/false, false)
40026 , diagnosticIdentifiers_Size(DiagnosticIdentifiersSize), diagnosticIdentifiers_(new (Ctx, 16) StringRef[diagnosticIdentifiers_Size])
40027 {
40028 for (size_t I = 0, E = diagnosticIdentifiers_Size; I != E;
40029 ++I) {
40030 StringRef Ref = DiagnosticIdentifiers[I];
40031 if (!Ref.empty()) {
40032 char *Mem = new (Ctx, 1) char[Ref.size()];
40033 std::memcpy(Mem, Ref.data(), Ref.size());
40034 diagnosticIdentifiers_[I] = StringRef(Mem, Ref.size());
40035 }
40036 }
40037 }
40038
40039 SuppressAttr::SuppressAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40040 )
40041 : DeclOrStmtAttr(Ctx, CommonInfo, attr::Suppress, /*IsLateParsed=*/false, false)
40042 , diagnosticIdentifiers_Size(0), diagnosticIdentifiers_(nullptr)
40043 {
40044 }
40045
40046
40047
40048 SuppressAttr *SuppressAttr::clone(ASTContext &C) const {
40049 auto *A = new (C) SuppressAttr(C, *this, diagnosticIdentifiers_, diagnosticIdentifiers_Size);
40050 A->Inherited = Inherited;
40051 A->IsPackExpansion = IsPackExpansion;
40052 A->setImplicit(Implicit);
40053 return A;
40054 }
40055
40056 void SuppressAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
40057 bool IsFirstArgument = true; (void)IsFirstArgument;
40058 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
40059 switch (getAttributeSpellingListIndex()) {
40060 default:
40061 llvm_unreachable("Unknown attribute spelling!");
40062 break;
40063 case 0 : {
40064 OS << "[[gsl::suppress";
40065 OS << "";
40066 for (const auto &Val : diagnosticIdentifiers()) {
40067 DelimitAttributeArgument(OS, IsFirstArgument);
40068 OS << "\"" << Val << "\"";
40069 }
40070 OS << "";
40071 if (!IsFirstArgument)
40072 OS << ")";
40073 OS << "]]";
40074 break;
40075 }
40076 case 1 : {
40077 OS << "__attribute__((suppress";
40078 OS << "";
40079 for (const auto &Val : diagnosticIdentifiers()) {
40080 DelimitAttributeArgument(OS, IsFirstArgument);
40081 OS << "\"" << Val << "\"";
40082 }
40083 OS << "";
40084 if (!IsFirstArgument)
40085 OS << ")";
40086 OS << "))";
40087 break;
40088 }
40089 case 2 : {
40090 OS << "[[clang::suppress";
40091 OS << "";
40092 for (const auto &Val : diagnosticIdentifiers()) {
40093 DelimitAttributeArgument(OS, IsFirstArgument);
40094 OS << "\"" << Val << "\"";
40095 }
40096 OS << "";
40097 if (!IsFirstArgument)
40098 OS << ")";
40099 OS << "]]";
40100 break;
40101 }
40102 case 3 : {
40103 OS << "[[clang::suppress";
40104 OS << "";
40105 for (const auto &Val : diagnosticIdentifiers()) {
40106 DelimitAttributeArgument(OS, IsFirstArgument);
40107 OS << "\"" << Val << "\"";
40108 }
40109 OS << "";
40110 if (!IsFirstArgument)
40111 OS << ")";
40112 OS << "]]";
40113 break;
40114 }
40115 }
40116 }
40117
40118 const char *SuppressAttr::getSpelling() const {
40119 switch (getAttributeSpellingListIndex()) {
40120 default:
40121 llvm_unreachable("Unknown attribute spelling!");
40122 return "(No spelling)";
40123 case 0:
40124 return "suppress";
40125 case 1:
40126 return "suppress";
40127 case 2:
40128 return "suppress";
40129 case 3:
40130 return "suppress";
40131 }
40132 }
40133
40134
40135 // SwiftAsyncAttr implementation
40136
40137 SwiftAsyncAttr *SwiftAsyncAttr::CreateImplicit(ASTContext &Ctx, SwiftAsyncAttr::Kind Kind, ParamIdx CompletionHandlerIndex, const AttributeCommonInfo &CommonInfo) {
40138 auto *A = new (Ctx) SwiftAsyncAttr(Ctx, CommonInfo, Kind, CompletionHandlerIndex);
40139 A->setImplicit(true);
40140 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40141 A->setAttributeSpellingListIndex(0);
40142 return A;
40143 }
40144
40145 SwiftAsyncAttr *SwiftAsyncAttr::Create(ASTContext &Ctx, SwiftAsyncAttr::Kind Kind, ParamIdx CompletionHandlerIndex, const AttributeCommonInfo &CommonInfo) {
40146 auto *A = new (Ctx) SwiftAsyncAttr(Ctx, CommonInfo, Kind, CompletionHandlerIndex);
40147 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40148 A->setAttributeSpellingListIndex(0);
40149 return A;
40150 }
40151
40152 SwiftAsyncAttr *SwiftAsyncAttr::CreateImplicit(ASTContext &Ctx, SwiftAsyncAttr::Kind Kind, ParamIdx CompletionHandlerIndex, SourceRange Range, Spelling S) {
40153 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40154 switch (S) {
40155 case GNU_swift_async:
40156 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40157 case CXX11_clang_swift_async:
40158 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40159 case C23_clang_swift_async:
40160 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40161 default:
40162 llvm_unreachable("Unknown attribute spelling!");
40163 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40164 }
40165 }());
40166 return CreateImplicit(Ctx, Kind, CompletionHandlerIndex, I);
40167 }
40168
40169 SwiftAsyncAttr *SwiftAsyncAttr::Create(ASTContext &Ctx, SwiftAsyncAttr::Kind Kind, ParamIdx CompletionHandlerIndex, SourceRange Range, Spelling S) {
40170 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40171 switch (S) {
40172 case GNU_swift_async:
40173 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40174 case CXX11_clang_swift_async:
40175 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40176 case C23_clang_swift_async:
40177 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40178 default:
40179 llvm_unreachable("Unknown attribute spelling!");
40180 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40181 }
40182 }());
40183 return Create(Ctx, Kind, CompletionHandlerIndex, I);
40184 }
40185
40186 SwiftAsyncAttr::SwiftAsyncAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40187 , SwiftAsyncAttr::Kind Kind
40188 , ParamIdx CompletionHandlerIndex
40189 )
40190 : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsync, /*IsLateParsed=*/false, false)
40191 , kind(Kind)
40192 , completionHandlerIndex(CompletionHandlerIndex)
40193 {
40194 }
40195
40196 SwiftAsyncAttr::SwiftAsyncAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40197 , SwiftAsyncAttr::Kind Kind
40198 )
40199 : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsync, /*IsLateParsed=*/false, false)
40200 , kind(Kind)
40201 , completionHandlerIndex()
40202 {
40203 }
40204
40205
40206
40207 bool SwiftAsyncAttr::ConvertStrToKind(StringRef Val, SwiftAsyncAttr::Kind &Out) {
40208 std::optional<SwiftAsyncAttr::Kind> R = llvm::StringSwitch<std::optional<SwiftAsyncAttr::Kind>>(Val)
40209 .Case("none", SwiftAsyncAttr::Kind::None)
40210 .Case("swift_private", SwiftAsyncAttr::Kind::SwiftPrivate)
40211 .Case("not_swift_private", SwiftAsyncAttr::Kind::NotSwiftPrivate)
40212 .Default(std::optional<SwiftAsyncAttr::Kind>());
40213 if (R) {
40214 Out = *R;
40215 return true;
40216 }
40217 return false;
40218 }
40219
40220 const char *SwiftAsyncAttr::ConvertKindToStr(SwiftAsyncAttr::Kind Val) {
40221 switch(Val) {
40222 case SwiftAsyncAttr::Kind::None: return "none";
40223 case SwiftAsyncAttr::Kind::SwiftPrivate: return "swift_private";
40224 case SwiftAsyncAttr::Kind::NotSwiftPrivate: return "not_swift_private";
40225 }
40226 llvm_unreachable("No enumerator with that value");
40227 }
40228
40229
40230 SwiftAsyncAttr *SwiftAsyncAttr::clone(ASTContext &C) const {
40231 auto *A = new (C) SwiftAsyncAttr(C, *this, kind, completionHandlerIndex);
40232 A->Inherited = Inherited;
40233 A->IsPackExpansion = IsPackExpansion;
40234 A->setImplicit(Implicit);
40235 return A;
40236 }
40237
40238 void SwiftAsyncAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
40239 bool IsFirstArgument = true; (void)IsFirstArgument;
40240 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
40241 switch (getAttributeSpellingListIndex()) {
40242 default:
40243 llvm_unreachable("Unknown attribute spelling!");
40244 break;
40245 case 0 : {
40246 OS << "__attribute__((swift_async";
40247 if (!getCompletionHandlerIndex().isValid())
40248 ++TrailingOmittedArgs;
40249 DelimitAttributeArgument(OS, IsFirstArgument);
40250 OS << "\"" << SwiftAsyncAttr::ConvertKindToStr(getKind()) << "\"";
40251 if (!(!getCompletionHandlerIndex().isValid())) {
40252 DelimitAttributeArgument(OS, IsFirstArgument);
40253 OS << "" << getCompletionHandlerIndex().getSourceIndex() << "";
40254 }
40255 if (!IsFirstArgument)
40256 OS << ")";
40257 OS << "))";
40258 break;
40259 }
40260 case 1 : {
40261 OS << "[[clang::swift_async";
40262 if (!getCompletionHandlerIndex().isValid())
40263 ++TrailingOmittedArgs;
40264 DelimitAttributeArgument(OS, IsFirstArgument);
40265 OS << "\"" << SwiftAsyncAttr::ConvertKindToStr(getKind()) << "\"";
40266 if (!(!getCompletionHandlerIndex().isValid())) {
40267 DelimitAttributeArgument(OS, IsFirstArgument);
40268 OS << "" << getCompletionHandlerIndex().getSourceIndex() << "";
40269 }
40270 if (!IsFirstArgument)
40271 OS << ")";
40272 OS << "]]";
40273 break;
40274 }
40275 case 2 : {
40276 OS << "[[clang::swift_async";
40277 if (!getCompletionHandlerIndex().isValid())
40278 ++TrailingOmittedArgs;
40279 DelimitAttributeArgument(OS, IsFirstArgument);
40280 OS << "\"" << SwiftAsyncAttr::ConvertKindToStr(getKind()) << "\"";
40281 if (!(!getCompletionHandlerIndex().isValid())) {
40282 DelimitAttributeArgument(OS, IsFirstArgument);
40283 OS << "" << getCompletionHandlerIndex().getSourceIndex() << "";
40284 }
40285 if (!IsFirstArgument)
40286 OS << ")";
40287 OS << "]]";
40288 break;
40289 }
40290 }
40291 }
40292
40293 const char *SwiftAsyncAttr::getSpelling() const {
40294 switch (getAttributeSpellingListIndex()) {
40295 default:
40296 llvm_unreachable("Unknown attribute spelling!");
40297 return "(No spelling)";
40298 case 0:
40299 return "swift_async";
40300 case 1:
40301 return "swift_async";
40302 case 2:
40303 return "swift_async";
40304 }
40305 }
40306
40307
40308 // SwiftAsyncCallAttr implementation
40309
40310 SwiftAsyncCallAttr *SwiftAsyncCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
40311 auto *A = new (Ctx) SwiftAsyncCallAttr(Ctx, CommonInfo);
40312 A->setImplicit(true);
40313 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40314 A->setAttributeSpellingListIndex(0);
40315 return A;
40316 }
40317
40318 SwiftAsyncCallAttr *SwiftAsyncCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
40319 auto *A = new (Ctx) SwiftAsyncCallAttr(Ctx, CommonInfo);
40320 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40321 A->setAttributeSpellingListIndex(0);
40322 return A;
40323 }
40324
40325 SwiftAsyncCallAttr *SwiftAsyncCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
40326 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40327 switch (S) {
40328 case GNU_swiftasynccall:
40329 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40330 case CXX11_clang_swiftasynccall:
40331 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40332 case C23_clang_swiftasynccall:
40333 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40334 default:
40335 llvm_unreachable("Unknown attribute spelling!");
40336 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40337 }
40338 }());
40339 return CreateImplicit(Ctx, I);
40340 }
40341
40342 SwiftAsyncCallAttr *SwiftAsyncCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
40343 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40344 switch (S) {
40345 case GNU_swiftasynccall:
40346 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40347 case CXX11_clang_swiftasynccall:
40348 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40349 case C23_clang_swiftasynccall:
40350 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40351 default:
40352 llvm_unreachable("Unknown attribute spelling!");
40353 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40354 }
40355 }());
40356 return Create(Ctx, I);
40357 }
40358
40359 SwiftAsyncCallAttr::SwiftAsyncCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40360 )
40361 : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncCall, /*IsLateParsed=*/false, false)
40362 {
40363 }
40364
40365 SwiftAsyncCallAttr *SwiftAsyncCallAttr::clone(ASTContext &C) const {
40366 auto *A = new (C) SwiftAsyncCallAttr(C, *this);
40367 A->Inherited = Inherited;
40368 A->IsPackExpansion = IsPackExpansion;
40369 A->setImplicit(Implicit);
40370 return A;
40371 }
40372
40373 void SwiftAsyncCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
40374 bool IsFirstArgument = true; (void)IsFirstArgument;
40375 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
40376 switch (getAttributeSpellingListIndex()) {
40377 default:
40378 llvm_unreachable("Unknown attribute spelling!");
40379 break;
40380 case 0 : {
40381 OS << "__attribute__((swiftasynccall";
40382 OS << "))";
40383 break;
40384 }
40385 case 1 : {
40386 OS << "[[clang::swiftasynccall";
40387 OS << "]]";
40388 break;
40389 }
40390 case 2 : {
40391 OS << "[[clang::swiftasynccall";
40392 OS << "]]";
40393 break;
40394 }
40395 }
40396 }
40397
40398 const char *SwiftAsyncCallAttr::getSpelling() const {
40399 switch (getAttributeSpellingListIndex()) {
40400 default:
40401 llvm_unreachable("Unknown attribute spelling!");
40402 return "(No spelling)";
40403 case 0:
40404 return "swiftasynccall";
40405 case 1:
40406 return "swiftasynccall";
40407 case 2:
40408 return "swiftasynccall";
40409 }
40410 }
40411
40412
40413 // SwiftAsyncContextAttr implementation
40414
40415 SwiftAsyncContextAttr *SwiftAsyncContextAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
40416 auto *A = new (Ctx) SwiftAsyncContextAttr(Ctx, CommonInfo);
40417 A->setImplicit(true);
40418 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40419 A->setAttributeSpellingListIndex(0);
40420 return A;
40421 }
40422
40423 SwiftAsyncContextAttr *SwiftAsyncContextAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
40424 auto *A = new (Ctx) SwiftAsyncContextAttr(Ctx, CommonInfo);
40425 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40426 A->setAttributeSpellingListIndex(0);
40427 return A;
40428 }
40429
40430 SwiftAsyncContextAttr *SwiftAsyncContextAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
40431 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40432 switch (S) {
40433 case GNU_swift_async_context:
40434 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40435 case CXX11_clang_swift_async_context:
40436 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40437 case C23_clang_swift_async_context:
40438 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40439 default:
40440 llvm_unreachable("Unknown attribute spelling!");
40441 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40442 }
40443 }());
40444 return CreateImplicit(Ctx, I);
40445 }
40446
40447 SwiftAsyncContextAttr *SwiftAsyncContextAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
40448 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40449 switch (S) {
40450 case GNU_swift_async_context:
40451 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40452 case CXX11_clang_swift_async_context:
40453 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40454 case C23_clang_swift_async_context:
40455 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40456 default:
40457 llvm_unreachable("Unknown attribute spelling!");
40458 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40459 }
40460 }());
40461 return Create(Ctx, I);
40462 }
40463
40464 SwiftAsyncContextAttr::SwiftAsyncContextAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40465 )
40466 : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftAsyncContext, /*IsLateParsed=*/false, false)
40467 {
40468 }
40469
40470 SwiftAsyncContextAttr *SwiftAsyncContextAttr::clone(ASTContext &C) const {
40471 auto *A = new (C) SwiftAsyncContextAttr(C, *this);
40472 A->Inherited = Inherited;
40473 A->IsPackExpansion = IsPackExpansion;
40474 A->setImplicit(Implicit);
40475 return A;
40476 }
40477
40478 void SwiftAsyncContextAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
40479 bool IsFirstArgument = true; (void)IsFirstArgument;
40480 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
40481 switch (getAttributeSpellingListIndex()) {
40482 default:
40483 llvm_unreachable("Unknown attribute spelling!");
40484 break;
40485 case 0 : {
40486 OS << "__attribute__((swift_async_context";
40487 OS << "))";
40488 break;
40489 }
40490 case 1 : {
40491 OS << "[[clang::swift_async_context";
40492 OS << "]]";
40493 break;
40494 }
40495 case 2 : {
40496 OS << "[[clang::swift_async_context";
40497 OS << "]]";
40498 break;
40499 }
40500 }
40501 }
40502
40503 const char *SwiftAsyncContextAttr::getSpelling() const {
40504 switch (getAttributeSpellingListIndex()) {
40505 default:
40506 llvm_unreachable("Unknown attribute spelling!");
40507 return "(No spelling)";
40508 case 0:
40509 return "swift_async_context";
40510 case 1:
40511 return "swift_async_context";
40512 case 2:
40513 return "swift_async_context";
40514 }
40515 }
40516
40517
40518 // SwiftAsyncErrorAttr implementation
40519
40520 SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::CreateImplicit(ASTContext &Ctx, SwiftAsyncErrorAttr::ConventionKind Convention, unsigned HandlerParamIdx, const AttributeCommonInfo &CommonInfo) {
40521 auto *A = new (Ctx) SwiftAsyncErrorAttr(Ctx, CommonInfo, Convention, HandlerParamIdx);
40522 A->setImplicit(true);
40523 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40524 A->setAttributeSpellingListIndex(0);
40525 return A;
40526 }
40527
40528 SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::Create(ASTContext &Ctx, SwiftAsyncErrorAttr::ConventionKind Convention, unsigned HandlerParamIdx, const AttributeCommonInfo &CommonInfo) {
40529 auto *A = new (Ctx) SwiftAsyncErrorAttr(Ctx, CommonInfo, Convention, HandlerParamIdx);
40530 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40531 A->setAttributeSpellingListIndex(0);
40532 return A;
40533 }
40534
40535 SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::CreateImplicit(ASTContext &Ctx, SwiftAsyncErrorAttr::ConventionKind Convention, unsigned HandlerParamIdx, SourceRange Range, Spelling S) {
40536 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40537 switch (S) {
40538 case GNU_swift_async_error:
40539 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40540 case CXX11_clang_swift_async_error:
40541 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40542 case C23_clang_swift_async_error:
40543 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40544 default:
40545 llvm_unreachable("Unknown attribute spelling!");
40546 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40547 }
40548 }());
40549 return CreateImplicit(Ctx, Convention, HandlerParamIdx, I);
40550 }
40551
40552 SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::Create(ASTContext &Ctx, SwiftAsyncErrorAttr::ConventionKind Convention, unsigned HandlerParamIdx, SourceRange Range, Spelling S) {
40553 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40554 switch (S) {
40555 case GNU_swift_async_error:
40556 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40557 case CXX11_clang_swift_async_error:
40558 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40559 case C23_clang_swift_async_error:
40560 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40561 default:
40562 llvm_unreachable("Unknown attribute spelling!");
40563 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
40564 }
40565 }());
40566 return Create(Ctx, Convention, HandlerParamIdx, I);
40567 }
40568
40569 SwiftAsyncErrorAttr::SwiftAsyncErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40570 , SwiftAsyncErrorAttr::ConventionKind Convention
40571 , unsigned HandlerParamIdx
40572 )
40573 : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncError, /*IsLateParsed=*/false, false)
40574 , convention(Convention)
40575 , handlerParamIdx(HandlerParamIdx)
40576 {
40577 }
40578
40579 SwiftAsyncErrorAttr::SwiftAsyncErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40580 , SwiftAsyncErrorAttr::ConventionKind Convention
40581 )
40582 : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncError, /*IsLateParsed=*/false, false)
40583 , convention(Convention)
40584 , handlerParamIdx()
40585 {
40586 }
40587
40588
40589
40590 bool SwiftAsyncErrorAttr::ConvertStrToConventionKind(StringRef Val, SwiftAsyncErrorAttr::ConventionKind &Out) {
40591 std::optional<SwiftAsyncErrorAttr::ConventionKind> R = llvm::StringSwitch<std::optional<SwiftAsyncErrorAttr::ConventionKind>>(Val)
40592 .Case("none", SwiftAsyncErrorAttr::ConventionKind::None)
40593 .Case("nonnull_error", SwiftAsyncErrorAttr::ConventionKind::NonNullError)
40594 .Case("zero_argument", SwiftAsyncErrorAttr::ConventionKind::ZeroArgument)
40595 .Case("nonzero_argument", SwiftAsyncErrorAttr::ConventionKind::NonZeroArgument)
40596 .Default(std::optional<SwiftAsyncErrorAttr::ConventionKind>());
40597 if (R) {
40598 Out = *R;
40599 return true;
40600 }
40601 return false;
40602 }
40603
40604 const char *SwiftAsyncErrorAttr::ConvertConventionKindToStr(SwiftAsyncErrorAttr::ConventionKind Val) {
40605 switch(Val) {
40606 case SwiftAsyncErrorAttr::ConventionKind::None: return "none";
40607 case SwiftAsyncErrorAttr::ConventionKind::NonNullError: return "nonnull_error";
40608 case SwiftAsyncErrorAttr::ConventionKind::ZeroArgument: return "zero_argument";
40609 case SwiftAsyncErrorAttr::ConventionKind::NonZeroArgument: return "nonzero_argument";
40610 }
40611 llvm_unreachable("No enumerator with that value");
40612 }
40613
40614
40615 SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::clone(ASTContext &C) const {
40616 auto *A = new (C) SwiftAsyncErrorAttr(C, *this, convention, handlerParamIdx);
40617 A->Inherited = Inherited;
40618 A->IsPackExpansion = IsPackExpansion;
40619 A->setImplicit(Implicit);
40620 return A;
40621 }
40622
40623 void SwiftAsyncErrorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
40624 bool IsFirstArgument = true; (void)IsFirstArgument;
40625 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
40626 switch (getAttributeSpellingListIndex()) {
40627 default:
40628 llvm_unreachable("Unknown attribute spelling!");
40629 break;
40630 case 0 : {
40631 OS << "__attribute__((swift_async_error";
40632 DelimitAttributeArgument(OS, IsFirstArgument);
40633 OS << "\"" << SwiftAsyncErrorAttr::ConvertConventionKindToStr(getConvention()) << "\"";
40634 DelimitAttributeArgument(OS, IsFirstArgument);
40635 OS << "" << getHandlerParamIdx() << "";
40636 if (!IsFirstArgument)
40637 OS << ")";
40638 OS << "))";
40639 break;
40640 }
40641 case 1 : {
40642 OS << "[[clang::swift_async_error";
40643 DelimitAttributeArgument(OS, IsFirstArgument);
40644 OS << "\"" << SwiftAsyncErrorAttr::ConvertConventionKindToStr(getConvention()) << "\"";
40645 DelimitAttributeArgument(OS, IsFirstArgument);
40646 OS << "" << getHandlerParamIdx() << "";
40647 if (!IsFirstArgument)
40648 OS << ")";
40649 OS << "]]";
40650 break;
40651 }
40652 case 2 : {
40653 OS << "[[clang::swift_async_error";
40654 DelimitAttributeArgument(OS, IsFirstArgument);
40655 OS << "\"" << SwiftAsyncErrorAttr::ConvertConventionKindToStr(getConvention()) << "\"";
40656 DelimitAttributeArgument(OS, IsFirstArgument);
40657 OS << "" << getHandlerParamIdx() << "";
40658 if (!IsFirstArgument)
40659 OS << ")";
40660 OS << "]]";
40661 break;
40662 }
40663 }
40664 }
40665
40666 const char *SwiftAsyncErrorAttr::getSpelling() const {
40667 switch (getAttributeSpellingListIndex()) {
40668 default:
40669 llvm_unreachable("Unknown attribute spelling!");
40670 return "(No spelling)";
40671 case 0:
40672 return "swift_async_error";
40673 case 1:
40674 return "swift_async_error";
40675 case 2:
40676 return "swift_async_error";
40677 }
40678 }
40679
40680
40681 // SwiftAsyncNameAttr implementation
40682
40683 SwiftAsyncNameAttr *SwiftAsyncNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
40684 auto *A = new (Ctx) SwiftAsyncNameAttr(Ctx, CommonInfo, Name);
40685 A->setImplicit(true);
40686 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40687 A->setAttributeSpellingListIndex(0);
40688 return A;
40689 }
40690
40691 SwiftAsyncNameAttr *SwiftAsyncNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
40692 auto *A = new (Ctx) SwiftAsyncNameAttr(Ctx, CommonInfo, Name);
40693 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40694 A->setAttributeSpellingListIndex(0);
40695 return A;
40696 }
40697
40698 SwiftAsyncNameAttr *SwiftAsyncNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
40699 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
40700 return CreateImplicit(Ctx, Name, I);
40701 }
40702
40703 SwiftAsyncNameAttr *SwiftAsyncNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
40704 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
40705 return Create(Ctx, Name, I);
40706 }
40707
40708 SwiftAsyncNameAttr::SwiftAsyncNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40709 , llvm::StringRef Name
40710 )
40711 : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncName, /*IsLateParsed=*/false, false)
40712 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
40713 {
40714 if (!Name.empty())
40715 std::memcpy(name, Name.data(), nameLength);
40716 }
40717
40718
40719
40720 SwiftAsyncNameAttr *SwiftAsyncNameAttr::clone(ASTContext &C) const {
40721 auto *A = new (C) SwiftAsyncNameAttr(C, *this, getName());
40722 A->Inherited = Inherited;
40723 A->IsPackExpansion = IsPackExpansion;
40724 A->setImplicit(Implicit);
40725 return A;
40726 }
40727
40728 void SwiftAsyncNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
40729 bool IsFirstArgument = true; (void)IsFirstArgument;
40730 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
40731 switch (getAttributeSpellingListIndex()) {
40732 default:
40733 llvm_unreachable("Unknown attribute spelling!");
40734 break;
40735 case 0 : {
40736 OS << "__attribute__((swift_async_name";
40737 DelimitAttributeArgument(OS, IsFirstArgument);
40738 OS << "\"" << getName() << "\"";
40739 if (!IsFirstArgument)
40740 OS << ")";
40741 OS << "))";
40742 break;
40743 }
40744 }
40745 }
40746
40747 const char *SwiftAsyncNameAttr::getSpelling() const {
40748 switch (getAttributeSpellingListIndex()) {
40749 default:
40750 llvm_unreachable("Unknown attribute spelling!");
40751 return "(No spelling)";
40752 case 0:
40753 return "swift_async_name";
40754 }
40755 }
40756
40757
40758 // SwiftAttrAttr implementation
40759
40760 SwiftAttrAttr *SwiftAttrAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Attribute, const AttributeCommonInfo &CommonInfo) {
40761 auto *A = new (Ctx) SwiftAttrAttr(Ctx, CommonInfo, Attribute);
40762 A->setImplicit(true);
40763 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40764 A->setAttributeSpellingListIndex(0);
40765 return A;
40766 }
40767
40768 SwiftAttrAttr *SwiftAttrAttr::Create(ASTContext &Ctx, llvm::StringRef Attribute, const AttributeCommonInfo &CommonInfo) {
40769 auto *A = new (Ctx) SwiftAttrAttr(Ctx, CommonInfo, Attribute);
40770 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40771 A->setAttributeSpellingListIndex(0);
40772 return A;
40773 }
40774
40775 SwiftAttrAttr *SwiftAttrAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Attribute, SourceRange Range) {
40776 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
40777 return CreateImplicit(Ctx, Attribute, I);
40778 }
40779
40780 SwiftAttrAttr *SwiftAttrAttr::Create(ASTContext &Ctx, llvm::StringRef Attribute, SourceRange Range) {
40781 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
40782 return Create(Ctx, Attribute, I);
40783 }
40784
40785 SwiftAttrAttr::SwiftAttrAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40786 , llvm::StringRef Attribute
40787 )
40788 : InheritableAttr(Ctx, CommonInfo, attr::SwiftAttr, /*IsLateParsed=*/false, false)
40789 , attributeLength(Attribute.size()),attribute(new (Ctx, 1) char[attributeLength])
40790 {
40791 if (!Attribute.empty())
40792 std::memcpy(attribute, Attribute.data(), attributeLength);
40793 }
40794
40795
40796
40797 SwiftAttrAttr *SwiftAttrAttr::clone(ASTContext &C) const {
40798 auto *A = new (C) SwiftAttrAttr(C, *this, getAttribute());
40799 A->Inherited = Inherited;
40800 A->IsPackExpansion = IsPackExpansion;
40801 A->setImplicit(Implicit);
40802 return A;
40803 }
40804
40805 void SwiftAttrAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
40806 bool IsFirstArgument = true; (void)IsFirstArgument;
40807 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
40808 switch (getAttributeSpellingListIndex()) {
40809 default:
40810 llvm_unreachable("Unknown attribute spelling!");
40811 break;
40812 case 0 : {
40813 OS << "__attribute__((swift_attr";
40814 DelimitAttributeArgument(OS, IsFirstArgument);
40815 OS << "\"" << getAttribute() << "\"";
40816 if (!IsFirstArgument)
40817 OS << ")";
40818 OS << "))";
40819 break;
40820 }
40821 }
40822 }
40823
40824 const char *SwiftAttrAttr::getSpelling() const {
40825 switch (getAttributeSpellingListIndex()) {
40826 default:
40827 llvm_unreachable("Unknown attribute spelling!");
40828 return "(No spelling)";
40829 case 0:
40830 return "swift_attr";
40831 }
40832 }
40833
40834
40835 // SwiftBridgeAttr implementation
40836
40837 SwiftBridgeAttr *SwiftBridgeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef SwiftType, const AttributeCommonInfo &CommonInfo) {
40838 auto *A = new (Ctx) SwiftBridgeAttr(Ctx, CommonInfo, SwiftType);
40839 A->setImplicit(true);
40840 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40841 A->setAttributeSpellingListIndex(0);
40842 return A;
40843 }
40844
40845 SwiftBridgeAttr *SwiftBridgeAttr::Create(ASTContext &Ctx, llvm::StringRef SwiftType, const AttributeCommonInfo &CommonInfo) {
40846 auto *A = new (Ctx) SwiftBridgeAttr(Ctx, CommonInfo, SwiftType);
40847 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40848 A->setAttributeSpellingListIndex(0);
40849 return A;
40850 }
40851
40852 SwiftBridgeAttr *SwiftBridgeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef SwiftType, SourceRange Range) {
40853 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
40854 return CreateImplicit(Ctx, SwiftType, I);
40855 }
40856
40857 SwiftBridgeAttr *SwiftBridgeAttr::Create(ASTContext &Ctx, llvm::StringRef SwiftType, SourceRange Range) {
40858 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
40859 return Create(Ctx, SwiftType, I);
40860 }
40861
40862 SwiftBridgeAttr::SwiftBridgeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40863 , llvm::StringRef SwiftType
40864 )
40865 : InheritableAttr(Ctx, CommonInfo, attr::SwiftBridge, /*IsLateParsed=*/false, false)
40866 , swiftTypeLength(SwiftType.size()),swiftType(new (Ctx, 1) char[swiftTypeLength])
40867 {
40868 if (!SwiftType.empty())
40869 std::memcpy(swiftType, SwiftType.data(), swiftTypeLength);
40870 }
40871
40872
40873
40874 SwiftBridgeAttr *SwiftBridgeAttr::clone(ASTContext &C) const {
40875 auto *A = new (C) SwiftBridgeAttr(C, *this, getSwiftType());
40876 A->Inherited = Inherited;
40877 A->IsPackExpansion = IsPackExpansion;
40878 A->setImplicit(Implicit);
40879 return A;
40880 }
40881
40882 void SwiftBridgeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
40883 bool IsFirstArgument = true; (void)IsFirstArgument;
40884 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
40885 switch (getAttributeSpellingListIndex()) {
40886 default:
40887 llvm_unreachable("Unknown attribute spelling!");
40888 break;
40889 case 0 : {
40890 OS << "__attribute__((swift_bridge";
40891 DelimitAttributeArgument(OS, IsFirstArgument);
40892 OS << "\"" << getSwiftType() << "\"";
40893 if (!IsFirstArgument)
40894 OS << ")";
40895 OS << "))";
40896 break;
40897 }
40898 }
40899 }
40900
40901 const char *SwiftBridgeAttr::getSpelling() const {
40902 switch (getAttributeSpellingListIndex()) {
40903 default:
40904 llvm_unreachable("Unknown attribute spelling!");
40905 return "(No spelling)";
40906 case 0:
40907 return "swift_bridge";
40908 }
40909 }
40910
40911
40912 // SwiftBridgedTypedefAttr implementation
40913
40914 SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
40915 auto *A = new (Ctx) SwiftBridgedTypedefAttr(Ctx, CommonInfo);
40916 A->setImplicit(true);
40917 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40918 A->setAttributeSpellingListIndex(0);
40919 return A;
40920 }
40921
40922 SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
40923 auto *A = new (Ctx) SwiftBridgedTypedefAttr(Ctx, CommonInfo);
40924 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40925 A->setAttributeSpellingListIndex(0);
40926 return A;
40927 }
40928
40929 SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
40930 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
40931 return CreateImplicit(Ctx, I);
40932 }
40933
40934 SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::Create(ASTContext &Ctx, SourceRange Range) {
40935 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
40936 return Create(Ctx, I);
40937 }
40938
40939 SwiftBridgedTypedefAttr::SwiftBridgedTypedefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
40940 )
40941 : InheritableAttr(Ctx, CommonInfo, attr::SwiftBridgedTypedef, /*IsLateParsed=*/false, false)
40942 {
40943 }
40944
40945 SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::clone(ASTContext &C) const {
40946 auto *A = new (C) SwiftBridgedTypedefAttr(C, *this);
40947 A->Inherited = Inherited;
40948 A->IsPackExpansion = IsPackExpansion;
40949 A->setImplicit(Implicit);
40950 return A;
40951 }
40952
40953 void SwiftBridgedTypedefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
40954 bool IsFirstArgument = true; (void)IsFirstArgument;
40955 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
40956 switch (getAttributeSpellingListIndex()) {
40957 default:
40958 llvm_unreachable("Unknown attribute spelling!");
40959 break;
40960 case 0 : {
40961 OS << "__attribute__((swift_bridged_typedef";
40962 OS << "))";
40963 break;
40964 }
40965 }
40966 }
40967
40968 const char *SwiftBridgedTypedefAttr::getSpelling() const {
40969 switch (getAttributeSpellingListIndex()) {
40970 default:
40971 llvm_unreachable("Unknown attribute spelling!");
40972 return "(No spelling)";
40973 case 0:
40974 return "swift_bridged_typedef";
40975 }
40976 }
40977
40978
40979 // SwiftCallAttr implementation
40980
40981 SwiftCallAttr *SwiftCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
40982 auto *A = new (Ctx) SwiftCallAttr(Ctx, CommonInfo);
40983 A->setImplicit(true);
40984 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40985 A->setAttributeSpellingListIndex(0);
40986 return A;
40987 }
40988
40989 SwiftCallAttr *SwiftCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
40990 auto *A = new (Ctx) SwiftCallAttr(Ctx, CommonInfo);
40991 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
40992 A->setAttributeSpellingListIndex(0);
40993 return A;
40994 }
40995
40996 SwiftCallAttr *SwiftCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
40997 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
40998 switch (S) {
40999 case GNU_swiftcall:
41000 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41001 case CXX11_clang_swiftcall:
41002 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41003 case C23_clang_swiftcall:
41004 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41005 default:
41006 llvm_unreachable("Unknown attribute spelling!");
41007 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41008 }
41009 }());
41010 return CreateImplicit(Ctx, I);
41011 }
41012
41013 SwiftCallAttr *SwiftCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
41014 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
41015 switch (S) {
41016 case GNU_swiftcall:
41017 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41018 case CXX11_clang_swiftcall:
41019 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41020 case C23_clang_swiftcall:
41021 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41022 default:
41023 llvm_unreachable("Unknown attribute spelling!");
41024 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41025 }
41026 }());
41027 return Create(Ctx, I);
41028 }
41029
41030 SwiftCallAttr::SwiftCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41031 )
41032 : InheritableAttr(Ctx, CommonInfo, attr::SwiftCall, /*IsLateParsed=*/false, false)
41033 {
41034 }
41035
41036 SwiftCallAttr *SwiftCallAttr::clone(ASTContext &C) const {
41037 auto *A = new (C) SwiftCallAttr(C, *this);
41038 A->Inherited = Inherited;
41039 A->IsPackExpansion = IsPackExpansion;
41040 A->setImplicit(Implicit);
41041 return A;
41042 }
41043
41044 void SwiftCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41045 bool IsFirstArgument = true; (void)IsFirstArgument;
41046 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
41047 switch (getAttributeSpellingListIndex()) {
41048 default:
41049 llvm_unreachable("Unknown attribute spelling!");
41050 break;
41051 case 0 : {
41052 OS << "__attribute__((swiftcall";
41053 OS << "))";
41054 break;
41055 }
41056 case 1 : {
41057 OS << "[[clang::swiftcall";
41058 OS << "]]";
41059 break;
41060 }
41061 case 2 : {
41062 OS << "[[clang::swiftcall";
41063 OS << "]]";
41064 break;
41065 }
41066 }
41067 }
41068
41069 const char *SwiftCallAttr::getSpelling() const {
41070 switch (getAttributeSpellingListIndex()) {
41071 default:
41072 llvm_unreachable("Unknown attribute spelling!");
41073 return "(No spelling)";
41074 case 0:
41075 return "swiftcall";
41076 case 1:
41077 return "swiftcall";
41078 case 2:
41079 return "swiftcall";
41080 }
41081 }
41082
41083
41084 // SwiftContextAttr implementation
41085
41086 SwiftContextAttr *SwiftContextAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41087 auto *A = new (Ctx) SwiftContextAttr(Ctx, CommonInfo);
41088 A->setImplicit(true);
41089 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41090 A->setAttributeSpellingListIndex(0);
41091 return A;
41092 }
41093
41094 SwiftContextAttr *SwiftContextAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41095 auto *A = new (Ctx) SwiftContextAttr(Ctx, CommonInfo);
41096 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41097 A->setAttributeSpellingListIndex(0);
41098 return A;
41099 }
41100
41101 SwiftContextAttr *SwiftContextAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
41102 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
41103 switch (S) {
41104 case GNU_swift_context:
41105 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41106 case CXX11_clang_swift_context:
41107 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41108 case C23_clang_swift_context:
41109 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41110 default:
41111 llvm_unreachable("Unknown attribute spelling!");
41112 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41113 }
41114 }());
41115 return CreateImplicit(Ctx, I);
41116 }
41117
41118 SwiftContextAttr *SwiftContextAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
41119 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
41120 switch (S) {
41121 case GNU_swift_context:
41122 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41123 case CXX11_clang_swift_context:
41124 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41125 case C23_clang_swift_context:
41126 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41127 default:
41128 llvm_unreachable("Unknown attribute spelling!");
41129 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41130 }
41131 }());
41132 return Create(Ctx, I);
41133 }
41134
41135 SwiftContextAttr::SwiftContextAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41136 )
41137 : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftContext, /*IsLateParsed=*/false, false)
41138 {
41139 }
41140
41141 SwiftContextAttr *SwiftContextAttr::clone(ASTContext &C) const {
41142 auto *A = new (C) SwiftContextAttr(C, *this);
41143 A->Inherited = Inherited;
41144 A->IsPackExpansion = IsPackExpansion;
41145 A->setImplicit(Implicit);
41146 return A;
41147 }
41148
41149 void SwiftContextAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41150 bool IsFirstArgument = true; (void)IsFirstArgument;
41151 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
41152 switch (getAttributeSpellingListIndex()) {
41153 default:
41154 llvm_unreachable("Unknown attribute spelling!");
41155 break;
41156 case 0 : {
41157 OS << "__attribute__((swift_context";
41158 OS << "))";
41159 break;
41160 }
41161 case 1 : {
41162 OS << "[[clang::swift_context";
41163 OS << "]]";
41164 break;
41165 }
41166 case 2 : {
41167 OS << "[[clang::swift_context";
41168 OS << "]]";
41169 break;
41170 }
41171 }
41172 }
41173
41174 const char *SwiftContextAttr::getSpelling() const {
41175 switch (getAttributeSpellingListIndex()) {
41176 default:
41177 llvm_unreachable("Unknown attribute spelling!");
41178 return "(No spelling)";
41179 case 0:
41180 return "swift_context";
41181 case 1:
41182 return "swift_context";
41183 case 2:
41184 return "swift_context";
41185 }
41186 }
41187
41188
41189 // SwiftErrorAttr implementation
41190
41191 SwiftErrorAttr *SwiftErrorAttr::CreateImplicit(ASTContext &Ctx, SwiftErrorAttr::ConventionKind Convention, const AttributeCommonInfo &CommonInfo) {
41192 auto *A = new (Ctx) SwiftErrorAttr(Ctx, CommonInfo, Convention);
41193 A->setImplicit(true);
41194 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41195 A->setAttributeSpellingListIndex(0);
41196 return A;
41197 }
41198
41199 SwiftErrorAttr *SwiftErrorAttr::Create(ASTContext &Ctx, SwiftErrorAttr::ConventionKind Convention, const AttributeCommonInfo &CommonInfo) {
41200 auto *A = new (Ctx) SwiftErrorAttr(Ctx, CommonInfo, Convention);
41201 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41202 A->setAttributeSpellingListIndex(0);
41203 return A;
41204 }
41205
41206 SwiftErrorAttr *SwiftErrorAttr::CreateImplicit(ASTContext &Ctx, SwiftErrorAttr::ConventionKind Convention, SourceRange Range) {
41207 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
41208 return CreateImplicit(Ctx, Convention, I);
41209 }
41210
41211 SwiftErrorAttr *SwiftErrorAttr::Create(ASTContext &Ctx, SwiftErrorAttr::ConventionKind Convention, SourceRange Range) {
41212 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
41213 return Create(Ctx, Convention, I);
41214 }
41215
41216 SwiftErrorAttr::SwiftErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41217 , SwiftErrorAttr::ConventionKind Convention
41218 )
41219 : InheritableAttr(Ctx, CommonInfo, attr::SwiftError, /*IsLateParsed=*/false, false)
41220 , convention(Convention)
41221 {
41222 }
41223
41224
41225
41226 bool SwiftErrorAttr::ConvertStrToConventionKind(StringRef Val, SwiftErrorAttr::ConventionKind &Out) {
41227 std::optional<SwiftErrorAttr::ConventionKind> R = llvm::StringSwitch<std::optional<SwiftErrorAttr::ConventionKind>>(Val)
41228 .Case("none", SwiftErrorAttr::ConventionKind::None)
41229 .Case("nonnull_error", SwiftErrorAttr::ConventionKind::NonNullError)
41230 .Case("null_result", SwiftErrorAttr::ConventionKind::NullResult)
41231 .Case("zero_result", SwiftErrorAttr::ConventionKind::ZeroResult)
41232 .Case("nonzero_result", SwiftErrorAttr::ConventionKind::NonZeroResult)
41233 .Default(std::optional<SwiftErrorAttr::ConventionKind>());
41234 if (R) {
41235 Out = *R;
41236 return true;
41237 }
41238 return false;
41239 }
41240
41241 const char *SwiftErrorAttr::ConvertConventionKindToStr(SwiftErrorAttr::ConventionKind Val) {
41242 switch(Val) {
41243 case SwiftErrorAttr::ConventionKind::None: return "none";
41244 case SwiftErrorAttr::ConventionKind::NonNullError: return "nonnull_error";
41245 case SwiftErrorAttr::ConventionKind::NullResult: return "null_result";
41246 case SwiftErrorAttr::ConventionKind::ZeroResult: return "zero_result";
41247 case SwiftErrorAttr::ConventionKind::NonZeroResult: return "nonzero_result";
41248 }
41249 llvm_unreachable("No enumerator with that value");
41250 }
41251 SwiftErrorAttr *SwiftErrorAttr::clone(ASTContext &C) const {
41252 auto *A = new (C) SwiftErrorAttr(C, *this, convention);
41253 A->Inherited = Inherited;
41254 A->IsPackExpansion = IsPackExpansion;
41255 A->setImplicit(Implicit);
41256 return A;
41257 }
41258
41259 void SwiftErrorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41260 bool IsFirstArgument = true; (void)IsFirstArgument;
41261 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
41262 switch (getAttributeSpellingListIndex()) {
41263 default:
41264 llvm_unreachable("Unknown attribute spelling!");
41265 break;
41266 case 0 : {
41267 OS << "__attribute__((swift_error";
41268 DelimitAttributeArgument(OS, IsFirstArgument);
41269 OS << "\"" << SwiftErrorAttr::ConvertConventionKindToStr(getConvention()) << "\"";
41270 if (!IsFirstArgument)
41271 OS << ")";
41272 OS << "))";
41273 break;
41274 }
41275 }
41276 }
41277
41278 const char *SwiftErrorAttr::getSpelling() const {
41279 switch (getAttributeSpellingListIndex()) {
41280 default:
41281 llvm_unreachable("Unknown attribute spelling!");
41282 return "(No spelling)";
41283 case 0:
41284 return "swift_error";
41285 }
41286 }
41287
41288
41289 // SwiftErrorResultAttr implementation
41290
41291 SwiftErrorResultAttr *SwiftErrorResultAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41292 auto *A = new (Ctx) SwiftErrorResultAttr(Ctx, CommonInfo);
41293 A->setImplicit(true);
41294 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41295 A->setAttributeSpellingListIndex(0);
41296 return A;
41297 }
41298
41299 SwiftErrorResultAttr *SwiftErrorResultAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41300 auto *A = new (Ctx) SwiftErrorResultAttr(Ctx, CommonInfo);
41301 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41302 A->setAttributeSpellingListIndex(0);
41303 return A;
41304 }
41305
41306 SwiftErrorResultAttr *SwiftErrorResultAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
41307 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
41308 switch (S) {
41309 case GNU_swift_error_result:
41310 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41311 case CXX11_clang_swift_error_result:
41312 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41313 case C23_clang_swift_error_result:
41314 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41315 default:
41316 llvm_unreachable("Unknown attribute spelling!");
41317 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41318 }
41319 }());
41320 return CreateImplicit(Ctx, I);
41321 }
41322
41323 SwiftErrorResultAttr *SwiftErrorResultAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
41324 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
41325 switch (S) {
41326 case GNU_swift_error_result:
41327 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41328 case CXX11_clang_swift_error_result:
41329 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41330 case C23_clang_swift_error_result:
41331 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41332 default:
41333 llvm_unreachable("Unknown attribute spelling!");
41334 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41335 }
41336 }());
41337 return Create(Ctx, I);
41338 }
41339
41340 SwiftErrorResultAttr::SwiftErrorResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41341 )
41342 : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftErrorResult, /*IsLateParsed=*/false, false)
41343 {
41344 }
41345
41346 SwiftErrorResultAttr *SwiftErrorResultAttr::clone(ASTContext &C) const {
41347 auto *A = new (C) SwiftErrorResultAttr(C, *this);
41348 A->Inherited = Inherited;
41349 A->IsPackExpansion = IsPackExpansion;
41350 A->setImplicit(Implicit);
41351 return A;
41352 }
41353
41354 void SwiftErrorResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41355 bool IsFirstArgument = true; (void)IsFirstArgument;
41356 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
41357 switch (getAttributeSpellingListIndex()) {
41358 default:
41359 llvm_unreachable("Unknown attribute spelling!");
41360 break;
41361 case 0 : {
41362 OS << "__attribute__((swift_error_result";
41363 OS << "))";
41364 break;
41365 }
41366 case 1 : {
41367 OS << "[[clang::swift_error_result";
41368 OS << "]]";
41369 break;
41370 }
41371 case 2 : {
41372 OS << "[[clang::swift_error_result";
41373 OS << "]]";
41374 break;
41375 }
41376 }
41377 }
41378
41379 const char *SwiftErrorResultAttr::getSpelling() const {
41380 switch (getAttributeSpellingListIndex()) {
41381 default:
41382 llvm_unreachable("Unknown attribute spelling!");
41383 return "(No spelling)";
41384 case 0:
41385 return "swift_error_result";
41386 case 1:
41387 return "swift_error_result";
41388 case 2:
41389 return "swift_error_result";
41390 }
41391 }
41392
41393
41394 // SwiftImportAsNonGenericAttr implementation
41395
41396 SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41397 auto *A = new (Ctx) SwiftImportAsNonGenericAttr(Ctx, CommonInfo);
41398 A->setImplicit(true);
41399 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41400 A->setAttributeSpellingListIndex(0);
41401 return A;
41402 }
41403
41404 SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41405 auto *A = new (Ctx) SwiftImportAsNonGenericAttr(Ctx, CommonInfo);
41406 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41407 A->setAttributeSpellingListIndex(0);
41408 return A;
41409 }
41410
41411 SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
41412 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
41413 return CreateImplicit(Ctx, I);
41414 }
41415
41416 SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::Create(ASTContext &Ctx, SourceRange Range) {
41417 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
41418 return Create(Ctx, I);
41419 }
41420
41421 SwiftImportAsNonGenericAttr::SwiftImportAsNonGenericAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41422 )
41423 : InheritableAttr(Ctx, CommonInfo, attr::SwiftImportAsNonGeneric, /*IsLateParsed=*/false, false)
41424 {
41425 }
41426
41427 SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::clone(ASTContext &C) const {
41428 auto *A = new (C) SwiftImportAsNonGenericAttr(C, *this);
41429 A->Inherited = Inherited;
41430 A->IsPackExpansion = IsPackExpansion;
41431 A->setImplicit(Implicit);
41432 return A;
41433 }
41434
41435 void SwiftImportAsNonGenericAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41436 }
41437
41438 const char *SwiftImportAsNonGenericAttr::getSpelling() const {
41439 return "(No spelling)";
41440 }
41441
41442
41443 // SwiftImportPropertyAsAccessorsAttr implementation
41444
41445 SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41446 auto *A = new (Ctx) SwiftImportPropertyAsAccessorsAttr(Ctx, CommonInfo);
41447 A->setImplicit(true);
41448 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41449 A->setAttributeSpellingListIndex(0);
41450 return A;
41451 }
41452
41453 SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41454 auto *A = new (Ctx) SwiftImportPropertyAsAccessorsAttr(Ctx, CommonInfo);
41455 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41456 A->setAttributeSpellingListIndex(0);
41457 return A;
41458 }
41459
41460 SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
41461 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
41462 return CreateImplicit(Ctx, I);
41463 }
41464
41465 SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::Create(ASTContext &Ctx, SourceRange Range) {
41466 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
41467 return Create(Ctx, I);
41468 }
41469
41470 SwiftImportPropertyAsAccessorsAttr::SwiftImportPropertyAsAccessorsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41471 )
41472 : InheritableAttr(Ctx, CommonInfo, attr::SwiftImportPropertyAsAccessors, /*IsLateParsed=*/false, false)
41473 {
41474 }
41475
41476 SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::clone(ASTContext &C) const {
41477 auto *A = new (C) SwiftImportPropertyAsAccessorsAttr(C, *this);
41478 A->Inherited = Inherited;
41479 A->IsPackExpansion = IsPackExpansion;
41480 A->setImplicit(Implicit);
41481 return A;
41482 }
41483
41484 void SwiftImportPropertyAsAccessorsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41485 }
41486
41487 const char *SwiftImportPropertyAsAccessorsAttr::getSpelling() const {
41488 return "(No spelling)";
41489 }
41490
41491
41492 // SwiftIndirectResultAttr implementation
41493
41494 SwiftIndirectResultAttr *SwiftIndirectResultAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41495 auto *A = new (Ctx) SwiftIndirectResultAttr(Ctx, CommonInfo);
41496 A->setImplicit(true);
41497 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41498 A->setAttributeSpellingListIndex(0);
41499 return A;
41500 }
41501
41502 SwiftIndirectResultAttr *SwiftIndirectResultAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41503 auto *A = new (Ctx) SwiftIndirectResultAttr(Ctx, CommonInfo);
41504 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41505 A->setAttributeSpellingListIndex(0);
41506 return A;
41507 }
41508
41509 SwiftIndirectResultAttr *SwiftIndirectResultAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
41510 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
41511 switch (S) {
41512 case GNU_swift_indirect_result:
41513 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41514 case CXX11_clang_swift_indirect_result:
41515 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41516 case C23_clang_swift_indirect_result:
41517 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41518 default:
41519 llvm_unreachable("Unknown attribute spelling!");
41520 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41521 }
41522 }());
41523 return CreateImplicit(Ctx, I);
41524 }
41525
41526 SwiftIndirectResultAttr *SwiftIndirectResultAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
41527 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
41528 switch (S) {
41529 case GNU_swift_indirect_result:
41530 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41531 case CXX11_clang_swift_indirect_result:
41532 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41533 case C23_clang_swift_indirect_result:
41534 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41535 default:
41536 llvm_unreachable("Unknown attribute spelling!");
41537 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41538 }
41539 }());
41540 return Create(Ctx, I);
41541 }
41542
41543 SwiftIndirectResultAttr::SwiftIndirectResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41544 )
41545 : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftIndirectResult, /*IsLateParsed=*/false, false)
41546 {
41547 }
41548
41549 SwiftIndirectResultAttr *SwiftIndirectResultAttr::clone(ASTContext &C) const {
41550 auto *A = new (C) SwiftIndirectResultAttr(C, *this);
41551 A->Inherited = Inherited;
41552 A->IsPackExpansion = IsPackExpansion;
41553 A->setImplicit(Implicit);
41554 return A;
41555 }
41556
41557 void SwiftIndirectResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41558 bool IsFirstArgument = true; (void)IsFirstArgument;
41559 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
41560 switch (getAttributeSpellingListIndex()) {
41561 default:
41562 llvm_unreachable("Unknown attribute spelling!");
41563 break;
41564 case 0 : {
41565 OS << "__attribute__((swift_indirect_result";
41566 OS << "))";
41567 break;
41568 }
41569 case 1 : {
41570 OS << "[[clang::swift_indirect_result";
41571 OS << "]]";
41572 break;
41573 }
41574 case 2 : {
41575 OS << "[[clang::swift_indirect_result";
41576 OS << "]]";
41577 break;
41578 }
41579 }
41580 }
41581
41582 const char *SwiftIndirectResultAttr::getSpelling() const {
41583 switch (getAttributeSpellingListIndex()) {
41584 default:
41585 llvm_unreachable("Unknown attribute spelling!");
41586 return "(No spelling)";
41587 case 0:
41588 return "swift_indirect_result";
41589 case 1:
41590 return "swift_indirect_result";
41591 case 2:
41592 return "swift_indirect_result";
41593 }
41594 }
41595
41596
41597 // SwiftNameAttr implementation
41598
41599 SwiftNameAttr *SwiftNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
41600 auto *A = new (Ctx) SwiftNameAttr(Ctx, CommonInfo, Name);
41601 A->setImplicit(true);
41602 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41603 A->setAttributeSpellingListIndex(0);
41604 return A;
41605 }
41606
41607 SwiftNameAttr *SwiftNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) {
41608 auto *A = new (Ctx) SwiftNameAttr(Ctx, CommonInfo, Name);
41609 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41610 A->setAttributeSpellingListIndex(0);
41611 return A;
41612 }
41613
41614 SwiftNameAttr *SwiftNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
41615 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
41616 return CreateImplicit(Ctx, Name, I);
41617 }
41618
41619 SwiftNameAttr *SwiftNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) {
41620 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
41621 return Create(Ctx, Name, I);
41622 }
41623
41624 SwiftNameAttr::SwiftNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41625 , llvm::StringRef Name
41626 )
41627 : InheritableAttr(Ctx, CommonInfo, attr::SwiftName, /*IsLateParsed=*/false, false)
41628 , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
41629 {
41630 if (!Name.empty())
41631 std::memcpy(name, Name.data(), nameLength);
41632 }
41633
41634
41635
41636 SwiftNameAttr *SwiftNameAttr::clone(ASTContext &C) const {
41637 auto *A = new (C) SwiftNameAttr(C, *this, getName());
41638 A->Inherited = Inherited;
41639 A->IsPackExpansion = IsPackExpansion;
41640 A->setImplicit(Implicit);
41641 return A;
41642 }
41643
41644 void SwiftNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41645 bool IsFirstArgument = true; (void)IsFirstArgument;
41646 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
41647 switch (getAttributeSpellingListIndex()) {
41648 default:
41649 llvm_unreachable("Unknown attribute spelling!");
41650 break;
41651 case 0 : {
41652 OS << "__attribute__((swift_name";
41653 DelimitAttributeArgument(OS, IsFirstArgument);
41654 OS << "\"" << getName() << "\"";
41655 if (!IsFirstArgument)
41656 OS << ")";
41657 OS << "))";
41658 break;
41659 }
41660 }
41661 }
41662
41663 const char *SwiftNameAttr::getSpelling() const {
41664 switch (getAttributeSpellingListIndex()) {
41665 default:
41666 llvm_unreachable("Unknown attribute spelling!");
41667 return "(No spelling)";
41668 case 0:
41669 return "swift_name";
41670 }
41671 }
41672
41673
41674 // SwiftNewTypeAttr implementation
41675
41676 SwiftNewTypeAttr *SwiftNewTypeAttr::CreateImplicit(ASTContext &Ctx, SwiftNewTypeAttr::NewtypeKind NewtypeKind, const AttributeCommonInfo &CommonInfo) {
41677 auto *A = new (Ctx) SwiftNewTypeAttr(Ctx, CommonInfo, NewtypeKind);
41678 A->setImplicit(true);
41679 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41680 A->setAttributeSpellingListIndex(0);
41681 return A;
41682 }
41683
41684 SwiftNewTypeAttr *SwiftNewTypeAttr::Create(ASTContext &Ctx, SwiftNewTypeAttr::NewtypeKind NewtypeKind, const AttributeCommonInfo &CommonInfo) {
41685 auto *A = new (Ctx) SwiftNewTypeAttr(Ctx, CommonInfo, NewtypeKind);
41686 return A;
41687 }
41688
41689 SwiftNewTypeAttr *SwiftNewTypeAttr::CreateImplicit(ASTContext &Ctx, SwiftNewTypeAttr::NewtypeKind NewtypeKind, SourceRange Range, Spelling S) {
41690 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
41691 switch (S) {
41692 case GNU_swift_newtype:
41693 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_newtype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41694 case GNU_swift_wrapper:
41695 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41696 default:
41697 llvm_unreachable("Unknown attribute spelling!");
41698 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41699 }
41700 }());
41701 return CreateImplicit(Ctx, NewtypeKind, I);
41702 }
41703
41704 SwiftNewTypeAttr *SwiftNewTypeAttr::Create(ASTContext &Ctx, SwiftNewTypeAttr::NewtypeKind NewtypeKind, SourceRange Range, Spelling S) {
41705 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
41706 switch (S) {
41707 case GNU_swift_newtype:
41708 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_newtype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41709 case GNU_swift_wrapper:
41710 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41711 default:
41712 llvm_unreachable("Unknown attribute spelling!");
41713 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
41714 }
41715 }());
41716 return Create(Ctx, NewtypeKind, I);
41717 }
41718
41719 SwiftNewTypeAttr::SwiftNewTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41720 , SwiftNewTypeAttr::NewtypeKind NewtypeKind
41721 )
41722 : InheritableAttr(Ctx, CommonInfo, attr::SwiftNewType, /*IsLateParsed=*/false, false)
41723 , newtypeKind(NewtypeKind)
41724 {
41725 }
41726
41727 SwiftNewTypeAttr::Spelling SwiftNewTypeAttr::getSemanticSpelling() const {
41728 switch (getAttributeSpellingListIndex()) {
41729 default: llvm_unreachable("Unknown spelling list index");
41730 case 0: return GNU_swift_newtype;
41731 case 1: return GNU_swift_wrapper;
41732 }
41733 }
41734
41735
41736 bool SwiftNewTypeAttr::ConvertStrToNewtypeKind(StringRef Val, SwiftNewTypeAttr::NewtypeKind &Out) {
41737 std::optional<SwiftNewTypeAttr::NewtypeKind> R = llvm::StringSwitch<std::optional<SwiftNewTypeAttr::NewtypeKind>>(Val)
41738 .Case("struct", SwiftNewTypeAttr::NewtypeKind::NK_Struct)
41739 .Case("enum", SwiftNewTypeAttr::NewtypeKind::NK_Enum)
41740 .Default(std::optional<SwiftNewTypeAttr::NewtypeKind>());
41741 if (R) {
41742 Out = *R;
41743 return true;
41744 }
41745 return false;
41746 }
41747
41748 const char *SwiftNewTypeAttr::ConvertNewtypeKindToStr(SwiftNewTypeAttr::NewtypeKind Val) {
41749 switch(Val) {
41750 case SwiftNewTypeAttr::NewtypeKind::NK_Struct: return "struct";
41751 case SwiftNewTypeAttr::NewtypeKind::NK_Enum: return "enum";
41752 }
41753 llvm_unreachable("No enumerator with that value");
41754 }
41755 SwiftNewTypeAttr *SwiftNewTypeAttr::clone(ASTContext &C) const {
41756 auto *A = new (C) SwiftNewTypeAttr(C, *this, newtypeKind);
41757 A->Inherited = Inherited;
41758 A->IsPackExpansion = IsPackExpansion;
41759 A->setImplicit(Implicit);
41760 return A;
41761 }
41762
41763 void SwiftNewTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41764 bool IsFirstArgument = true; (void)IsFirstArgument;
41765 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
41766 switch (getAttributeSpellingListIndex()) {
41767 default:
41768 llvm_unreachable("Unknown attribute spelling!");
41769 break;
41770 case 0 : {
41771 OS << "__attribute__((swift_newtype";
41772 DelimitAttributeArgument(OS, IsFirstArgument);
41773 OS << "\"" << SwiftNewTypeAttr::ConvertNewtypeKindToStr(getNewtypeKind()) << "\"";
41774 if (!IsFirstArgument)
41775 OS << ")";
41776 OS << "))";
41777 break;
41778 }
41779 case 1 : {
41780 OS << "__attribute__((swift_wrapper";
41781 DelimitAttributeArgument(OS, IsFirstArgument);
41782 OS << "\"" << SwiftNewTypeAttr::ConvertNewtypeKindToStr(getNewtypeKind()) << "\"";
41783 if (!IsFirstArgument)
41784 OS << ")";
41785 OS << "))";
41786 break;
41787 }
41788 }
41789 }
41790
41791 const char *SwiftNewTypeAttr::getSpelling() const {
41792 switch (getAttributeSpellingListIndex()) {
41793 default:
41794 llvm_unreachable("Unknown attribute spelling!");
41795 return "(No spelling)";
41796 case 0:
41797 return "swift_newtype";
41798 case 1:
41799 return "swift_wrapper";
41800 }
41801 }
41802
41803
41804 // SwiftObjCMembersAttr implementation
41805
41806 SwiftObjCMembersAttr *SwiftObjCMembersAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41807 auto *A = new (Ctx) SwiftObjCMembersAttr(Ctx, CommonInfo);
41808 A->setImplicit(true);
41809 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41810 A->setAttributeSpellingListIndex(0);
41811 return A;
41812 }
41813
41814 SwiftObjCMembersAttr *SwiftObjCMembersAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41815 auto *A = new (Ctx) SwiftObjCMembersAttr(Ctx, CommonInfo);
41816 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41817 A->setAttributeSpellingListIndex(0);
41818 return A;
41819 }
41820
41821 SwiftObjCMembersAttr *SwiftObjCMembersAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
41822 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
41823 return CreateImplicit(Ctx, I);
41824 }
41825
41826 SwiftObjCMembersAttr *SwiftObjCMembersAttr::Create(ASTContext &Ctx, SourceRange Range) {
41827 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
41828 return Create(Ctx, I);
41829 }
41830
41831 SwiftObjCMembersAttr::SwiftObjCMembersAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41832 )
41833 : Attr(Ctx, CommonInfo, attr::SwiftObjCMembers, /*IsLateParsed=*/false)
41834 {
41835 }
41836
41837 SwiftObjCMembersAttr *SwiftObjCMembersAttr::clone(ASTContext &C) const {
41838 auto *A = new (C) SwiftObjCMembersAttr(C, *this);
41839 A->Inherited = Inherited;
41840 A->IsPackExpansion = IsPackExpansion;
41841 A->setImplicit(Implicit);
41842 return A;
41843 }
41844
41845 void SwiftObjCMembersAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41846 bool IsFirstArgument = true; (void)IsFirstArgument;
41847 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
41848 switch (getAttributeSpellingListIndex()) {
41849 default:
41850 llvm_unreachable("Unknown attribute spelling!");
41851 break;
41852 case 0 : {
41853 OS << "__attribute__((swift_objc_members";
41854 OS << "))";
41855 break;
41856 }
41857 }
41858 }
41859
41860 const char *SwiftObjCMembersAttr::getSpelling() const {
41861 switch (getAttributeSpellingListIndex()) {
41862 default:
41863 llvm_unreachable("Unknown attribute spelling!");
41864 return "(No spelling)";
41865 case 0:
41866 return "swift_objc_members";
41867 }
41868 }
41869
41870
41871 // SwiftPrivateAttr implementation
41872
41873 SwiftPrivateAttr *SwiftPrivateAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41874 auto *A = new (Ctx) SwiftPrivateAttr(Ctx, CommonInfo);
41875 A->setImplicit(true);
41876 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41877 A->setAttributeSpellingListIndex(0);
41878 return A;
41879 }
41880
41881 SwiftPrivateAttr *SwiftPrivateAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
41882 auto *A = new (Ctx) SwiftPrivateAttr(Ctx, CommonInfo);
41883 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41884 A->setAttributeSpellingListIndex(0);
41885 return A;
41886 }
41887
41888 SwiftPrivateAttr *SwiftPrivateAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
41889 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
41890 return CreateImplicit(Ctx, I);
41891 }
41892
41893 SwiftPrivateAttr *SwiftPrivateAttr::Create(ASTContext &Ctx, SourceRange Range) {
41894 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
41895 return Create(Ctx, I);
41896 }
41897
41898 SwiftPrivateAttr::SwiftPrivateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41899 )
41900 : InheritableAttr(Ctx, CommonInfo, attr::SwiftPrivate, /*IsLateParsed=*/false, false)
41901 {
41902 }
41903
41904 SwiftPrivateAttr *SwiftPrivateAttr::clone(ASTContext &C) const {
41905 auto *A = new (C) SwiftPrivateAttr(C, *this);
41906 A->Inherited = Inherited;
41907 A->IsPackExpansion = IsPackExpansion;
41908 A->setImplicit(Implicit);
41909 return A;
41910 }
41911
41912 void SwiftPrivateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41913 bool IsFirstArgument = true; (void)IsFirstArgument;
41914 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
41915 switch (getAttributeSpellingListIndex()) {
41916 default:
41917 llvm_unreachable("Unknown attribute spelling!");
41918 break;
41919 case 0 : {
41920 OS << "__attribute__((swift_private";
41921 OS << "))";
41922 break;
41923 }
41924 }
41925 }
41926
41927 const char *SwiftPrivateAttr::getSpelling() const {
41928 switch (getAttributeSpellingListIndex()) {
41929 default:
41930 llvm_unreachable("Unknown attribute spelling!");
41931 return "(No spelling)";
41932 case 0:
41933 return "swift_private";
41934 }
41935 }
41936
41937
41938 // SwiftVersionedAdditionAttr implementation
41939
41940 SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::CreateImplicit(ASTContext &Ctx, VersionTuple Version, Attr * AdditionalAttr, bool IsReplacedByActive, const AttributeCommonInfo &CommonInfo) {
41941 auto *A = new (Ctx) SwiftVersionedAdditionAttr(Ctx, CommonInfo, Version, AdditionalAttr, IsReplacedByActive);
41942 A->setImplicit(true);
41943 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41944 A->setAttributeSpellingListIndex(0);
41945 return A;
41946 }
41947
41948 SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::Create(ASTContext &Ctx, VersionTuple Version, Attr * AdditionalAttr, bool IsReplacedByActive, const AttributeCommonInfo &CommonInfo) {
41949 auto *A = new (Ctx) SwiftVersionedAdditionAttr(Ctx, CommonInfo, Version, AdditionalAttr, IsReplacedByActive);
41950 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
41951 A->setAttributeSpellingListIndex(0);
41952 return A;
41953 }
41954
41955 SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::CreateImplicit(ASTContext &Ctx, VersionTuple Version, Attr * AdditionalAttr, bool IsReplacedByActive, SourceRange Range) {
41956 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
41957 return CreateImplicit(Ctx, Version, AdditionalAttr, IsReplacedByActive, I);
41958 }
41959
41960 SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::Create(ASTContext &Ctx, VersionTuple Version, Attr * AdditionalAttr, bool IsReplacedByActive, SourceRange Range) {
41961 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
41962 return Create(Ctx, Version, AdditionalAttr, IsReplacedByActive, I);
41963 }
41964
41965 SwiftVersionedAdditionAttr::SwiftVersionedAdditionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
41966 , VersionTuple Version
41967 , Attr * AdditionalAttr
41968 , bool IsReplacedByActive
41969 )
41970 : Attr(Ctx, CommonInfo, attr::SwiftVersionedAddition, /*IsLateParsed=*/false)
41971 , version(Version)
41972 , additionalAttr(AdditionalAttr)
41973 , isReplacedByActive(IsReplacedByActive)
41974 {
41975 }
41976
41977
41978
41979
41980
41981
41982
41983 SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::clone(ASTContext &C) const {
41984 auto *A = new (C) SwiftVersionedAdditionAttr(C, *this, getVersion(), additionalAttr, isReplacedByActive);
41985 A->Inherited = Inherited;
41986 A->IsPackExpansion = IsPackExpansion;
41987 A->setImplicit(Implicit);
41988 return A;
41989 }
41990
41991 void SwiftVersionedAdditionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
41992 }
41993
41994 const char *SwiftVersionedAdditionAttr::getSpelling() const {
41995 return "(No spelling)";
41996 }
41997
41998
41999 // SwiftVersionedRemovalAttr implementation
42000
42001 SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::CreateImplicit(ASTContext &Ctx, VersionTuple Version, unsigned RawKind, bool IsReplacedByActive, const AttributeCommonInfo &CommonInfo) {
42002 auto *A = new (Ctx) SwiftVersionedRemovalAttr(Ctx, CommonInfo, Version, RawKind, IsReplacedByActive);
42003 A->setImplicit(true);
42004 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42005 A->setAttributeSpellingListIndex(0);
42006 return A;
42007 }
42008
42009 SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::Create(ASTContext &Ctx, VersionTuple Version, unsigned RawKind, bool IsReplacedByActive, const AttributeCommonInfo &CommonInfo) {
42010 auto *A = new (Ctx) SwiftVersionedRemovalAttr(Ctx, CommonInfo, Version, RawKind, IsReplacedByActive);
42011 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42012 A->setAttributeSpellingListIndex(0);
42013 return A;
42014 }
42015
42016 SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::CreateImplicit(ASTContext &Ctx, VersionTuple Version, unsigned RawKind, bool IsReplacedByActive, SourceRange Range) {
42017 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
42018 return CreateImplicit(Ctx, Version, RawKind, IsReplacedByActive, I);
42019 }
42020
42021 SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::Create(ASTContext &Ctx, VersionTuple Version, unsigned RawKind, bool IsReplacedByActive, SourceRange Range) {
42022 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit());
42023 return Create(Ctx, Version, RawKind, IsReplacedByActive, I);
42024 }
42025
42026 SwiftVersionedRemovalAttr::SwiftVersionedRemovalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42027 , VersionTuple Version
42028 , unsigned RawKind
42029 , bool IsReplacedByActive
42030 )
42031 : Attr(Ctx, CommonInfo, attr::SwiftVersionedRemoval, /*IsLateParsed=*/false)
42032 , version(Version)
42033 , rawKind(RawKind)
42034 , isReplacedByActive(IsReplacedByActive)
42035 {
42036 }
42037
42038
42039
42040
42041
42042
42043
42044 SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::clone(ASTContext &C) const {
42045 auto *A = new (C) SwiftVersionedRemovalAttr(C, *this, getVersion(), rawKind, isReplacedByActive);
42046 A->Inherited = Inherited;
42047 A->IsPackExpansion = IsPackExpansion;
42048 A->setImplicit(Implicit);
42049 return A;
42050 }
42051
42052 void SwiftVersionedRemovalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
42053 }
42054
42055 const char *SwiftVersionedRemovalAttr::getSpelling() const {
42056 return "(No spelling)";
42057 }
42058
42059
42060 // SysVABIAttr implementation
42061
42062 SysVABIAttr *SysVABIAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
42063 auto *A = new (Ctx) SysVABIAttr(Ctx, CommonInfo);
42064 A->setImplicit(true);
42065 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42066 A->setAttributeSpellingListIndex(0);
42067 return A;
42068 }
42069
42070 SysVABIAttr *SysVABIAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
42071 auto *A = new (Ctx) SysVABIAttr(Ctx, CommonInfo);
42072 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42073 A->setAttributeSpellingListIndex(0);
42074 return A;
42075 }
42076
42077 SysVABIAttr *SysVABIAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
42078 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42079 switch (S) {
42080 case GNU_sysv_abi:
42081 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42082 case CXX11_gnu_sysv_abi:
42083 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42084 case C23_gnu_sysv_abi:
42085 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42086 default:
42087 llvm_unreachable("Unknown attribute spelling!");
42088 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42089 }
42090 }());
42091 return CreateImplicit(Ctx, I);
42092 }
42093
42094 SysVABIAttr *SysVABIAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
42095 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42096 switch (S) {
42097 case GNU_sysv_abi:
42098 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42099 case CXX11_gnu_sysv_abi:
42100 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42101 case C23_gnu_sysv_abi:
42102 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42103 default:
42104 llvm_unreachable("Unknown attribute spelling!");
42105 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42106 }
42107 }());
42108 return Create(Ctx, I);
42109 }
42110
42111 SysVABIAttr::SysVABIAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42112 )
42113 : InheritableAttr(Ctx, CommonInfo, attr::SysVABI, /*IsLateParsed=*/false, false)
42114 {
42115 }
42116
42117 SysVABIAttr *SysVABIAttr::clone(ASTContext &C) const {
42118 auto *A = new (C) SysVABIAttr(C, *this);
42119 A->Inherited = Inherited;
42120 A->IsPackExpansion = IsPackExpansion;
42121 A->setImplicit(Implicit);
42122 return A;
42123 }
42124
42125 void SysVABIAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
42126 bool IsFirstArgument = true; (void)IsFirstArgument;
42127 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
42128 switch (getAttributeSpellingListIndex()) {
42129 default:
42130 llvm_unreachable("Unknown attribute spelling!");
42131 break;
42132 case 0 : {
42133 OS << "__attribute__((sysv_abi";
42134 OS << "))";
42135 break;
42136 }
42137 case 1 : {
42138 OS << "[[gnu::sysv_abi";
42139 OS << "]]";
42140 break;
42141 }
42142 case 2 : {
42143 OS << "[[gnu::sysv_abi";
42144 OS << "]]";
42145 break;
42146 }
42147 }
42148 }
42149
42150 const char *SysVABIAttr::getSpelling() const {
42151 switch (getAttributeSpellingListIndex()) {
42152 default:
42153 llvm_unreachable("Unknown attribute spelling!");
42154 return "(No spelling)";
42155 case 0:
42156 return "sysv_abi";
42157 case 1:
42158 return "sysv_abi";
42159 case 2:
42160 return "sysv_abi";
42161 }
42162 }
42163
42164
42165 // TLSModelAttr implementation
42166
42167 TLSModelAttr *TLSModelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Model, const AttributeCommonInfo &CommonInfo) {
42168 auto *A = new (Ctx) TLSModelAttr(Ctx, CommonInfo, Model);
42169 A->setImplicit(true);
42170 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42171 A->setAttributeSpellingListIndex(0);
42172 return A;
42173 }
42174
42175 TLSModelAttr *TLSModelAttr::Create(ASTContext &Ctx, llvm::StringRef Model, const AttributeCommonInfo &CommonInfo) {
42176 auto *A = new (Ctx) TLSModelAttr(Ctx, CommonInfo, Model);
42177 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42178 A->setAttributeSpellingListIndex(0);
42179 return A;
42180 }
42181
42182 TLSModelAttr *TLSModelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Model, SourceRange Range, Spelling S) {
42183 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42184 switch (S) {
42185 case GNU_tls_model:
42186 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42187 case CXX11_gnu_tls_model:
42188 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42189 case C23_gnu_tls_model:
42190 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42191 default:
42192 llvm_unreachable("Unknown attribute spelling!");
42193 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42194 }
42195 }());
42196 return CreateImplicit(Ctx, Model, I);
42197 }
42198
42199 TLSModelAttr *TLSModelAttr::Create(ASTContext &Ctx, llvm::StringRef Model, SourceRange Range, Spelling S) {
42200 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42201 switch (S) {
42202 case GNU_tls_model:
42203 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42204 case CXX11_gnu_tls_model:
42205 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42206 case C23_gnu_tls_model:
42207 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42208 default:
42209 llvm_unreachable("Unknown attribute spelling!");
42210 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42211 }
42212 }());
42213 return Create(Ctx, Model, I);
42214 }
42215
42216 TLSModelAttr::TLSModelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42217 , llvm::StringRef Model
42218 )
42219 : InheritableAttr(Ctx, CommonInfo, attr::TLSModel, /*IsLateParsed=*/false, false)
42220 , modelLength(Model.size()),model(new (Ctx, 1) char[modelLength])
42221 {
42222 if (!Model.empty())
42223 std::memcpy(model, Model.data(), modelLength);
42224 }
42225
42226
42227
42228 TLSModelAttr *TLSModelAttr::clone(ASTContext &C) const {
42229 auto *A = new (C) TLSModelAttr(C, *this, getModel());
42230 A->Inherited = Inherited;
42231 A->IsPackExpansion = IsPackExpansion;
42232 A->setImplicit(Implicit);
42233 return A;
42234 }
42235
42236 void TLSModelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
42237 bool IsFirstArgument = true; (void)IsFirstArgument;
42238 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
42239 switch (getAttributeSpellingListIndex()) {
42240 default:
42241 llvm_unreachable("Unknown attribute spelling!");
42242 break;
42243 case 0 : {
42244 OS << "__attribute__((tls_model";
42245 DelimitAttributeArgument(OS, IsFirstArgument);
42246 OS << "\"" << getModel() << "\"";
42247 if (!IsFirstArgument)
42248 OS << ")";
42249 OS << "))";
42250 break;
42251 }
42252 case 1 : {
42253 OS << "[[gnu::tls_model";
42254 DelimitAttributeArgument(OS, IsFirstArgument);
42255 OS << "\"" << getModel() << "\"";
42256 if (!IsFirstArgument)
42257 OS << ")";
42258 OS << "]]";
42259 break;
42260 }
42261 case 2 : {
42262 OS << "[[gnu::tls_model";
42263 DelimitAttributeArgument(OS, IsFirstArgument);
42264 OS << "\"" << getModel() << "\"";
42265 if (!IsFirstArgument)
42266 OS << ")";
42267 OS << "]]";
42268 break;
42269 }
42270 }
42271 }
42272
42273 const char *TLSModelAttr::getSpelling() const {
42274 switch (getAttributeSpellingListIndex()) {
42275 default:
42276 llvm_unreachable("Unknown attribute spelling!");
42277 return "(No spelling)";
42278 case 0:
42279 return "tls_model";
42280 case 1:
42281 return "tls_model";
42282 case 2:
42283 return "tls_model";
42284 }
42285 }
42286
42287
42288 // TargetAttr implementation
42289
42290 TargetAttr *TargetAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef FeaturesStr, const AttributeCommonInfo &CommonInfo) {
42291 auto *A = new (Ctx) TargetAttr(Ctx, CommonInfo, FeaturesStr);
42292 A->setImplicit(true);
42293 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42294 A->setAttributeSpellingListIndex(0);
42295 return A;
42296 }
42297
42298 TargetAttr *TargetAttr::Create(ASTContext &Ctx, llvm::StringRef FeaturesStr, const AttributeCommonInfo &CommonInfo) {
42299 auto *A = new (Ctx) TargetAttr(Ctx, CommonInfo, FeaturesStr);
42300 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42301 A->setAttributeSpellingListIndex(0);
42302 return A;
42303 }
42304
42305 TargetAttr *TargetAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef FeaturesStr, SourceRange Range, Spelling S) {
42306 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42307 switch (S) {
42308 case GNU_target:
42309 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42310 case CXX11_gnu_target:
42311 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42312 case C23_gnu_target:
42313 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42314 default:
42315 llvm_unreachable("Unknown attribute spelling!");
42316 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42317 }
42318 }());
42319 return CreateImplicit(Ctx, FeaturesStr, I);
42320 }
42321
42322 TargetAttr *TargetAttr::Create(ASTContext &Ctx, llvm::StringRef FeaturesStr, SourceRange Range, Spelling S) {
42323 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42324 switch (S) {
42325 case GNU_target:
42326 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42327 case CXX11_gnu_target:
42328 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42329 case C23_gnu_target:
42330 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42331 default:
42332 llvm_unreachable("Unknown attribute spelling!");
42333 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42334 }
42335 }());
42336 return Create(Ctx, FeaturesStr, I);
42337 }
42338
42339 TargetAttr::TargetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42340 , llvm::StringRef FeaturesStr
42341 )
42342 : InheritableAttr(Ctx, CommonInfo, attr::Target, /*IsLateParsed=*/false, false)
42343 , featuresStrLength(FeaturesStr.size()),featuresStr(new (Ctx, 1) char[featuresStrLength])
42344 {
42345 if (!FeaturesStr.empty())
42346 std::memcpy(featuresStr, FeaturesStr.data(), featuresStrLength);
42347 }
42348
42349
42350
42351 TargetAttr *TargetAttr::clone(ASTContext &C) const {
42352 auto *A = new (C) TargetAttr(C, *this, getFeaturesStr());
42353 A->Inherited = Inherited;
42354 A->IsPackExpansion = IsPackExpansion;
42355 A->setImplicit(Implicit);
42356 return A;
42357 }
42358
42359 void TargetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
42360 bool IsFirstArgument = true; (void)IsFirstArgument;
42361 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
42362 switch (getAttributeSpellingListIndex()) {
42363 default:
42364 llvm_unreachable("Unknown attribute spelling!");
42365 break;
42366 case 0 : {
42367 OS << "__attribute__((target";
42368 DelimitAttributeArgument(OS, IsFirstArgument);
42369 OS << "\"" << getFeaturesStr() << "\"";
42370 if (!IsFirstArgument)
42371 OS << ")";
42372 OS << "))";
42373 break;
42374 }
42375 case 1 : {
42376 OS << "[[gnu::target";
42377 DelimitAttributeArgument(OS, IsFirstArgument);
42378 OS << "\"" << getFeaturesStr() << "\"";
42379 if (!IsFirstArgument)
42380 OS << ")";
42381 OS << "]]";
42382 break;
42383 }
42384 case 2 : {
42385 OS << "[[gnu::target";
42386 DelimitAttributeArgument(OS, IsFirstArgument);
42387 OS << "\"" << getFeaturesStr() << "\"";
42388 if (!IsFirstArgument)
42389 OS << ")";
42390 OS << "]]";
42391 break;
42392 }
42393 }
42394 }
42395
42396 const char *TargetAttr::getSpelling() const {
42397 switch (getAttributeSpellingListIndex()) {
42398 default:
42399 llvm_unreachable("Unknown attribute spelling!");
42400 return "(No spelling)";
42401 case 0:
42402 return "target";
42403 case 1:
42404 return "target";
42405 case 2:
42406 return "target";
42407 }
42408 }
42409
42410
42411 // TargetClonesAttr implementation
42412
42413 TargetClonesAttr *TargetClonesAttr::CreateImplicit(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, const AttributeCommonInfo &CommonInfo) {
42414 auto *A = new (Ctx) TargetClonesAttr(Ctx, CommonInfo, FeaturesStrs, FeaturesStrsSize);
42415 A->setImplicit(true);
42416 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42417 A->setAttributeSpellingListIndex(0);
42418 return A;
42419 }
42420
42421 TargetClonesAttr *TargetClonesAttr::Create(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, const AttributeCommonInfo &CommonInfo) {
42422 auto *A = new (Ctx) TargetClonesAttr(Ctx, CommonInfo, FeaturesStrs, FeaturesStrsSize);
42423 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42424 A->setAttributeSpellingListIndex(0);
42425 return A;
42426 }
42427
42428 TargetClonesAttr *TargetClonesAttr::CreateImplicit(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, SourceRange Range, Spelling S) {
42429 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42430 switch (S) {
42431 case GNU_target_clones:
42432 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42433 case CXX11_gnu_target_clones:
42434 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42435 case C23_gnu_target_clones:
42436 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42437 default:
42438 llvm_unreachable("Unknown attribute spelling!");
42439 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42440 }
42441 }());
42442 return CreateImplicit(Ctx, FeaturesStrs, FeaturesStrsSize, I);
42443 }
42444
42445 TargetClonesAttr *TargetClonesAttr::Create(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, SourceRange Range, Spelling S) {
42446 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42447 switch (S) {
42448 case GNU_target_clones:
42449 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42450 case CXX11_gnu_target_clones:
42451 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42452 case C23_gnu_target_clones:
42453 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42454 default:
42455 llvm_unreachable("Unknown attribute spelling!");
42456 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42457 }
42458 }());
42459 return Create(Ctx, FeaturesStrs, FeaturesStrsSize, I);
42460 }
42461
42462 TargetClonesAttr::TargetClonesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42463 , StringRef *FeaturesStrs, unsigned FeaturesStrsSize
42464 )
42465 : InheritableAttr(Ctx, CommonInfo, attr::TargetClones, /*IsLateParsed=*/false, false)
42466 , featuresStrs_Size(FeaturesStrsSize), featuresStrs_(new (Ctx, 16) StringRef[featuresStrs_Size])
42467 {
42468 for (size_t I = 0, E = featuresStrs_Size; I != E;
42469 ++I) {
42470 StringRef Ref = FeaturesStrs[I];
42471 if (!Ref.empty()) {
42472 char *Mem = new (Ctx, 1) char[Ref.size()];
42473 std::memcpy(Mem, Ref.data(), Ref.size());
42474 featuresStrs_[I] = StringRef(Mem, Ref.size());
42475 }
42476 }
42477 }
42478
42479 TargetClonesAttr::TargetClonesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42480 )
42481 : InheritableAttr(Ctx, CommonInfo, attr::TargetClones, /*IsLateParsed=*/false, false)
42482 , featuresStrs_Size(0), featuresStrs_(nullptr)
42483 {
42484 }
42485
42486
42487
42488 TargetClonesAttr *TargetClonesAttr::clone(ASTContext &C) const {
42489 auto *A = new (C) TargetClonesAttr(C, *this, featuresStrs_, featuresStrs_Size);
42490 A->Inherited = Inherited;
42491 A->IsPackExpansion = IsPackExpansion;
42492 A->setImplicit(Implicit);
42493 return A;
42494 }
42495
42496 void TargetClonesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
42497 bool IsFirstArgument = true; (void)IsFirstArgument;
42498 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
42499 switch (getAttributeSpellingListIndex()) {
42500 default:
42501 llvm_unreachable("Unknown attribute spelling!");
42502 break;
42503 case 0 : {
42504 OS << "__attribute__((target_clones";
42505 OS << "";
42506 for (const auto &Val : featuresStrs()) {
42507 DelimitAttributeArgument(OS, IsFirstArgument);
42508 OS << "\"" << Val << "\"";
42509 }
42510 OS << "";
42511 if (!IsFirstArgument)
42512 OS << ")";
42513 OS << "))";
42514 break;
42515 }
42516 case 1 : {
42517 OS << "[[gnu::target_clones";
42518 OS << "";
42519 for (const auto &Val : featuresStrs()) {
42520 DelimitAttributeArgument(OS, IsFirstArgument);
42521 OS << "\"" << Val << "\"";
42522 }
42523 OS << "";
42524 if (!IsFirstArgument)
42525 OS << ")";
42526 OS << "]]";
42527 break;
42528 }
42529 case 2 : {
42530 OS << "[[gnu::target_clones";
42531 OS << "";
42532 for (const auto &Val : featuresStrs()) {
42533 DelimitAttributeArgument(OS, IsFirstArgument);
42534 OS << "\"" << Val << "\"";
42535 }
42536 OS << "";
42537 if (!IsFirstArgument)
42538 OS << ")";
42539 OS << "]]";
42540 break;
42541 }
42542 }
42543 }
42544
42545 const char *TargetClonesAttr::getSpelling() const {
42546 switch (getAttributeSpellingListIndex()) {
42547 default:
42548 llvm_unreachable("Unknown attribute spelling!");
42549 return "(No spelling)";
42550 case 0:
42551 return "target_clones";
42552 case 1:
42553 return "target_clones";
42554 case 2:
42555 return "target_clones";
42556 }
42557 }
42558
42559
42560 // TargetVersionAttr implementation
42561
42562 TargetVersionAttr *TargetVersionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef NamesStr, const AttributeCommonInfo &CommonInfo) {
42563 auto *A = new (Ctx) TargetVersionAttr(Ctx, CommonInfo, NamesStr);
42564 A->setImplicit(true);
42565 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42566 A->setAttributeSpellingListIndex(0);
42567 return A;
42568 }
42569
42570 TargetVersionAttr *TargetVersionAttr::Create(ASTContext &Ctx, llvm::StringRef NamesStr, const AttributeCommonInfo &CommonInfo) {
42571 auto *A = new (Ctx) TargetVersionAttr(Ctx, CommonInfo, NamesStr);
42572 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42573 A->setAttributeSpellingListIndex(0);
42574 return A;
42575 }
42576
42577 TargetVersionAttr *TargetVersionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef NamesStr, SourceRange Range, Spelling S) {
42578 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42579 switch (S) {
42580 case GNU_target_version:
42581 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42582 case CXX11_gnu_target_version:
42583 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42584 case C23_gnu_target_version:
42585 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42586 default:
42587 llvm_unreachable("Unknown attribute spelling!");
42588 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42589 }
42590 }());
42591 return CreateImplicit(Ctx, NamesStr, I);
42592 }
42593
42594 TargetVersionAttr *TargetVersionAttr::Create(ASTContext &Ctx, llvm::StringRef NamesStr, SourceRange Range, Spelling S) {
42595 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42596 switch (S) {
42597 case GNU_target_version:
42598 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42599 case CXX11_gnu_target_version:
42600 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42601 case C23_gnu_target_version:
42602 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42603 default:
42604 llvm_unreachable("Unknown attribute spelling!");
42605 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42606 }
42607 }());
42608 return Create(Ctx, NamesStr, I);
42609 }
42610
42611 TargetVersionAttr::TargetVersionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42612 , llvm::StringRef NamesStr
42613 )
42614 : InheritableAttr(Ctx, CommonInfo, attr::TargetVersion, /*IsLateParsed=*/false, false)
42615 , namesStrLength(NamesStr.size()),namesStr(new (Ctx, 1) char[namesStrLength])
42616 {
42617 if (!NamesStr.empty())
42618 std::memcpy(namesStr, NamesStr.data(), namesStrLength);
42619 }
42620
42621
42622
42623 TargetVersionAttr *TargetVersionAttr::clone(ASTContext &C) const {
42624 auto *A = new (C) TargetVersionAttr(C, *this, getNamesStr());
42625 A->Inherited = Inherited;
42626 A->IsPackExpansion = IsPackExpansion;
42627 A->setImplicit(Implicit);
42628 return A;
42629 }
42630
42631 void TargetVersionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
42632 bool IsFirstArgument = true; (void)IsFirstArgument;
42633 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
42634 switch (getAttributeSpellingListIndex()) {
42635 default:
42636 llvm_unreachable("Unknown attribute spelling!");
42637 break;
42638 case 0 : {
42639 OS << "__attribute__((target_version";
42640 DelimitAttributeArgument(OS, IsFirstArgument);
42641 OS << "\"" << getNamesStr() << "\"";
42642 if (!IsFirstArgument)
42643 OS << ")";
42644 OS << "))";
42645 break;
42646 }
42647 case 1 : {
42648 OS << "[[gnu::target_version";
42649 DelimitAttributeArgument(OS, IsFirstArgument);
42650 OS << "\"" << getNamesStr() << "\"";
42651 if (!IsFirstArgument)
42652 OS << ")";
42653 OS << "]]";
42654 break;
42655 }
42656 case 2 : {
42657 OS << "[[gnu::target_version";
42658 DelimitAttributeArgument(OS, IsFirstArgument);
42659 OS << "\"" << getNamesStr() << "\"";
42660 if (!IsFirstArgument)
42661 OS << ")";
42662 OS << "]]";
42663 break;
42664 }
42665 }
42666 }
42667
42668 const char *TargetVersionAttr::getSpelling() const {
42669 switch (getAttributeSpellingListIndex()) {
42670 default:
42671 llvm_unreachable("Unknown attribute spelling!");
42672 return "(No spelling)";
42673 case 0:
42674 return "target_version";
42675 case 1:
42676 return "target_version";
42677 case 2:
42678 return "target_version";
42679 }
42680 }
42681
42682
42683 // TestTypestateAttr implementation
42684
42685 TestTypestateAttr *TestTypestateAttr::CreateImplicit(ASTContext &Ctx, TestTypestateAttr::ConsumedState TestState, const AttributeCommonInfo &CommonInfo) {
42686 auto *A = new (Ctx) TestTypestateAttr(Ctx, CommonInfo, TestState);
42687 A->setImplicit(true);
42688 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42689 A->setAttributeSpellingListIndex(0);
42690 return A;
42691 }
42692
42693 TestTypestateAttr *TestTypestateAttr::Create(ASTContext &Ctx, TestTypestateAttr::ConsumedState TestState, const AttributeCommonInfo &CommonInfo) {
42694 auto *A = new (Ctx) TestTypestateAttr(Ctx, CommonInfo, TestState);
42695 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42696 A->setAttributeSpellingListIndex(0);
42697 return A;
42698 }
42699
42700 TestTypestateAttr *TestTypestateAttr::CreateImplicit(ASTContext &Ctx, TestTypestateAttr::ConsumedState TestState, SourceRange Range, Spelling S) {
42701 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42702 switch (S) {
42703 case GNU_test_typestate:
42704 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_test_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42705 case CXX11_clang_test_typestate:
42706 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_test_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42707 default:
42708 llvm_unreachable("Unknown attribute spelling!");
42709 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42710 }
42711 }());
42712 return CreateImplicit(Ctx, TestState, I);
42713 }
42714
42715 TestTypestateAttr *TestTypestateAttr::Create(ASTContext &Ctx, TestTypestateAttr::ConsumedState TestState, SourceRange Range, Spelling S) {
42716 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42717 switch (S) {
42718 case GNU_test_typestate:
42719 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_test_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42720 case CXX11_clang_test_typestate:
42721 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_test_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42722 default:
42723 llvm_unreachable("Unknown attribute spelling!");
42724 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42725 }
42726 }());
42727 return Create(Ctx, TestState, I);
42728 }
42729
42730 TestTypestateAttr::TestTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42731 , TestTypestateAttr::ConsumedState TestState
42732 )
42733 : InheritableAttr(Ctx, CommonInfo, attr::TestTypestate, /*IsLateParsed=*/false, false)
42734 , testState(TestState)
42735 {
42736 }
42737
42738
42739
42740 bool TestTypestateAttr::ConvertStrToConsumedState(StringRef Val, TestTypestateAttr::ConsumedState &Out) {
42741 std::optional<TestTypestateAttr::ConsumedState> R = llvm::StringSwitch<std::optional<TestTypestateAttr::ConsumedState>>(Val)
42742 .Case("consumed", TestTypestateAttr::ConsumedState::Consumed)
42743 .Case("unconsumed", TestTypestateAttr::ConsumedState::Unconsumed)
42744 .Default(std::optional<TestTypestateAttr::ConsumedState>());
42745 if (R) {
42746 Out = *R;
42747 return true;
42748 }
42749 return false;
42750 }
42751
42752 const char *TestTypestateAttr::ConvertConsumedStateToStr(TestTypestateAttr::ConsumedState Val) {
42753 switch(Val) {
42754 case TestTypestateAttr::ConsumedState::Consumed: return "consumed";
42755 case TestTypestateAttr::ConsumedState::Unconsumed: return "unconsumed";
42756 }
42757 llvm_unreachable("No enumerator with that value");
42758 }
42759 TestTypestateAttr *TestTypestateAttr::clone(ASTContext &C) const {
42760 auto *A = new (C) TestTypestateAttr(C, *this, testState);
42761 A->Inherited = Inherited;
42762 A->IsPackExpansion = IsPackExpansion;
42763 A->setImplicit(Implicit);
42764 return A;
42765 }
42766
42767 void TestTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
42768 bool IsFirstArgument = true; (void)IsFirstArgument;
42769 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
42770 switch (getAttributeSpellingListIndex()) {
42771 default:
42772 llvm_unreachable("Unknown attribute spelling!");
42773 break;
42774 case 0 : {
42775 OS << "__attribute__((test_typestate";
42776 DelimitAttributeArgument(OS, IsFirstArgument);
42777 OS << "\"" << TestTypestateAttr::ConvertConsumedStateToStr(getTestState()) << "\"";
42778 if (!IsFirstArgument)
42779 OS << ")";
42780 OS << "))";
42781 break;
42782 }
42783 case 1 : {
42784 OS << "[[clang::test_typestate";
42785 DelimitAttributeArgument(OS, IsFirstArgument);
42786 OS << "\"" << TestTypestateAttr::ConvertConsumedStateToStr(getTestState()) << "\"";
42787 if (!IsFirstArgument)
42788 OS << ")";
42789 OS << "]]";
42790 break;
42791 }
42792 }
42793 }
42794
42795 const char *TestTypestateAttr::getSpelling() const {
42796 switch (getAttributeSpellingListIndex()) {
42797 default:
42798 llvm_unreachable("Unknown attribute spelling!");
42799 return "(No spelling)";
42800 case 0:
42801 return "test_typestate";
42802 case 1:
42803 return "test_typestate";
42804 }
42805 }
42806
42807
42808 // ThisCallAttr implementation
42809
42810 ThisCallAttr *ThisCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
42811 auto *A = new (Ctx) ThisCallAttr(Ctx, CommonInfo);
42812 A->setImplicit(true);
42813 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42814 A->setAttributeSpellingListIndex(0);
42815 return A;
42816 }
42817
42818 ThisCallAttr *ThisCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
42819 auto *A = new (Ctx) ThisCallAttr(Ctx, CommonInfo);
42820 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42821 A->setAttributeSpellingListIndex(0);
42822 return A;
42823 }
42824
42825 ThisCallAttr *ThisCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
42826 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42827 switch (S) {
42828 case GNU_thiscall:
42829 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42830 case CXX11_gnu_thiscall:
42831 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42832 case C23_gnu_thiscall:
42833 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42834 case Keyword_thiscall:
42835 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42836 default:
42837 llvm_unreachable("Unknown attribute spelling!");
42838 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42839 }
42840 }());
42841 return CreateImplicit(Ctx, I);
42842 }
42843
42844 ThisCallAttr *ThisCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
42845 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
42846 switch (S) {
42847 case GNU_thiscall:
42848 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42849 case CXX11_gnu_thiscall:
42850 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42851 case C23_gnu_thiscall:
42852 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42853 case Keyword_thiscall:
42854 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42855 default:
42856 llvm_unreachable("Unknown attribute spelling!");
42857 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
42858 }
42859 }());
42860 return Create(Ctx, I);
42861 }
42862
42863 ThisCallAttr::ThisCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42864 )
42865 : InheritableAttr(Ctx, CommonInfo, attr::ThisCall, /*IsLateParsed=*/false, false)
42866 {
42867 }
42868
42869 ThisCallAttr *ThisCallAttr::clone(ASTContext &C) const {
42870 auto *A = new (C) ThisCallAttr(C, *this);
42871 A->Inherited = Inherited;
42872 A->IsPackExpansion = IsPackExpansion;
42873 A->setImplicit(Implicit);
42874 return A;
42875 }
42876
42877 void ThisCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
42878 bool IsFirstArgument = true; (void)IsFirstArgument;
42879 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
42880 switch (getAttributeSpellingListIndex()) {
42881 default:
42882 llvm_unreachable("Unknown attribute spelling!");
42883 break;
42884 case 0 : {
42885 OS << "__attribute__((thiscall";
42886 OS << "))";
42887 break;
42888 }
42889 case 1 : {
42890 OS << "[[gnu::thiscall";
42891 OS << "]]";
42892 break;
42893 }
42894 case 2 : {
42895 OS << "[[gnu::thiscall";
42896 OS << "]]";
42897 break;
42898 }
42899 case 3 : {
42900 OS << "__thiscall";
42901 OS << "";
42902 break;
42903 }
42904 case 4 : {
42905 OS << "_thiscall";
42906 OS << "";
42907 break;
42908 }
42909 }
42910 }
42911
42912 const char *ThisCallAttr::getSpelling() const {
42913 switch (getAttributeSpellingListIndex()) {
42914 default:
42915 llvm_unreachable("Unknown attribute spelling!");
42916 return "(No spelling)";
42917 case 0:
42918 return "thiscall";
42919 case 1:
42920 return "thiscall";
42921 case 2:
42922 return "thiscall";
42923 case 3:
42924 return "__thiscall";
42925 case 4:
42926 return "_thiscall";
42927 }
42928 }
42929
42930
42931 // ThreadAttr implementation
42932
42933 ThreadAttr *ThreadAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
42934 auto *A = new (Ctx) ThreadAttr(Ctx, CommonInfo);
42935 A->setImplicit(true);
42936 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42937 A->setAttributeSpellingListIndex(0);
42938 return A;
42939 }
42940
42941 ThreadAttr *ThreadAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
42942 auto *A = new (Ctx) ThreadAttr(Ctx, CommonInfo);
42943 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
42944 A->setAttributeSpellingListIndex(0);
42945 return A;
42946 }
42947
42948 ThreadAttr *ThreadAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
42949 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
42950 return CreateImplicit(Ctx, I);
42951 }
42952
42953 ThreadAttr *ThreadAttr::Create(ASTContext &Ctx, SourceRange Range) {
42954 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
42955 return Create(Ctx, I);
42956 }
42957
42958 ThreadAttr::ThreadAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
42959 )
42960 : Attr(Ctx, CommonInfo, attr::Thread, /*IsLateParsed=*/false)
42961 {
42962 }
42963
42964 ThreadAttr *ThreadAttr::clone(ASTContext &C) const {
42965 auto *A = new (C) ThreadAttr(C, *this);
42966 A->Inherited = Inherited;
42967 A->IsPackExpansion = IsPackExpansion;
42968 A->setImplicit(Implicit);
42969 return A;
42970 }
42971
42972 void ThreadAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
42973 bool IsFirstArgument = true; (void)IsFirstArgument;
42974 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
42975 switch (getAttributeSpellingListIndex()) {
42976 default:
42977 llvm_unreachable("Unknown attribute spelling!");
42978 break;
42979 case 0 : {
42980 OS << "__declspec(thread";
42981 OS << ")";
42982 break;
42983 }
42984 }
42985 }
42986
42987 const char *ThreadAttr::getSpelling() const {
42988 switch (getAttributeSpellingListIndex()) {
42989 default:
42990 llvm_unreachable("Unknown attribute spelling!");
42991 return "(No spelling)";
42992 case 0:
42993 return "thread";
42994 }
42995 }
42996
42997
42998 // TransparentUnionAttr implementation
42999
43000 TransparentUnionAttr *TransparentUnionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43001 auto *A = new (Ctx) TransparentUnionAttr(Ctx, CommonInfo);
43002 A->setImplicit(true);
43003 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43004 A->setAttributeSpellingListIndex(0);
43005 return A;
43006 }
43007
43008 TransparentUnionAttr *TransparentUnionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43009 auto *A = new (Ctx) TransparentUnionAttr(Ctx, CommonInfo);
43010 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43011 A->setAttributeSpellingListIndex(0);
43012 return A;
43013 }
43014
43015 TransparentUnionAttr *TransparentUnionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
43016 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43017 switch (S) {
43018 case GNU_transparent_union:
43019 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43020 case CXX11_gnu_transparent_union:
43021 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43022 case C23_gnu_transparent_union:
43023 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43024 default:
43025 llvm_unreachable("Unknown attribute spelling!");
43026 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43027 }
43028 }());
43029 return CreateImplicit(Ctx, I);
43030 }
43031
43032 TransparentUnionAttr *TransparentUnionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
43033 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43034 switch (S) {
43035 case GNU_transparent_union:
43036 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43037 case CXX11_gnu_transparent_union:
43038 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43039 case C23_gnu_transparent_union:
43040 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43041 default:
43042 llvm_unreachable("Unknown attribute spelling!");
43043 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43044 }
43045 }());
43046 return Create(Ctx, I);
43047 }
43048
43049 TransparentUnionAttr::TransparentUnionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43050 )
43051 : InheritableAttr(Ctx, CommonInfo, attr::TransparentUnion, /*IsLateParsed=*/false, false)
43052 {
43053 }
43054
43055 TransparentUnionAttr *TransparentUnionAttr::clone(ASTContext &C) const {
43056 auto *A = new (C) TransparentUnionAttr(C, *this);
43057 A->Inherited = Inherited;
43058 A->IsPackExpansion = IsPackExpansion;
43059 A->setImplicit(Implicit);
43060 return A;
43061 }
43062
43063 void TransparentUnionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43064 bool IsFirstArgument = true; (void)IsFirstArgument;
43065 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43066 switch (getAttributeSpellingListIndex()) {
43067 default:
43068 llvm_unreachable("Unknown attribute spelling!");
43069 break;
43070 case 0 : {
43071 OS << "__attribute__((transparent_union";
43072 OS << "))";
43073 break;
43074 }
43075 case 1 : {
43076 OS << "[[gnu::transparent_union";
43077 OS << "]]";
43078 break;
43079 }
43080 case 2 : {
43081 OS << "[[gnu::transparent_union";
43082 OS << "]]";
43083 break;
43084 }
43085 }
43086 }
43087
43088 const char *TransparentUnionAttr::getSpelling() const {
43089 switch (getAttributeSpellingListIndex()) {
43090 default:
43091 llvm_unreachable("Unknown attribute spelling!");
43092 return "(No spelling)";
43093 case 0:
43094 return "transparent_union";
43095 case 1:
43096 return "transparent_union";
43097 case 2:
43098 return "transparent_union";
43099 }
43100 }
43101
43102
43103 // TrivialABIAttr implementation
43104
43105 TrivialABIAttr *TrivialABIAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43106 auto *A = new (Ctx) TrivialABIAttr(Ctx, CommonInfo);
43107 A->setImplicit(true);
43108 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43109 A->setAttributeSpellingListIndex(0);
43110 return A;
43111 }
43112
43113 TrivialABIAttr *TrivialABIAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43114 auto *A = new (Ctx) TrivialABIAttr(Ctx, CommonInfo);
43115 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43116 A->setAttributeSpellingListIndex(0);
43117 return A;
43118 }
43119
43120 TrivialABIAttr *TrivialABIAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
43121 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43122 switch (S) {
43123 case GNU_trivial_abi:
43124 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_trivial_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43125 case CXX11_clang_trivial_abi:
43126 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_trivial_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43127 default:
43128 llvm_unreachable("Unknown attribute spelling!");
43129 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43130 }
43131 }());
43132 return CreateImplicit(Ctx, I);
43133 }
43134
43135 TrivialABIAttr *TrivialABIAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
43136 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43137 switch (S) {
43138 case GNU_trivial_abi:
43139 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_trivial_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43140 case CXX11_clang_trivial_abi:
43141 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_trivial_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43142 default:
43143 llvm_unreachable("Unknown attribute spelling!");
43144 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43145 }
43146 }());
43147 return Create(Ctx, I);
43148 }
43149
43150 TrivialABIAttr::TrivialABIAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43151 )
43152 : InheritableAttr(Ctx, CommonInfo, attr::TrivialABI, /*IsLateParsed=*/false, false)
43153 {
43154 }
43155
43156 TrivialABIAttr *TrivialABIAttr::clone(ASTContext &C) const {
43157 auto *A = new (C) TrivialABIAttr(C, *this);
43158 A->Inherited = Inherited;
43159 A->IsPackExpansion = IsPackExpansion;
43160 A->setImplicit(Implicit);
43161 return A;
43162 }
43163
43164 void TrivialABIAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43165 bool IsFirstArgument = true; (void)IsFirstArgument;
43166 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43167 switch (getAttributeSpellingListIndex()) {
43168 default:
43169 llvm_unreachable("Unknown attribute spelling!");
43170 break;
43171 case 0 : {
43172 OS << "__attribute__((trivial_abi";
43173 OS << "))";
43174 break;
43175 }
43176 case 1 : {
43177 OS << "[[clang::trivial_abi";
43178 OS << "]]";
43179 break;
43180 }
43181 }
43182 }
43183
43184 const char *TrivialABIAttr::getSpelling() const {
43185 switch (getAttributeSpellingListIndex()) {
43186 default:
43187 llvm_unreachable("Unknown attribute spelling!");
43188 return "(No spelling)";
43189 case 0:
43190 return "trivial_abi";
43191 case 1:
43192 return "trivial_abi";
43193 }
43194 }
43195
43196
43197 // TryAcquireCapabilityAttr implementation
43198
43199 TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
43200 auto *A = new (Ctx) TryAcquireCapabilityAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize);
43201 A->setImplicit(true);
43202 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43203 A->setAttributeSpellingListIndex(0);
43204 return A;
43205 }
43206
43207 TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) {
43208 auto *A = new (Ctx) TryAcquireCapabilityAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize);
43209 return A;
43210 }
43211
43212 TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
43213 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43214 switch (S) {
43215 case GNU_try_acquire_capability:
43216 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_try_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43217 case CXX11_clang_try_acquire_capability:
43218 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_try_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43219 case GNU_try_acquire_shared_capability:
43220 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_try_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43221 case CXX11_clang_try_acquire_shared_capability:
43222 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_try_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43223 default:
43224 llvm_unreachable("Unknown attribute spelling!");
43225 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43226 }
43227 }());
43228 return CreateImplicit(Ctx, SuccessValue, Args, ArgsSize, I);
43229 }
43230
43231 TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) {
43232 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43233 switch (S) {
43234 case GNU_try_acquire_capability:
43235 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_try_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43236 case CXX11_clang_try_acquire_capability:
43237 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_try_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43238 case GNU_try_acquire_shared_capability:
43239 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_try_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43240 case CXX11_clang_try_acquire_shared_capability:
43241 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_try_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43242 default:
43243 llvm_unreachable("Unknown attribute spelling!");
43244 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43245 }
43246 }());
43247 return Create(Ctx, SuccessValue, Args, ArgsSize, I);
43248 }
43249
43250 TryAcquireCapabilityAttr::TryAcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43251 , Expr * SuccessValue
43252 , Expr * *Args, unsigned ArgsSize
43253 )
43254 : InheritableAttr(Ctx, CommonInfo, attr::TryAcquireCapability, /*IsLateParsed=*/true, true)
43255 , successValue(SuccessValue)
43256 , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
43257 {
43258 std::copy(Args, Args + args_Size, args_);
43259 }
43260
43261 TryAcquireCapabilityAttr::TryAcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43262 , Expr * SuccessValue
43263 )
43264 : InheritableAttr(Ctx, CommonInfo, attr::TryAcquireCapability, /*IsLateParsed=*/true, true)
43265 , successValue(SuccessValue)
43266 , args_Size(0), args_(nullptr)
43267 {
43268 }
43269
43270 TryAcquireCapabilityAttr::Spelling TryAcquireCapabilityAttr::getSemanticSpelling() const {
43271 switch (getAttributeSpellingListIndex()) {
43272 default: llvm_unreachable("Unknown spelling list index");
43273 case 0: return GNU_try_acquire_capability;
43274 case 1: return CXX11_clang_try_acquire_capability;
43275 case 2: return GNU_try_acquire_shared_capability;
43276 case 3: return CXX11_clang_try_acquire_shared_capability;
43277 }
43278 }
43279
43280
43281
43282
43283 TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::clone(ASTContext &C) const {
43284 auto *A = new (C) TryAcquireCapabilityAttr(C, *this, successValue, args_, args_Size);
43285 A->Inherited = Inherited;
43286 A->IsPackExpansion = IsPackExpansion;
43287 A->setImplicit(Implicit);
43288 return A;
43289 }
43290
43291 void TryAcquireCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43292 bool IsFirstArgument = true; (void)IsFirstArgument;
43293 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43294 switch (getAttributeSpellingListIndex()) {
43295 default:
43296 llvm_unreachable("Unknown attribute spelling!");
43297 break;
43298 case 0 : {
43299 OS << "__attribute__((try_acquire_capability";
43300 DelimitAttributeArgument(OS, IsFirstArgument);
43301 OS << "";
43302 getSuccessValue()->printPretty(OS, nullptr, Policy);
43303 OS << "";
43304 OS << "";
43305 for (const auto &Val : args()) {
43306 DelimitAttributeArgument(OS, IsFirstArgument);
43307 OS << Val;
43308 }
43309 OS << "";
43310 if (!IsFirstArgument)
43311 OS << ")";
43312 OS << "))";
43313 break;
43314 }
43315 case 1 : {
43316 OS << "[[clang::try_acquire_capability";
43317 DelimitAttributeArgument(OS, IsFirstArgument);
43318 OS << "";
43319 getSuccessValue()->printPretty(OS, nullptr, Policy);
43320 OS << "";
43321 OS << "";
43322 for (const auto &Val : args()) {
43323 DelimitAttributeArgument(OS, IsFirstArgument);
43324 OS << Val;
43325 }
43326 OS << "";
43327 if (!IsFirstArgument)
43328 OS << ")";
43329 OS << "]]";
43330 break;
43331 }
43332 case 2 : {
43333 OS << "__attribute__((try_acquire_shared_capability";
43334 DelimitAttributeArgument(OS, IsFirstArgument);
43335 OS << "";
43336 getSuccessValue()->printPretty(OS, nullptr, Policy);
43337 OS << "";
43338 OS << "";
43339 for (const auto &Val : args()) {
43340 DelimitAttributeArgument(OS, IsFirstArgument);
43341 OS << Val;
43342 }
43343 OS << "";
43344 if (!IsFirstArgument)
43345 OS << ")";
43346 OS << "))";
43347 break;
43348 }
43349 case 3 : {
43350 OS << "[[clang::try_acquire_shared_capability";
43351 DelimitAttributeArgument(OS, IsFirstArgument);
43352 OS << "";
43353 getSuccessValue()->printPretty(OS, nullptr, Policy);
43354 OS << "";
43355 OS << "";
43356 for (const auto &Val : args()) {
43357 DelimitAttributeArgument(OS, IsFirstArgument);
43358 OS << Val;
43359 }
43360 OS << "";
43361 if (!IsFirstArgument)
43362 OS << ")";
43363 OS << "]]";
43364 break;
43365 }
43366 }
43367 }
43368
43369 const char *TryAcquireCapabilityAttr::getSpelling() const {
43370 switch (getAttributeSpellingListIndex()) {
43371 default:
43372 llvm_unreachable("Unknown attribute spelling!");
43373 return "(No spelling)";
43374 case 0:
43375 return "try_acquire_capability";
43376 case 1:
43377 return "try_acquire_capability";
43378 case 2:
43379 return "try_acquire_shared_capability";
43380 case 3:
43381 return "try_acquire_shared_capability";
43382 }
43383 }
43384
43385
43386 // TypeNonNullAttr implementation
43387
43388 TypeNonNullAttr *TypeNonNullAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43389 auto *A = new (Ctx) TypeNonNullAttr(Ctx, CommonInfo);
43390 A->setImplicit(true);
43391 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43392 A->setAttributeSpellingListIndex(0);
43393 return A;
43394 }
43395
43396 TypeNonNullAttr *TypeNonNullAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43397 auto *A = new (Ctx) TypeNonNullAttr(Ctx, CommonInfo);
43398 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43399 A->setAttributeSpellingListIndex(0);
43400 return A;
43401 }
43402
43403 TypeNonNullAttr *TypeNonNullAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
43404 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43405 return CreateImplicit(Ctx, I);
43406 }
43407
43408 TypeNonNullAttr *TypeNonNullAttr::Create(ASTContext &Ctx, SourceRange Range) {
43409 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43410 return Create(Ctx, I);
43411 }
43412
43413 TypeNonNullAttr::TypeNonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43414 )
43415 : TypeAttr(Ctx, CommonInfo, attr::TypeNonNull, /*IsLateParsed=*/false)
43416 {
43417 }
43418
43419 TypeNonNullAttr *TypeNonNullAttr::clone(ASTContext &C) const {
43420 auto *A = new (C) TypeNonNullAttr(C, *this);
43421 A->Inherited = Inherited;
43422 A->IsPackExpansion = IsPackExpansion;
43423 A->setImplicit(Implicit);
43424 return A;
43425 }
43426
43427 void TypeNonNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43428 bool IsFirstArgument = true; (void)IsFirstArgument;
43429 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43430 switch (getAttributeSpellingListIndex()) {
43431 default:
43432 llvm_unreachable("Unknown attribute spelling!");
43433 break;
43434 case 0 : {
43435 OS << "_Nonnull";
43436 OS << "";
43437 break;
43438 }
43439 }
43440 }
43441
43442 const char *TypeNonNullAttr::getSpelling() const {
43443 switch (getAttributeSpellingListIndex()) {
43444 default:
43445 llvm_unreachable("Unknown attribute spelling!");
43446 return "(No spelling)";
43447 case 0:
43448 return "_Nonnull";
43449 }
43450 }
43451
43452
43453 // TypeNullUnspecifiedAttr implementation
43454
43455 TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43456 auto *A = new (Ctx) TypeNullUnspecifiedAttr(Ctx, CommonInfo);
43457 A->setImplicit(true);
43458 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43459 A->setAttributeSpellingListIndex(0);
43460 return A;
43461 }
43462
43463 TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43464 auto *A = new (Ctx) TypeNullUnspecifiedAttr(Ctx, CommonInfo);
43465 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43466 A->setAttributeSpellingListIndex(0);
43467 return A;
43468 }
43469
43470 TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
43471 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43472 return CreateImplicit(Ctx, I);
43473 }
43474
43475 TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::Create(ASTContext &Ctx, SourceRange Range) {
43476 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43477 return Create(Ctx, I);
43478 }
43479
43480 TypeNullUnspecifiedAttr::TypeNullUnspecifiedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43481 )
43482 : TypeAttr(Ctx, CommonInfo, attr::TypeNullUnspecified, /*IsLateParsed=*/false)
43483 {
43484 }
43485
43486 TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::clone(ASTContext &C) const {
43487 auto *A = new (C) TypeNullUnspecifiedAttr(C, *this);
43488 A->Inherited = Inherited;
43489 A->IsPackExpansion = IsPackExpansion;
43490 A->setImplicit(Implicit);
43491 return A;
43492 }
43493
43494 void TypeNullUnspecifiedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43495 bool IsFirstArgument = true; (void)IsFirstArgument;
43496 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43497 switch (getAttributeSpellingListIndex()) {
43498 default:
43499 llvm_unreachable("Unknown attribute spelling!");
43500 break;
43501 case 0 : {
43502 OS << "_Null_unspecified";
43503 OS << "";
43504 break;
43505 }
43506 }
43507 }
43508
43509 const char *TypeNullUnspecifiedAttr::getSpelling() const {
43510 switch (getAttributeSpellingListIndex()) {
43511 default:
43512 llvm_unreachable("Unknown attribute spelling!");
43513 return "(No spelling)";
43514 case 0:
43515 return "_Null_unspecified";
43516 }
43517 }
43518
43519
43520 // TypeNullableAttr implementation
43521
43522 TypeNullableAttr *TypeNullableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43523 auto *A = new (Ctx) TypeNullableAttr(Ctx, CommonInfo);
43524 A->setImplicit(true);
43525 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43526 A->setAttributeSpellingListIndex(0);
43527 return A;
43528 }
43529
43530 TypeNullableAttr *TypeNullableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43531 auto *A = new (Ctx) TypeNullableAttr(Ctx, CommonInfo);
43532 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43533 A->setAttributeSpellingListIndex(0);
43534 return A;
43535 }
43536
43537 TypeNullableAttr *TypeNullableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
43538 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43539 return CreateImplicit(Ctx, I);
43540 }
43541
43542 TypeNullableAttr *TypeNullableAttr::Create(ASTContext &Ctx, SourceRange Range) {
43543 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43544 return Create(Ctx, I);
43545 }
43546
43547 TypeNullableAttr::TypeNullableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43548 )
43549 : InheritableAttr(Ctx, CommonInfo, attr::TypeNullable, /*IsLateParsed=*/false, false)
43550 {
43551 }
43552
43553 TypeNullableAttr *TypeNullableAttr::clone(ASTContext &C) const {
43554 auto *A = new (C) TypeNullableAttr(C, *this);
43555 A->Inherited = Inherited;
43556 A->IsPackExpansion = IsPackExpansion;
43557 A->setImplicit(Implicit);
43558 return A;
43559 }
43560
43561 void TypeNullableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43562 bool IsFirstArgument = true; (void)IsFirstArgument;
43563 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43564 switch (getAttributeSpellingListIndex()) {
43565 default:
43566 llvm_unreachable("Unknown attribute spelling!");
43567 break;
43568 case 0 : {
43569 OS << "_Nullable";
43570 OS << "";
43571 break;
43572 }
43573 }
43574 }
43575
43576 const char *TypeNullableAttr::getSpelling() const {
43577 switch (getAttributeSpellingListIndex()) {
43578 default:
43579 llvm_unreachable("Unknown attribute spelling!");
43580 return "(No spelling)";
43581 case 0:
43582 return "_Nullable";
43583 }
43584 }
43585
43586
43587 // TypeNullableResultAttr implementation
43588
43589 TypeNullableResultAttr *TypeNullableResultAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43590 auto *A = new (Ctx) TypeNullableResultAttr(Ctx, CommonInfo);
43591 A->setImplicit(true);
43592 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43593 A->setAttributeSpellingListIndex(0);
43594 return A;
43595 }
43596
43597 TypeNullableResultAttr *TypeNullableResultAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43598 auto *A = new (Ctx) TypeNullableResultAttr(Ctx, CommonInfo);
43599 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43600 A->setAttributeSpellingListIndex(0);
43601 return A;
43602 }
43603
43604 TypeNullableResultAttr *TypeNullableResultAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
43605 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43606 return CreateImplicit(Ctx, I);
43607 }
43608
43609 TypeNullableResultAttr *TypeNullableResultAttr::Create(ASTContext &Ctx, SourceRange Range) {
43610 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43611 return Create(Ctx, I);
43612 }
43613
43614 TypeNullableResultAttr::TypeNullableResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43615 )
43616 : TypeAttr(Ctx, CommonInfo, attr::TypeNullableResult, /*IsLateParsed=*/false)
43617 {
43618 }
43619
43620 TypeNullableResultAttr *TypeNullableResultAttr::clone(ASTContext &C) const {
43621 auto *A = new (C) TypeNullableResultAttr(C, *this);
43622 A->Inherited = Inherited;
43623 A->IsPackExpansion = IsPackExpansion;
43624 A->setImplicit(Implicit);
43625 return A;
43626 }
43627
43628 void TypeNullableResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43629 bool IsFirstArgument = true; (void)IsFirstArgument;
43630 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43631 switch (getAttributeSpellingListIndex()) {
43632 default:
43633 llvm_unreachable("Unknown attribute spelling!");
43634 break;
43635 case 0 : {
43636 OS << "_Nullable_result";
43637 OS << "";
43638 break;
43639 }
43640 }
43641 }
43642
43643 const char *TypeNullableResultAttr::getSpelling() const {
43644 switch (getAttributeSpellingListIndex()) {
43645 default:
43646 llvm_unreachable("Unknown attribute spelling!");
43647 return "(No spelling)";
43648 case 0:
43649 return "_Nullable_result";
43650 }
43651 }
43652
43653
43654 // TypeTagForDatatypeAttr implementation
43655
43656 TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, const AttributeCommonInfo &CommonInfo) {
43657 auto *A = new (Ctx) TypeTagForDatatypeAttr(Ctx, CommonInfo, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull);
43658 A->setImplicit(true);
43659 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43660 A->setAttributeSpellingListIndex(0);
43661 return A;
43662 }
43663
43664 TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, const AttributeCommonInfo &CommonInfo) {
43665 auto *A = new (Ctx) TypeTagForDatatypeAttr(Ctx, CommonInfo, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull);
43666 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43667 A->setAttributeSpellingListIndex(0);
43668 return A;
43669 }
43670
43671 TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, SourceRange Range, Spelling S) {
43672 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43673 switch (S) {
43674 case GNU_type_tag_for_datatype:
43675 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43676 case CXX11_clang_type_tag_for_datatype:
43677 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43678 case C23_clang_type_tag_for_datatype:
43679 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43680 default:
43681 llvm_unreachable("Unknown attribute spelling!");
43682 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43683 }
43684 }());
43685 return CreateImplicit(Ctx, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull, I);
43686 }
43687
43688 TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, SourceRange Range, Spelling S) {
43689 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43690 switch (S) {
43691 case GNU_type_tag_for_datatype:
43692 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43693 case CXX11_clang_type_tag_for_datatype:
43694 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43695 case C23_clang_type_tag_for_datatype:
43696 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43697 default:
43698 llvm_unreachable("Unknown attribute spelling!");
43699 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43700 }
43701 }());
43702 return Create(Ctx, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull, I);
43703 }
43704
43705 TypeTagForDatatypeAttr::TypeTagForDatatypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43706 , IdentifierInfo * ArgumentKind
43707 , TypeSourceInfo * MatchingCType
43708 , bool LayoutCompatible
43709 , bool MustBeNull
43710 )
43711 : InheritableAttr(Ctx, CommonInfo, attr::TypeTagForDatatype, /*IsLateParsed=*/false, false)
43712 , argumentKind(ArgumentKind)
43713 , matchingCType(MatchingCType)
43714 , layoutCompatible(LayoutCompatible)
43715 , mustBeNull(MustBeNull)
43716 {
43717 }
43718
43719
43720
43721
43722
43723
43724
43725
43726
43727 TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::clone(ASTContext &C) const {
43728 auto *A = new (C) TypeTagForDatatypeAttr(C, *this, argumentKind, matchingCType, layoutCompatible, mustBeNull);
43729 A->Inherited = Inherited;
43730 A->IsPackExpansion = IsPackExpansion;
43731 A->setImplicit(Implicit);
43732 return A;
43733 }
43734
43735 void TypeTagForDatatypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43736 bool IsFirstArgument = true; (void)IsFirstArgument;
43737 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43738 switch (getAttributeSpellingListIndex()) {
43739 default:
43740 llvm_unreachable("Unknown attribute spelling!");
43741 break;
43742 case 0 : {
43743 OS << "__attribute__((type_tag_for_datatype";
43744 DelimitAttributeArgument(OS, IsFirstArgument);
43745 OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << "";
43746 DelimitAttributeArgument(OS, IsFirstArgument);
43747 OS << "" << getMatchingCType().getAsString() << "";
43748 DelimitAttributeArgument(OS, IsFirstArgument);
43749 OS << "" << getLayoutCompatible() << "";
43750 DelimitAttributeArgument(OS, IsFirstArgument);
43751 OS << "" << getMustBeNull() << "";
43752 if (!IsFirstArgument)
43753 OS << ")";
43754 OS << "))";
43755 break;
43756 }
43757 case 1 : {
43758 OS << "[[clang::type_tag_for_datatype";
43759 DelimitAttributeArgument(OS, IsFirstArgument);
43760 OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << "";
43761 DelimitAttributeArgument(OS, IsFirstArgument);
43762 OS << "" << getMatchingCType().getAsString() << "";
43763 DelimitAttributeArgument(OS, IsFirstArgument);
43764 OS << "" << getLayoutCompatible() << "";
43765 DelimitAttributeArgument(OS, IsFirstArgument);
43766 OS << "" << getMustBeNull() << "";
43767 if (!IsFirstArgument)
43768 OS << ")";
43769 OS << "]]";
43770 break;
43771 }
43772 case 2 : {
43773 OS << "[[clang::type_tag_for_datatype";
43774 DelimitAttributeArgument(OS, IsFirstArgument);
43775 OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << "";
43776 DelimitAttributeArgument(OS, IsFirstArgument);
43777 OS << "" << getMatchingCType().getAsString() << "";
43778 DelimitAttributeArgument(OS, IsFirstArgument);
43779 OS << "" << getLayoutCompatible() << "";
43780 DelimitAttributeArgument(OS, IsFirstArgument);
43781 OS << "" << getMustBeNull() << "";
43782 if (!IsFirstArgument)
43783 OS << ")";
43784 OS << "]]";
43785 break;
43786 }
43787 }
43788 }
43789
43790 const char *TypeTagForDatatypeAttr::getSpelling() const {
43791 switch (getAttributeSpellingListIndex()) {
43792 default:
43793 llvm_unreachable("Unknown attribute spelling!");
43794 return "(No spelling)";
43795 case 0:
43796 return "type_tag_for_datatype";
43797 case 1:
43798 return "type_tag_for_datatype";
43799 case 2:
43800 return "type_tag_for_datatype";
43801 }
43802 }
43803
43804
43805 // TypeVisibilityAttr implementation
43806
43807 TypeVisibilityAttr *TypeVisibilityAttr::CreateImplicit(ASTContext &Ctx, TypeVisibilityAttr::VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) {
43808 auto *A = new (Ctx) TypeVisibilityAttr(Ctx, CommonInfo, Visibility);
43809 A->setImplicit(true);
43810 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43811 A->setAttributeSpellingListIndex(0);
43812 return A;
43813 }
43814
43815 TypeVisibilityAttr *TypeVisibilityAttr::Create(ASTContext &Ctx, TypeVisibilityAttr::VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) {
43816 auto *A = new (Ctx) TypeVisibilityAttr(Ctx, CommonInfo, Visibility);
43817 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43818 A->setAttributeSpellingListIndex(0);
43819 return A;
43820 }
43821
43822 TypeVisibilityAttr *TypeVisibilityAttr::CreateImplicit(ASTContext &Ctx, TypeVisibilityAttr::VisibilityType Visibility, SourceRange Range, Spelling S) {
43823 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43824 switch (S) {
43825 case GNU_type_visibility:
43826 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43827 case CXX11_clang_type_visibility:
43828 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43829 case C23_clang_type_visibility:
43830 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43831 default:
43832 llvm_unreachable("Unknown attribute spelling!");
43833 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43834 }
43835 }());
43836 return CreateImplicit(Ctx, Visibility, I);
43837 }
43838
43839 TypeVisibilityAttr *TypeVisibilityAttr::Create(ASTContext &Ctx, TypeVisibilityAttr::VisibilityType Visibility, SourceRange Range, Spelling S) {
43840 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
43841 switch (S) {
43842 case GNU_type_visibility:
43843 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43844 case CXX11_clang_type_visibility:
43845 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43846 case C23_clang_type_visibility:
43847 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43848 default:
43849 llvm_unreachable("Unknown attribute spelling!");
43850 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
43851 }
43852 }());
43853 return Create(Ctx, Visibility, I);
43854 }
43855
43856 TypeVisibilityAttr::TypeVisibilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43857 , TypeVisibilityAttr::VisibilityType Visibility
43858 )
43859 : InheritableAttr(Ctx, CommonInfo, attr::TypeVisibility, /*IsLateParsed=*/false, false)
43860 , visibility(Visibility)
43861 {
43862 }
43863
43864
43865
43866 bool TypeVisibilityAttr::ConvertStrToVisibilityType(StringRef Val, TypeVisibilityAttr::VisibilityType &Out) {
43867 std::optional<TypeVisibilityAttr::VisibilityType> R = llvm::StringSwitch<std::optional<TypeVisibilityAttr::VisibilityType>>(Val)
43868 .Case("default", TypeVisibilityAttr::VisibilityType::Default)
43869 .Case("hidden", TypeVisibilityAttr::VisibilityType::Hidden)
43870 .Case("internal", TypeVisibilityAttr::VisibilityType::Hidden)
43871 .Case("protected", TypeVisibilityAttr::VisibilityType::Protected)
43872 .Default(std::optional<TypeVisibilityAttr::VisibilityType>());
43873 if (R) {
43874 Out = *R;
43875 return true;
43876 }
43877 return false;
43878 }
43879
43880 const char *TypeVisibilityAttr::ConvertVisibilityTypeToStr(TypeVisibilityAttr::VisibilityType Val) {
43881 switch(Val) {
43882 case TypeVisibilityAttr::VisibilityType::Default: return "default";
43883 case TypeVisibilityAttr::VisibilityType::Hidden: return "hidden";
43884 case TypeVisibilityAttr::VisibilityType::Protected: return "protected";
43885 }
43886 llvm_unreachable("No enumerator with that value");
43887 }
43888 TypeVisibilityAttr *TypeVisibilityAttr::clone(ASTContext &C) const {
43889 auto *A = new (C) TypeVisibilityAttr(C, *this, visibility);
43890 A->Inherited = Inherited;
43891 A->IsPackExpansion = IsPackExpansion;
43892 A->setImplicit(Implicit);
43893 return A;
43894 }
43895
43896 void TypeVisibilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43897 bool IsFirstArgument = true; (void)IsFirstArgument;
43898 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43899 switch (getAttributeSpellingListIndex()) {
43900 default:
43901 llvm_unreachable("Unknown attribute spelling!");
43902 break;
43903 case 0 : {
43904 OS << "__attribute__((type_visibility";
43905 DelimitAttributeArgument(OS, IsFirstArgument);
43906 OS << "\"" << TypeVisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\"";
43907 if (!IsFirstArgument)
43908 OS << ")";
43909 OS << "))";
43910 break;
43911 }
43912 case 1 : {
43913 OS << "[[clang::type_visibility";
43914 DelimitAttributeArgument(OS, IsFirstArgument);
43915 OS << "\"" << TypeVisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\"";
43916 if (!IsFirstArgument)
43917 OS << ")";
43918 OS << "]]";
43919 break;
43920 }
43921 case 2 : {
43922 OS << "[[clang::type_visibility";
43923 DelimitAttributeArgument(OS, IsFirstArgument);
43924 OS << "\"" << TypeVisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\"";
43925 if (!IsFirstArgument)
43926 OS << ")";
43927 OS << "]]";
43928 break;
43929 }
43930 }
43931 }
43932
43933 const char *TypeVisibilityAttr::getSpelling() const {
43934 switch (getAttributeSpellingListIndex()) {
43935 default:
43936 llvm_unreachable("Unknown attribute spelling!");
43937 return "(No spelling)";
43938 case 0:
43939 return "type_visibility";
43940 case 1:
43941 return "type_visibility";
43942 case 2:
43943 return "type_visibility";
43944 }
43945 }
43946
43947
43948 // UPtrAttr implementation
43949
43950 UPtrAttr *UPtrAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43951 auto *A = new (Ctx) UPtrAttr(Ctx, CommonInfo);
43952 A->setImplicit(true);
43953 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43954 A->setAttributeSpellingListIndex(0);
43955 return A;
43956 }
43957
43958 UPtrAttr *UPtrAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
43959 auto *A = new (Ctx) UPtrAttr(Ctx, CommonInfo);
43960 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
43961 A->setAttributeSpellingListIndex(0);
43962 return A;
43963 }
43964
43965 UPtrAttr *UPtrAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
43966 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43967 return CreateImplicit(Ctx, I);
43968 }
43969
43970 UPtrAttr *UPtrAttr::Create(ASTContext &Ctx, SourceRange Range) {
43971 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
43972 return Create(Ctx, I);
43973 }
43974
43975 UPtrAttr::UPtrAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
43976 )
43977 : TypeAttr(Ctx, CommonInfo, attr::UPtr, /*IsLateParsed=*/false)
43978 {
43979 }
43980
43981 UPtrAttr *UPtrAttr::clone(ASTContext &C) const {
43982 auto *A = new (C) UPtrAttr(C, *this);
43983 A->Inherited = Inherited;
43984 A->IsPackExpansion = IsPackExpansion;
43985 A->setImplicit(Implicit);
43986 return A;
43987 }
43988
43989 void UPtrAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
43990 bool IsFirstArgument = true; (void)IsFirstArgument;
43991 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
43992 switch (getAttributeSpellingListIndex()) {
43993 default:
43994 llvm_unreachable("Unknown attribute spelling!");
43995 break;
43996 case 0 : {
43997 OS << "__uptr";
43998 OS << "";
43999 break;
44000 }
44001 }
44002 }
44003
44004 const char *UPtrAttr::getSpelling() const {
44005 switch (getAttributeSpellingListIndex()) {
44006 default:
44007 llvm_unreachable("Unknown attribute spelling!");
44008 return "(No spelling)";
44009 case 0:
44010 return "__uptr";
44011 }
44012 }
44013
44014
44015 // UnavailableAttr implementation
44016
44017 UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, UnavailableAttr::ImplicitReason ImplicitReason, const AttributeCommonInfo &CommonInfo) {
44018 auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message, ImplicitReason);
44019 A->setImplicit(true);
44020 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44021 A->setAttributeSpellingListIndex(0);
44022 return A;
44023 }
44024
44025 UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, UnavailableAttr::ImplicitReason ImplicitReason, const AttributeCommonInfo &CommonInfo) {
44026 auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message, ImplicitReason);
44027 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44028 A->setAttributeSpellingListIndex(0);
44029 return A;
44030 }
44031
44032 UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, UnavailableAttr::ImplicitReason ImplicitReason, SourceRange Range, Spelling S) {
44033 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44034 switch (S) {
44035 case GNU_unavailable:
44036 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44037 case CXX11_clang_unavailable:
44038 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44039 case C23_clang_unavailable:
44040 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44041 default:
44042 llvm_unreachable("Unknown attribute spelling!");
44043 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44044 }
44045 }());
44046 return CreateImplicit(Ctx, Message, ImplicitReason, I);
44047 }
44048
44049 UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, UnavailableAttr::ImplicitReason ImplicitReason, SourceRange Range, Spelling S) {
44050 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44051 switch (S) {
44052 case GNU_unavailable:
44053 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44054 case CXX11_clang_unavailable:
44055 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44056 case C23_clang_unavailable:
44057 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44058 default:
44059 llvm_unreachable("Unknown attribute spelling!");
44060 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44061 }
44062 }());
44063 return Create(Ctx, Message, ImplicitReason, I);
44064 }
44065
44066 UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) {
44067 auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message);
44068 A->setImplicit(true);
44069 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44070 A->setAttributeSpellingListIndex(0);
44071 return A;
44072 }
44073
44074 UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) {
44075 auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message);
44076 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44077 A->setAttributeSpellingListIndex(0);
44078 return A;
44079 }
44080
44081 UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) {
44082 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44083 switch (S) {
44084 case GNU_unavailable:
44085 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44086 case CXX11_clang_unavailable:
44087 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44088 case C23_clang_unavailable:
44089 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44090 default:
44091 llvm_unreachable("Unknown attribute spelling!");
44092 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44093 }
44094 }());
44095 return CreateImplicit(Ctx, Message, I);
44096 }
44097
44098 UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) {
44099 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44100 switch (S) {
44101 case GNU_unavailable:
44102 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44103 case CXX11_clang_unavailable:
44104 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44105 case C23_clang_unavailable:
44106 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44107 default:
44108 llvm_unreachable("Unknown attribute spelling!");
44109 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44110 }
44111 }());
44112 return Create(Ctx, Message, I);
44113 }
44114
44115 UnavailableAttr::UnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44116 , llvm::StringRef Message
44117 , UnavailableAttr::ImplicitReason ImplicitReason
44118 )
44119 : InheritableAttr(Ctx, CommonInfo, attr::Unavailable, /*IsLateParsed=*/false, false)
44120 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
44121 , implicitReason(ImplicitReason)
44122 {
44123 if (!Message.empty())
44124 std::memcpy(message, Message.data(), messageLength);
44125 }
44126
44127 UnavailableAttr::UnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44128 , llvm::StringRef Message
44129 )
44130 : InheritableAttr(Ctx, CommonInfo, attr::Unavailable, /*IsLateParsed=*/false, false)
44131 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
44132 , implicitReason(UnavailableAttr::ImplicitReason(0))
44133 {
44134 if (!Message.empty())
44135 std::memcpy(message, Message.data(), messageLength);
44136 }
44137
44138 UnavailableAttr::UnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44139 )
44140 : InheritableAttr(Ctx, CommonInfo, attr::Unavailable, /*IsLateParsed=*/false, false)
44141 , messageLength(0),message(nullptr)
44142 , implicitReason(UnavailableAttr::ImplicitReason(0))
44143 {
44144 }
44145
44146
44147
44148
44149
44150 UnavailableAttr *UnavailableAttr::clone(ASTContext &C) const {
44151 auto *A = new (C) UnavailableAttr(C, *this, getMessage(), implicitReason);
44152 A->Inherited = Inherited;
44153 A->IsPackExpansion = IsPackExpansion;
44154 A->setImplicit(Implicit);
44155 return A;
44156 }
44157
44158 void UnavailableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
44159 bool IsFirstArgument = true; (void)IsFirstArgument;
44160 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
44161 switch (getAttributeSpellingListIndex()) {
44162 default:
44163 llvm_unreachable("Unknown attribute spelling!");
44164 break;
44165 case 0 : {
44166 OS << "__attribute__((unavailable";
44167 DelimitAttributeArgument(OS, IsFirstArgument);
44168 OS << "\"" << getMessage() << "\"";
44169 if (!IsFirstArgument)
44170 OS << ")";
44171 OS << "))";
44172 break;
44173 }
44174 case 1 : {
44175 OS << "[[clang::unavailable";
44176 DelimitAttributeArgument(OS, IsFirstArgument);
44177 OS << "\"" << getMessage() << "\"";
44178 if (!IsFirstArgument)
44179 OS << ")";
44180 OS << "]]";
44181 break;
44182 }
44183 case 2 : {
44184 OS << "[[clang::unavailable";
44185 DelimitAttributeArgument(OS, IsFirstArgument);
44186 OS << "\"" << getMessage() << "\"";
44187 if (!IsFirstArgument)
44188 OS << ")";
44189 OS << "]]";
44190 break;
44191 }
44192 }
44193 }
44194
44195 const char *UnavailableAttr::getSpelling() const {
44196 switch (getAttributeSpellingListIndex()) {
44197 default:
44198 llvm_unreachable("Unknown attribute spelling!");
44199 return "(No spelling)";
44200 case 0:
44201 return "unavailable";
44202 case 1:
44203 return "unavailable";
44204 case 2:
44205 return "unavailable";
44206 }
44207 }
44208
44209
44210 // UninitializedAttr implementation
44211
44212 UninitializedAttr *UninitializedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44213 auto *A = new (Ctx) UninitializedAttr(Ctx, CommonInfo);
44214 A->setImplicit(true);
44215 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44216 A->setAttributeSpellingListIndex(0);
44217 return A;
44218 }
44219
44220 UninitializedAttr *UninitializedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44221 auto *A = new (Ctx) UninitializedAttr(Ctx, CommonInfo);
44222 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44223 A->setAttributeSpellingListIndex(0);
44224 return A;
44225 }
44226
44227 UninitializedAttr *UninitializedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
44228 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44229 switch (S) {
44230 case GNU_uninitialized:
44231 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44232 case CXX11_clang_uninitialized:
44233 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44234 default:
44235 llvm_unreachable("Unknown attribute spelling!");
44236 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44237 }
44238 }());
44239 return CreateImplicit(Ctx, I);
44240 }
44241
44242 UninitializedAttr *UninitializedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
44243 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44244 switch (S) {
44245 case GNU_uninitialized:
44246 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44247 case CXX11_clang_uninitialized:
44248 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44249 default:
44250 llvm_unreachable("Unknown attribute spelling!");
44251 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44252 }
44253 }());
44254 return Create(Ctx, I);
44255 }
44256
44257 UninitializedAttr::UninitializedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44258 )
44259 : InheritableAttr(Ctx, CommonInfo, attr::Uninitialized, /*IsLateParsed=*/false, false)
44260 {
44261 }
44262
44263 UninitializedAttr *UninitializedAttr::clone(ASTContext &C) const {
44264 auto *A = new (C) UninitializedAttr(C, *this);
44265 A->Inherited = Inherited;
44266 A->IsPackExpansion = IsPackExpansion;
44267 A->setImplicit(Implicit);
44268 return A;
44269 }
44270
44271 void UninitializedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
44272 bool IsFirstArgument = true; (void)IsFirstArgument;
44273 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
44274 switch (getAttributeSpellingListIndex()) {
44275 default:
44276 llvm_unreachable("Unknown attribute spelling!");
44277 break;
44278 case 0 : {
44279 OS << "__attribute__((uninitialized";
44280 OS << "))";
44281 break;
44282 }
44283 case 1 : {
44284 OS << "[[clang::uninitialized";
44285 OS << "]]";
44286 break;
44287 }
44288 }
44289 }
44290
44291 const char *UninitializedAttr::getSpelling() const {
44292 switch (getAttributeSpellingListIndex()) {
44293 default:
44294 llvm_unreachable("Unknown attribute spelling!");
44295 return "(No spelling)";
44296 case 0:
44297 return "uninitialized";
44298 case 1:
44299 return "uninitialized";
44300 }
44301 }
44302
44303
44304 // UnlikelyAttr implementation
44305
44306 UnlikelyAttr *UnlikelyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44307 auto *A = new (Ctx) UnlikelyAttr(Ctx, CommonInfo);
44308 A->setImplicit(true);
44309 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44310 A->setAttributeSpellingListIndex(0);
44311 return A;
44312 }
44313
44314 UnlikelyAttr *UnlikelyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44315 auto *A = new (Ctx) UnlikelyAttr(Ctx, CommonInfo);
44316 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44317 A->setAttributeSpellingListIndex(0);
44318 return A;
44319 }
44320
44321 UnlikelyAttr *UnlikelyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
44322 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44323 switch (S) {
44324 case CXX11_unlikely:
44325 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_unlikely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44326 case C23_clang_unlikely:
44327 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unlikely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44328 default:
44329 llvm_unreachable("Unknown attribute spelling!");
44330 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44331 }
44332 }());
44333 return CreateImplicit(Ctx, I);
44334 }
44335
44336 UnlikelyAttr *UnlikelyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
44337 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44338 switch (S) {
44339 case CXX11_unlikely:
44340 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_unlikely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44341 case C23_clang_unlikely:
44342 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unlikely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44343 default:
44344 llvm_unreachable("Unknown attribute spelling!");
44345 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44346 }
44347 }());
44348 return Create(Ctx, I);
44349 }
44350
44351 UnlikelyAttr::UnlikelyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44352 )
44353 : StmtAttr(Ctx, CommonInfo, attr::Unlikely, /*IsLateParsed=*/false)
44354 {
44355 }
44356
44357 UnlikelyAttr *UnlikelyAttr::clone(ASTContext &C) const {
44358 auto *A = new (C) UnlikelyAttr(C, *this);
44359 A->Inherited = Inherited;
44360 A->IsPackExpansion = IsPackExpansion;
44361 A->setImplicit(Implicit);
44362 return A;
44363 }
44364
44365 void UnlikelyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
44366 bool IsFirstArgument = true; (void)IsFirstArgument;
44367 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
44368 switch (getAttributeSpellingListIndex()) {
44369 default:
44370 llvm_unreachable("Unknown attribute spelling!");
44371 break;
44372 case 0 : {
44373 OS << "[[unlikely";
44374 OS << "]]";
44375 break;
44376 }
44377 case 1 : {
44378 OS << "[[clang::unlikely";
44379 OS << "]]";
44380 break;
44381 }
44382 }
44383 }
44384
44385 const char *UnlikelyAttr::getSpelling() const {
44386 switch (getAttributeSpellingListIndex()) {
44387 default:
44388 llvm_unreachable("Unknown attribute spelling!");
44389 return "(No spelling)";
44390 case 0:
44391 return "unlikely";
44392 case 1:
44393 return "unlikely";
44394 }
44395 }
44396
44397
44398 // UnsafeBufferUsageAttr implementation
44399
44400 UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44401 auto *A = new (Ctx) UnsafeBufferUsageAttr(Ctx, CommonInfo);
44402 A->setImplicit(true);
44403 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44404 A->setAttributeSpellingListIndex(0);
44405 return A;
44406 }
44407
44408 UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44409 auto *A = new (Ctx) UnsafeBufferUsageAttr(Ctx, CommonInfo);
44410 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44411 A->setAttributeSpellingListIndex(0);
44412 return A;
44413 }
44414
44415 UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
44416 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44417 switch (S) {
44418 case GNU_unsafe_buffer_usage:
44419 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44420 case CXX11_clang_unsafe_buffer_usage:
44421 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44422 case C23_clang_unsafe_buffer_usage:
44423 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44424 default:
44425 llvm_unreachable("Unknown attribute spelling!");
44426 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44427 }
44428 }());
44429 return CreateImplicit(Ctx, I);
44430 }
44431
44432 UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
44433 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44434 switch (S) {
44435 case GNU_unsafe_buffer_usage:
44436 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44437 case CXX11_clang_unsafe_buffer_usage:
44438 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44439 case C23_clang_unsafe_buffer_usage:
44440 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44441 default:
44442 llvm_unreachable("Unknown attribute spelling!");
44443 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44444 }
44445 }());
44446 return Create(Ctx, I);
44447 }
44448
44449 UnsafeBufferUsageAttr::UnsafeBufferUsageAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44450 )
44451 : InheritableAttr(Ctx, CommonInfo, attr::UnsafeBufferUsage, /*IsLateParsed=*/false, false)
44452 {
44453 }
44454
44455 UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::clone(ASTContext &C) const {
44456 auto *A = new (C) UnsafeBufferUsageAttr(C, *this);
44457 A->Inherited = Inherited;
44458 A->IsPackExpansion = IsPackExpansion;
44459 A->setImplicit(Implicit);
44460 return A;
44461 }
44462
44463 void UnsafeBufferUsageAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
44464 bool IsFirstArgument = true; (void)IsFirstArgument;
44465 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
44466 switch (getAttributeSpellingListIndex()) {
44467 default:
44468 llvm_unreachable("Unknown attribute spelling!");
44469 break;
44470 case 0 : {
44471 OS << "__attribute__((unsafe_buffer_usage";
44472 OS << "))";
44473 break;
44474 }
44475 case 1 : {
44476 OS << "[[clang::unsafe_buffer_usage";
44477 OS << "]]";
44478 break;
44479 }
44480 case 2 : {
44481 OS << "[[clang::unsafe_buffer_usage";
44482 OS << "]]";
44483 break;
44484 }
44485 }
44486 }
44487
44488 const char *UnsafeBufferUsageAttr::getSpelling() const {
44489 switch (getAttributeSpellingListIndex()) {
44490 default:
44491 llvm_unreachable("Unknown attribute spelling!");
44492 return "(No spelling)";
44493 case 0:
44494 return "unsafe_buffer_usage";
44495 case 1:
44496 return "unsafe_buffer_usage";
44497 case 2:
44498 return "unsafe_buffer_usage";
44499 }
44500 }
44501
44502
44503 // UnusedAttr implementation
44504
44505 UnusedAttr *UnusedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44506 auto *A = new (Ctx) UnusedAttr(Ctx, CommonInfo);
44507 A->setImplicit(true);
44508 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44509 A->setAttributeSpellingListIndex(0);
44510 return A;
44511 }
44512
44513 UnusedAttr *UnusedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44514 auto *A = new (Ctx) UnusedAttr(Ctx, CommonInfo);
44515 return A;
44516 }
44517
44518 UnusedAttr *UnusedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
44519 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44520 switch (S) {
44521 case CXX11_maybe_unused:
44522 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_maybe_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44523 case GNU_unused:
44524 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44525 case CXX11_gnu_unused:
44526 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44527 case C23_gnu_unused:
44528 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44529 case C23_maybe_unused:
44530 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_maybe_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44531 default:
44532 llvm_unreachable("Unknown attribute spelling!");
44533 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44534 }
44535 }());
44536 return CreateImplicit(Ctx, I);
44537 }
44538
44539 UnusedAttr *UnusedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
44540 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44541 switch (S) {
44542 case CXX11_maybe_unused:
44543 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_maybe_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44544 case GNU_unused:
44545 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44546 case CXX11_gnu_unused:
44547 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44548 case C23_gnu_unused:
44549 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44550 case C23_maybe_unused:
44551 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_maybe_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44552 default:
44553 llvm_unreachable("Unknown attribute spelling!");
44554 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44555 }
44556 }());
44557 return Create(Ctx, I);
44558 }
44559
44560 UnusedAttr::UnusedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44561 )
44562 : InheritableAttr(Ctx, CommonInfo, attr::Unused, /*IsLateParsed=*/false, false)
44563 {
44564 }
44565
44566 UnusedAttr::Spelling UnusedAttr::getSemanticSpelling() const {
44567 switch (getAttributeSpellingListIndex()) {
44568 default: llvm_unreachable("Unknown spelling list index");
44569 case 0: return CXX11_maybe_unused;
44570 case 1: return GNU_unused;
44571 case 2: return CXX11_gnu_unused;
44572 case 3: return C23_gnu_unused;
44573 case 4: return C23_maybe_unused;
44574 }
44575 }
44576 UnusedAttr *UnusedAttr::clone(ASTContext &C) const {
44577 auto *A = new (C) UnusedAttr(C, *this);
44578 A->Inherited = Inherited;
44579 A->IsPackExpansion = IsPackExpansion;
44580 A->setImplicit(Implicit);
44581 return A;
44582 }
44583
44584 void UnusedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
44585 bool IsFirstArgument = true; (void)IsFirstArgument;
44586 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
44587 switch (getAttributeSpellingListIndex()) {
44588 default:
44589 llvm_unreachable("Unknown attribute spelling!");
44590 break;
44591 case 0 : {
44592 OS << "[[maybe_unused";
44593 OS << "]]";
44594 break;
44595 }
44596 case 1 : {
44597 OS << "__attribute__((unused";
44598 OS << "))";
44599 break;
44600 }
44601 case 2 : {
44602 OS << "[[gnu::unused";
44603 OS << "]]";
44604 break;
44605 }
44606 case 3 : {
44607 OS << "[[gnu::unused";
44608 OS << "]]";
44609 break;
44610 }
44611 case 4 : {
44612 OS << "[[maybe_unused";
44613 OS << "]]";
44614 break;
44615 }
44616 }
44617 }
44618
44619 const char *UnusedAttr::getSpelling() const {
44620 switch (getAttributeSpellingListIndex()) {
44621 default:
44622 llvm_unreachable("Unknown attribute spelling!");
44623 return "(No spelling)";
44624 case 0:
44625 return "maybe_unused";
44626 case 1:
44627 return "unused";
44628 case 2:
44629 return "unused";
44630 case 3:
44631 return "unused";
44632 case 4:
44633 return "maybe_unused";
44634 }
44635 }
44636
44637
44638 // UseHandleAttr implementation
44639
44640 UseHandleAttr *UseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) {
44641 auto *A = new (Ctx) UseHandleAttr(Ctx, CommonInfo, HandleType);
44642 A->setImplicit(true);
44643 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44644 A->setAttributeSpellingListIndex(0);
44645 return A;
44646 }
44647
44648 UseHandleAttr *UseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) {
44649 auto *A = new (Ctx) UseHandleAttr(Ctx, CommonInfo, HandleType);
44650 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44651 A->setAttributeSpellingListIndex(0);
44652 return A;
44653 }
44654
44655 UseHandleAttr *UseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) {
44656 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44657 switch (S) {
44658 case GNU_use_handle:
44659 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44660 case CXX11_clang_use_handle:
44661 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44662 case C23_clang_use_handle:
44663 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44664 default:
44665 llvm_unreachable("Unknown attribute spelling!");
44666 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44667 }
44668 }());
44669 return CreateImplicit(Ctx, HandleType, I);
44670 }
44671
44672 UseHandleAttr *UseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) {
44673 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44674 switch (S) {
44675 case GNU_use_handle:
44676 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44677 case CXX11_clang_use_handle:
44678 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44679 case C23_clang_use_handle:
44680 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44681 default:
44682 llvm_unreachable("Unknown attribute spelling!");
44683 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44684 }
44685 }());
44686 return Create(Ctx, HandleType, I);
44687 }
44688
44689 UseHandleAttr::UseHandleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44690 , llvm::StringRef HandleType
44691 )
44692 : InheritableParamAttr(Ctx, CommonInfo, attr::UseHandle, /*IsLateParsed=*/false, false)
44693 , handleTypeLength(HandleType.size()),handleType(new (Ctx, 1) char[handleTypeLength])
44694 {
44695 if (!HandleType.empty())
44696 std::memcpy(handleType, HandleType.data(), handleTypeLength);
44697 }
44698
44699
44700
44701 UseHandleAttr *UseHandleAttr::clone(ASTContext &C) const {
44702 auto *A = new (C) UseHandleAttr(C, *this, getHandleType());
44703 A->Inherited = Inherited;
44704 A->IsPackExpansion = IsPackExpansion;
44705 A->setImplicit(Implicit);
44706 return A;
44707 }
44708
44709 void UseHandleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
44710 bool IsFirstArgument = true; (void)IsFirstArgument;
44711 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
44712 switch (getAttributeSpellingListIndex()) {
44713 default:
44714 llvm_unreachable("Unknown attribute spelling!");
44715 break;
44716 case 0 : {
44717 OS << "__attribute__((use_handle";
44718 DelimitAttributeArgument(OS, IsFirstArgument);
44719 OS << "\"" << getHandleType() << "\"";
44720 if (!IsFirstArgument)
44721 OS << ")";
44722 OS << "))";
44723 break;
44724 }
44725 case 1 : {
44726 OS << "[[clang::use_handle";
44727 DelimitAttributeArgument(OS, IsFirstArgument);
44728 OS << "\"" << getHandleType() << "\"";
44729 if (!IsFirstArgument)
44730 OS << ")";
44731 OS << "]]";
44732 break;
44733 }
44734 case 2 : {
44735 OS << "[[clang::use_handle";
44736 DelimitAttributeArgument(OS, IsFirstArgument);
44737 OS << "\"" << getHandleType() << "\"";
44738 if (!IsFirstArgument)
44739 OS << ")";
44740 OS << "]]";
44741 break;
44742 }
44743 }
44744 }
44745
44746 const char *UseHandleAttr::getSpelling() const {
44747 switch (getAttributeSpellingListIndex()) {
44748 default:
44749 llvm_unreachable("Unknown attribute spelling!");
44750 return "(No spelling)";
44751 case 0:
44752 return "use_handle";
44753 case 1:
44754 return "use_handle";
44755 case 2:
44756 return "use_handle";
44757 }
44758 }
44759
44760
44761 // UsedAttr implementation
44762
44763 UsedAttr *UsedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44764 auto *A = new (Ctx) UsedAttr(Ctx, CommonInfo);
44765 A->setImplicit(true);
44766 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44767 A->setAttributeSpellingListIndex(0);
44768 return A;
44769 }
44770
44771 UsedAttr *UsedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44772 auto *A = new (Ctx) UsedAttr(Ctx, CommonInfo);
44773 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44774 A->setAttributeSpellingListIndex(0);
44775 return A;
44776 }
44777
44778 UsedAttr *UsedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
44779 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44780 switch (S) {
44781 case GNU_used:
44782 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44783 case CXX11_gnu_used:
44784 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44785 case C23_gnu_used:
44786 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44787 default:
44788 llvm_unreachable("Unknown attribute spelling!");
44789 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44790 }
44791 }());
44792 return CreateImplicit(Ctx, I);
44793 }
44794
44795 UsedAttr *UsedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
44796 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44797 switch (S) {
44798 case GNU_used:
44799 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44800 case CXX11_gnu_used:
44801 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44802 case C23_gnu_used:
44803 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44804 default:
44805 llvm_unreachable("Unknown attribute spelling!");
44806 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44807 }
44808 }());
44809 return Create(Ctx, I);
44810 }
44811
44812 UsedAttr::UsedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44813 )
44814 : InheritableAttr(Ctx, CommonInfo, attr::Used, /*IsLateParsed=*/false, false)
44815 {
44816 }
44817
44818 UsedAttr *UsedAttr::clone(ASTContext &C) const {
44819 auto *A = new (C) UsedAttr(C, *this);
44820 A->Inherited = Inherited;
44821 A->IsPackExpansion = IsPackExpansion;
44822 A->setImplicit(Implicit);
44823 return A;
44824 }
44825
44826 void UsedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
44827 bool IsFirstArgument = true; (void)IsFirstArgument;
44828 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
44829 switch (getAttributeSpellingListIndex()) {
44830 default:
44831 llvm_unreachable("Unknown attribute spelling!");
44832 break;
44833 case 0 : {
44834 OS << "__attribute__((used";
44835 OS << "))";
44836 break;
44837 }
44838 case 1 : {
44839 OS << "[[gnu::used";
44840 OS << "]]";
44841 break;
44842 }
44843 case 2 : {
44844 OS << "[[gnu::used";
44845 OS << "]]";
44846 break;
44847 }
44848 }
44849 }
44850
44851 const char *UsedAttr::getSpelling() const {
44852 switch (getAttributeSpellingListIndex()) {
44853 default:
44854 llvm_unreachable("Unknown attribute spelling!");
44855 return "(No spelling)";
44856 case 0:
44857 return "used";
44858 case 1:
44859 return "used";
44860 case 2:
44861 return "used";
44862 }
44863 }
44864
44865
44866 // UsingIfExistsAttr implementation
44867
44868 UsingIfExistsAttr *UsingIfExistsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44869 auto *A = new (Ctx) UsingIfExistsAttr(Ctx, CommonInfo);
44870 A->setImplicit(true);
44871 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44872 A->setAttributeSpellingListIndex(0);
44873 return A;
44874 }
44875
44876 UsingIfExistsAttr *UsingIfExistsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
44877 auto *A = new (Ctx) UsingIfExistsAttr(Ctx, CommonInfo);
44878 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44879 A->setAttributeSpellingListIndex(0);
44880 return A;
44881 }
44882
44883 UsingIfExistsAttr *UsingIfExistsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
44884 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44885 switch (S) {
44886 case GNU_using_if_exists:
44887 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_using_if_exists, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44888 case CXX11_clang_using_if_exists:
44889 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_using_if_exists, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44890 default:
44891 llvm_unreachable("Unknown attribute spelling!");
44892 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44893 }
44894 }());
44895 return CreateImplicit(Ctx, I);
44896 }
44897
44898 UsingIfExistsAttr *UsingIfExistsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
44899 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44900 switch (S) {
44901 case GNU_using_if_exists:
44902 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_using_if_exists, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44903 case CXX11_clang_using_if_exists:
44904 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_using_if_exists, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44905 default:
44906 llvm_unreachable("Unknown attribute spelling!");
44907 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44908 }
44909 }());
44910 return Create(Ctx, I);
44911 }
44912
44913 UsingIfExistsAttr::UsingIfExistsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
44914 )
44915 : InheritableAttr(Ctx, CommonInfo, attr::UsingIfExists, /*IsLateParsed=*/false, false)
44916 {
44917 }
44918
44919 UsingIfExistsAttr *UsingIfExistsAttr::clone(ASTContext &C) const {
44920 auto *A = new (C) UsingIfExistsAttr(C, *this);
44921 A->Inherited = Inherited;
44922 A->IsPackExpansion = IsPackExpansion;
44923 A->setImplicit(Implicit);
44924 return A;
44925 }
44926
44927 void UsingIfExistsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
44928 bool IsFirstArgument = true; (void)IsFirstArgument;
44929 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
44930 switch (getAttributeSpellingListIndex()) {
44931 default:
44932 llvm_unreachable("Unknown attribute spelling!");
44933 break;
44934 case 0 : {
44935 OS << "__attribute__((using_if_exists";
44936 OS << "))";
44937 break;
44938 }
44939 case 1 : {
44940 OS << "[[clang::using_if_exists";
44941 OS << "]]";
44942 break;
44943 }
44944 }
44945 }
44946
44947 const char *UsingIfExistsAttr::getSpelling() const {
44948 switch (getAttributeSpellingListIndex()) {
44949 default:
44950 llvm_unreachable("Unknown attribute spelling!");
44951 return "(No spelling)";
44952 case 0:
44953 return "using_if_exists";
44954 case 1:
44955 return "using_if_exists";
44956 }
44957 }
44958
44959
44960 // UuidAttr implementation
44961
44962 UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, const AttributeCommonInfo &CommonInfo) {
44963 auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid, GuidDecl);
44964 A->setImplicit(true);
44965 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44966 A->setAttributeSpellingListIndex(0);
44967 return A;
44968 }
44969
44970 UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, const AttributeCommonInfo &CommonInfo) {
44971 auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid, GuidDecl);
44972 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
44973 A->setAttributeSpellingListIndex(0);
44974 return A;
44975 }
44976
44977 UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, SourceRange Range, Spelling S) {
44978 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44979 switch (S) {
44980 case Declspec_uuid:
44981 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44982 case Microsoft_uuid:
44983 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44984 default:
44985 llvm_unreachable("Unknown attribute spelling!");
44986 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44987 }
44988 }());
44989 return CreateImplicit(Ctx, Guid, GuidDecl, I);
44990 }
44991
44992 UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, SourceRange Range, Spelling S) {
44993 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
44994 switch (S) {
44995 case Declspec_uuid:
44996 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44997 case Microsoft_uuid:
44998 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
44999 default:
45000 llvm_unreachable("Unknown attribute spelling!");
45001 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45002 }
45003 }());
45004 return Create(Ctx, Guid, GuidDecl, I);
45005 }
45006
45007 UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, const AttributeCommonInfo &CommonInfo) {
45008 auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid);
45009 A->setImplicit(true);
45010 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45011 A->setAttributeSpellingListIndex(0);
45012 return A;
45013 }
45014
45015 UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, const AttributeCommonInfo &CommonInfo) {
45016 auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid);
45017 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45018 A->setAttributeSpellingListIndex(0);
45019 return A;
45020 }
45021
45022 UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, SourceRange Range, Spelling S) {
45023 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45024 switch (S) {
45025 case Declspec_uuid:
45026 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45027 case Microsoft_uuid:
45028 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45029 default:
45030 llvm_unreachable("Unknown attribute spelling!");
45031 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45032 }
45033 }());
45034 return CreateImplicit(Ctx, Guid, I);
45035 }
45036
45037 UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, SourceRange Range, Spelling S) {
45038 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45039 switch (S) {
45040 case Declspec_uuid:
45041 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45042 case Microsoft_uuid:
45043 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45044 default:
45045 llvm_unreachable("Unknown attribute spelling!");
45046 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45047 }
45048 }());
45049 return Create(Ctx, Guid, I);
45050 }
45051
45052 UuidAttr::UuidAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45053 , llvm::StringRef Guid
45054 , MSGuidDecl * GuidDecl
45055 )
45056 : InheritableAttr(Ctx, CommonInfo, attr::Uuid, /*IsLateParsed=*/false, false)
45057 , guidLength(Guid.size()),guid(new (Ctx, 1) char[guidLength])
45058 , guidDecl(GuidDecl)
45059 {
45060 if (!Guid.empty())
45061 std::memcpy(guid, Guid.data(), guidLength);
45062 }
45063
45064 UuidAttr::UuidAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45065 , llvm::StringRef Guid
45066 )
45067 : InheritableAttr(Ctx, CommonInfo, attr::Uuid, /*IsLateParsed=*/false, false)
45068 , guidLength(Guid.size()),guid(new (Ctx, 1) char[guidLength])
45069 , guidDecl()
45070 {
45071 if (!Guid.empty())
45072 std::memcpy(guid, Guid.data(), guidLength);
45073 }
45074
45075
45076
45077
45078
45079 UuidAttr *UuidAttr::clone(ASTContext &C) const {
45080 auto *A = new (C) UuidAttr(C, *this, getGuid(), guidDecl);
45081 A->Inherited = Inherited;
45082 A->IsPackExpansion = IsPackExpansion;
45083 A->setImplicit(Implicit);
45084 return A;
45085 }
45086
45087 void UuidAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
45088 bool IsFirstArgument = true; (void)IsFirstArgument;
45089 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
45090 switch (getAttributeSpellingListIndex()) {
45091 default:
45092 llvm_unreachable("Unknown attribute spelling!");
45093 break;
45094 case 0 : {
45095 OS << "__declspec(uuid";
45096 DelimitAttributeArgument(OS, IsFirstArgument);
45097 OS << "\"" << getGuid() << "\"";
45098 if (!IsFirstArgument)
45099 OS << ")";
45100 OS << ")";
45101 break;
45102 }
45103 case 1 : {
45104 OS << "[uuid";
45105 DelimitAttributeArgument(OS, IsFirstArgument);
45106 OS << "\"" << getGuid() << "\"";
45107 if (!IsFirstArgument)
45108 OS << ")";
45109 OS << "]";
45110 break;
45111 }
45112 }
45113 }
45114
45115 const char *UuidAttr::getSpelling() const {
45116 switch (getAttributeSpellingListIndex()) {
45117 default:
45118 llvm_unreachable("Unknown attribute spelling!");
45119 return "(No spelling)";
45120 case 0:
45121 return "uuid";
45122 case 1:
45123 return "uuid";
45124 }
45125 }
45126
45127
45128 // VTablePointerAuthenticationAttr implementation
45129
45130 VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::CreateImplicit(ASTContext &Ctx, VTablePointerAuthenticationAttr::VPtrAuthKeyType Key, VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination, VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination, int CustomDiscriminationValue, const AttributeCommonInfo &CommonInfo) {
45131 auto *A = new (Ctx) VTablePointerAuthenticationAttr(Ctx, CommonInfo, Key, AddressDiscrimination, ExtraDiscrimination, CustomDiscriminationValue);
45132 A->setImplicit(true);
45133 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45134 A->setAttributeSpellingListIndex(0);
45135 return A;
45136 }
45137
45138 VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::Create(ASTContext &Ctx, VTablePointerAuthenticationAttr::VPtrAuthKeyType Key, VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination, VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination, int CustomDiscriminationValue, const AttributeCommonInfo &CommonInfo) {
45139 auto *A = new (Ctx) VTablePointerAuthenticationAttr(Ctx, CommonInfo, Key, AddressDiscrimination, ExtraDiscrimination, CustomDiscriminationValue);
45140 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45141 A->setAttributeSpellingListIndex(0);
45142 return A;
45143 }
45144
45145 VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::CreateImplicit(ASTContext &Ctx, VTablePointerAuthenticationAttr::VPtrAuthKeyType Key, VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination, VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination, int CustomDiscriminationValue, SourceRange Range, Spelling S) {
45146 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45147 switch (S) {
45148 case GNU_ptrauth_vtable_pointer:
45149 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45150 case CXX11_clang_ptrauth_vtable_pointer:
45151 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45152 case C23_clang_ptrauth_vtable_pointer:
45153 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45154 default:
45155 llvm_unreachable("Unknown attribute spelling!");
45156 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45157 }
45158 }());
45159 return CreateImplicit(Ctx, Key, AddressDiscrimination, ExtraDiscrimination, CustomDiscriminationValue, I);
45160 }
45161
45162 VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::Create(ASTContext &Ctx, VTablePointerAuthenticationAttr::VPtrAuthKeyType Key, VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination, VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination, int CustomDiscriminationValue, SourceRange Range, Spelling S) {
45163 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45164 switch (S) {
45165 case GNU_ptrauth_vtable_pointer:
45166 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45167 case CXX11_clang_ptrauth_vtable_pointer:
45168 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45169 case C23_clang_ptrauth_vtable_pointer:
45170 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45171 default:
45172 llvm_unreachable("Unknown attribute spelling!");
45173 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45174 }
45175 }());
45176 return Create(Ctx, Key, AddressDiscrimination, ExtraDiscrimination, CustomDiscriminationValue, I);
45177 }
45178
45179 VTablePointerAuthenticationAttr::VTablePointerAuthenticationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45180 , VTablePointerAuthenticationAttr::VPtrAuthKeyType Key
45181 , VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination
45182 , VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination
45183 , int CustomDiscriminationValue
45184 )
45185 : InheritableAttr(Ctx, CommonInfo, attr::VTablePointerAuthentication, /*IsLateParsed=*/false, false)
45186 , key(Key)
45187 , addressDiscrimination(AddressDiscrimination)
45188 , extraDiscrimination(ExtraDiscrimination)
45189 , customDiscriminationValue(CustomDiscriminationValue)
45190 {
45191 }
45192
45193 VTablePointerAuthenticationAttr::VTablePointerAuthenticationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45194 , VTablePointerAuthenticationAttr::VPtrAuthKeyType Key
45195 , VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination
45196 , VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination
45197 )
45198 : InheritableAttr(Ctx, CommonInfo, attr::VTablePointerAuthentication, /*IsLateParsed=*/false, false)
45199 , key(Key)
45200 , addressDiscrimination(AddressDiscrimination)
45201 , extraDiscrimination(ExtraDiscrimination)
45202 , customDiscriminationValue()
45203 {
45204 }
45205
45206
45207
45208 bool VTablePointerAuthenticationAttr::ConvertStrToVPtrAuthKeyType(StringRef Val, VTablePointerAuthenticationAttr::VPtrAuthKeyType &Out) {
45209 std::optional<VTablePointerAuthenticationAttr::VPtrAuthKeyType> R = llvm::StringSwitch<std::optional<VTablePointerAuthenticationAttr::VPtrAuthKeyType>>(Val)
45210 .Case("default_key", VTablePointerAuthenticationAttr::VPtrAuthKeyType::DefaultKey)
45211 .Case("no_authentication", VTablePointerAuthenticationAttr::VPtrAuthKeyType::NoKey)
45212 .Case("process_dependent", VTablePointerAuthenticationAttr::VPtrAuthKeyType::ProcessDependent)
45213 .Case("process_independent", VTablePointerAuthenticationAttr::VPtrAuthKeyType::ProcessIndependent)
45214 .Default(std::optional<VTablePointerAuthenticationAttr::VPtrAuthKeyType>());
45215 if (R) {
45216 Out = *R;
45217 return true;
45218 }
45219 return false;
45220 }
45221
45222 const char *VTablePointerAuthenticationAttr::ConvertVPtrAuthKeyTypeToStr(VTablePointerAuthenticationAttr::VPtrAuthKeyType Val) {
45223 switch(Val) {
45224 case VTablePointerAuthenticationAttr::VPtrAuthKeyType::DefaultKey: return "default_key";
45225 case VTablePointerAuthenticationAttr::VPtrAuthKeyType::NoKey: return "no_authentication";
45226 case VTablePointerAuthenticationAttr::VPtrAuthKeyType::ProcessDependent: return "process_dependent";
45227 case VTablePointerAuthenticationAttr::VPtrAuthKeyType::ProcessIndependent: return "process_independent";
45228 }
45229 llvm_unreachable("No enumerator with that value");
45230 }
45231
45232
45233 bool VTablePointerAuthenticationAttr::ConvertStrToAddressDiscriminationMode(StringRef Val, VTablePointerAuthenticationAttr::AddressDiscriminationMode &Out) {
45234 std::optional<VTablePointerAuthenticationAttr::AddressDiscriminationMode> R = llvm::StringSwitch<std::optional<VTablePointerAuthenticationAttr::AddressDiscriminationMode>>(Val)
45235 .Case("default_address_discrimination", VTablePointerAuthenticationAttr::AddressDiscriminationMode::DefaultAddressDiscrimination)
45236 .Case("no_address_discrimination", VTablePointerAuthenticationAttr::AddressDiscriminationMode::NoAddressDiscrimination)
45237 .Case("address_discrimination", VTablePointerAuthenticationAttr::AddressDiscriminationMode::AddressDiscrimination)
45238 .Default(std::optional<VTablePointerAuthenticationAttr::AddressDiscriminationMode>());
45239 if (R) {
45240 Out = *R;
45241 return true;
45242 }
45243 return false;
45244 }
45245
45246 const char *VTablePointerAuthenticationAttr::ConvertAddressDiscriminationModeToStr(VTablePointerAuthenticationAttr::AddressDiscriminationMode Val) {
45247 switch(Val) {
45248 case VTablePointerAuthenticationAttr::AddressDiscriminationMode::DefaultAddressDiscrimination: return "default_address_discrimination";
45249 case VTablePointerAuthenticationAttr::AddressDiscriminationMode::NoAddressDiscrimination: return "no_address_discrimination";
45250 case VTablePointerAuthenticationAttr::AddressDiscriminationMode::AddressDiscrimination: return "address_discrimination";
45251 }
45252 llvm_unreachable("No enumerator with that value");
45253 }
45254
45255
45256 bool VTablePointerAuthenticationAttr::ConvertStrToExtraDiscrimination(StringRef Val, VTablePointerAuthenticationAttr::ExtraDiscrimination &Out) {
45257 std::optional<VTablePointerAuthenticationAttr::ExtraDiscrimination> R = llvm::StringSwitch<std::optional<VTablePointerAuthenticationAttr::ExtraDiscrimination>>(Val)
45258 .Case("default_extra_discrimination", VTablePointerAuthenticationAttr::ExtraDiscrimination::DefaultExtraDiscrimination)
45259 .Case("no_extra_discrimination", VTablePointerAuthenticationAttr::ExtraDiscrimination::NoExtraDiscrimination)
45260 .Case("type_discrimination", VTablePointerAuthenticationAttr::ExtraDiscrimination::TypeDiscrimination)
45261 .Case("custom_discrimination", VTablePointerAuthenticationAttr::ExtraDiscrimination::CustomDiscrimination)
45262 .Default(std::optional<VTablePointerAuthenticationAttr::ExtraDiscrimination>());
45263 if (R) {
45264 Out = *R;
45265 return true;
45266 }
45267 return false;
45268 }
45269
45270 const char *VTablePointerAuthenticationAttr::ConvertExtraDiscriminationToStr(VTablePointerAuthenticationAttr::ExtraDiscrimination Val) {
45271 switch(Val) {
45272 case VTablePointerAuthenticationAttr::ExtraDiscrimination::DefaultExtraDiscrimination: return "default_extra_discrimination";
45273 case VTablePointerAuthenticationAttr::ExtraDiscrimination::NoExtraDiscrimination: return "no_extra_discrimination";
45274 case VTablePointerAuthenticationAttr::ExtraDiscrimination::TypeDiscrimination: return "type_discrimination";
45275 case VTablePointerAuthenticationAttr::ExtraDiscrimination::CustomDiscrimination: return "custom_discrimination";
45276 }
45277 llvm_unreachable("No enumerator with that value");
45278 }
45279
45280
45281 VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::clone(ASTContext &C) const {
45282 auto *A = new (C) VTablePointerAuthenticationAttr(C, *this, key, addressDiscrimination, extraDiscrimination, customDiscriminationValue);
45283 A->Inherited = Inherited;
45284 A->IsPackExpansion = IsPackExpansion;
45285 A->setImplicit(Implicit);
45286 return A;
45287 }
45288
45289 void VTablePointerAuthenticationAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
45290 bool IsFirstArgument = true; (void)IsFirstArgument;
45291 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
45292 switch (getAttributeSpellingListIndex()) {
45293 default:
45294 llvm_unreachable("Unknown attribute spelling!");
45295 break;
45296 case 0 : {
45297 OS << "__attribute__((ptrauth_vtable_pointer";
45298 DelimitAttributeArgument(OS, IsFirstArgument);
45299 OS << "\"" << VTablePointerAuthenticationAttr::ConvertVPtrAuthKeyTypeToStr(getKey()) << "\"";
45300 DelimitAttributeArgument(OS, IsFirstArgument);
45301 OS << "\"" << VTablePointerAuthenticationAttr::ConvertAddressDiscriminationModeToStr(getAddressDiscrimination()) << "\"";
45302 DelimitAttributeArgument(OS, IsFirstArgument);
45303 OS << "\"" << VTablePointerAuthenticationAttr::ConvertExtraDiscriminationToStr(getExtraDiscrimination()) << "\"";
45304 DelimitAttributeArgument(OS, IsFirstArgument);
45305 OS << "" << getCustomDiscriminationValue() << "";
45306 if (!IsFirstArgument)
45307 OS << ")";
45308 OS << "))";
45309 break;
45310 }
45311 case 1 : {
45312 OS << "[[clang::ptrauth_vtable_pointer";
45313 DelimitAttributeArgument(OS, IsFirstArgument);
45314 OS << "\"" << VTablePointerAuthenticationAttr::ConvertVPtrAuthKeyTypeToStr(getKey()) << "\"";
45315 DelimitAttributeArgument(OS, IsFirstArgument);
45316 OS << "\"" << VTablePointerAuthenticationAttr::ConvertAddressDiscriminationModeToStr(getAddressDiscrimination()) << "\"";
45317 DelimitAttributeArgument(OS, IsFirstArgument);
45318 OS << "\"" << VTablePointerAuthenticationAttr::ConvertExtraDiscriminationToStr(getExtraDiscrimination()) << "\"";
45319 DelimitAttributeArgument(OS, IsFirstArgument);
45320 OS << "" << getCustomDiscriminationValue() << "";
45321 if (!IsFirstArgument)
45322 OS << ")";
45323 OS << "]]";
45324 break;
45325 }
45326 case 2 : {
45327 OS << "[[clang::ptrauth_vtable_pointer";
45328 DelimitAttributeArgument(OS, IsFirstArgument);
45329 OS << "\"" << VTablePointerAuthenticationAttr::ConvertVPtrAuthKeyTypeToStr(getKey()) << "\"";
45330 DelimitAttributeArgument(OS, IsFirstArgument);
45331 OS << "\"" << VTablePointerAuthenticationAttr::ConvertAddressDiscriminationModeToStr(getAddressDiscrimination()) << "\"";
45332 DelimitAttributeArgument(OS, IsFirstArgument);
45333 OS << "\"" << VTablePointerAuthenticationAttr::ConvertExtraDiscriminationToStr(getExtraDiscrimination()) << "\"";
45334 DelimitAttributeArgument(OS, IsFirstArgument);
45335 OS << "" << getCustomDiscriminationValue() << "";
45336 if (!IsFirstArgument)
45337 OS << ")";
45338 OS << "]]";
45339 break;
45340 }
45341 }
45342 }
45343
45344 const char *VTablePointerAuthenticationAttr::getSpelling() const {
45345 switch (getAttributeSpellingListIndex()) {
45346 default:
45347 llvm_unreachable("Unknown attribute spelling!");
45348 return "(No spelling)";
45349 case 0:
45350 return "ptrauth_vtable_pointer";
45351 case 1:
45352 return "ptrauth_vtable_pointer";
45353 case 2:
45354 return "ptrauth_vtable_pointer";
45355 }
45356 }
45357
45358
45359 // VecReturnAttr implementation
45360
45361 VecReturnAttr *VecReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
45362 auto *A = new (Ctx) VecReturnAttr(Ctx, CommonInfo);
45363 A->setImplicit(true);
45364 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45365 A->setAttributeSpellingListIndex(0);
45366 return A;
45367 }
45368
45369 VecReturnAttr *VecReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
45370 auto *A = new (Ctx) VecReturnAttr(Ctx, CommonInfo);
45371 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45372 A->setAttributeSpellingListIndex(0);
45373 return A;
45374 }
45375
45376 VecReturnAttr *VecReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
45377 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45378 switch (S) {
45379 case GNU_vecreturn:
45380 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_vecreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45381 case CXX11_clang_vecreturn:
45382 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_vecreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45383 default:
45384 llvm_unreachable("Unknown attribute spelling!");
45385 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45386 }
45387 }());
45388 return CreateImplicit(Ctx, I);
45389 }
45390
45391 VecReturnAttr *VecReturnAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
45392 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45393 switch (S) {
45394 case GNU_vecreturn:
45395 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_vecreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45396 case CXX11_clang_vecreturn:
45397 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_vecreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45398 default:
45399 llvm_unreachable("Unknown attribute spelling!");
45400 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45401 }
45402 }());
45403 return Create(Ctx, I);
45404 }
45405
45406 VecReturnAttr::VecReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45407 )
45408 : InheritableAttr(Ctx, CommonInfo, attr::VecReturn, /*IsLateParsed=*/false, false)
45409 {
45410 }
45411
45412 VecReturnAttr *VecReturnAttr::clone(ASTContext &C) const {
45413 auto *A = new (C) VecReturnAttr(C, *this);
45414 A->Inherited = Inherited;
45415 A->IsPackExpansion = IsPackExpansion;
45416 A->setImplicit(Implicit);
45417 return A;
45418 }
45419
45420 void VecReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
45421 bool IsFirstArgument = true; (void)IsFirstArgument;
45422 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
45423 switch (getAttributeSpellingListIndex()) {
45424 default:
45425 llvm_unreachable("Unknown attribute spelling!");
45426 break;
45427 case 0 : {
45428 OS << "__attribute__((vecreturn";
45429 OS << "))";
45430 break;
45431 }
45432 case 1 : {
45433 OS << "[[clang::vecreturn";
45434 OS << "]]";
45435 break;
45436 }
45437 }
45438 }
45439
45440 const char *VecReturnAttr::getSpelling() const {
45441 switch (getAttributeSpellingListIndex()) {
45442 default:
45443 llvm_unreachable("Unknown attribute spelling!");
45444 return "(No spelling)";
45445 case 0:
45446 return "vecreturn";
45447 case 1:
45448 return "vecreturn";
45449 }
45450 }
45451
45452
45453 // VecTypeHintAttr implementation
45454
45455 VecTypeHintAttr *VecTypeHintAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypeHint, const AttributeCommonInfo &CommonInfo) {
45456 auto *A = new (Ctx) VecTypeHintAttr(Ctx, CommonInfo, TypeHint);
45457 A->setImplicit(true);
45458 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45459 A->setAttributeSpellingListIndex(0);
45460 return A;
45461 }
45462
45463 VecTypeHintAttr *VecTypeHintAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypeHint, const AttributeCommonInfo &CommonInfo) {
45464 auto *A = new (Ctx) VecTypeHintAttr(Ctx, CommonInfo, TypeHint);
45465 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45466 A->setAttributeSpellingListIndex(0);
45467 return A;
45468 }
45469
45470 VecTypeHintAttr *VecTypeHintAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypeHint, SourceRange Range) {
45471 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
45472 return CreateImplicit(Ctx, TypeHint, I);
45473 }
45474
45475 VecTypeHintAttr *VecTypeHintAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypeHint, SourceRange Range) {
45476 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
45477 return Create(Ctx, TypeHint, I);
45478 }
45479
45480 VecTypeHintAttr::VecTypeHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45481 , TypeSourceInfo * TypeHint
45482 )
45483 : InheritableAttr(Ctx, CommonInfo, attr::VecTypeHint, /*IsLateParsed=*/false, false)
45484 , typeHint(TypeHint)
45485 {
45486 }
45487
45488
45489
45490 VecTypeHintAttr *VecTypeHintAttr::clone(ASTContext &C) const {
45491 auto *A = new (C) VecTypeHintAttr(C, *this, typeHint);
45492 A->Inherited = Inherited;
45493 A->IsPackExpansion = IsPackExpansion;
45494 A->setImplicit(Implicit);
45495 return A;
45496 }
45497
45498 void VecTypeHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
45499 bool IsFirstArgument = true; (void)IsFirstArgument;
45500 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
45501 switch (getAttributeSpellingListIndex()) {
45502 default:
45503 llvm_unreachable("Unknown attribute spelling!");
45504 break;
45505 case 0 : {
45506 OS << "__attribute__((vec_type_hint";
45507 DelimitAttributeArgument(OS, IsFirstArgument);
45508 OS << "" << getTypeHint().getAsString() << "";
45509 if (!IsFirstArgument)
45510 OS << ")";
45511 OS << "))";
45512 break;
45513 }
45514 }
45515 }
45516
45517 const char *VecTypeHintAttr::getSpelling() const {
45518 switch (getAttributeSpellingListIndex()) {
45519 default:
45520 llvm_unreachable("Unknown attribute spelling!");
45521 return "(No spelling)";
45522 case 0:
45523 return "vec_type_hint";
45524 }
45525 }
45526
45527
45528 // VectorCallAttr implementation
45529
45530 VectorCallAttr *VectorCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
45531 auto *A = new (Ctx) VectorCallAttr(Ctx, CommonInfo);
45532 A->setImplicit(true);
45533 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45534 A->setAttributeSpellingListIndex(0);
45535 return A;
45536 }
45537
45538 VectorCallAttr *VectorCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
45539 auto *A = new (Ctx) VectorCallAttr(Ctx, CommonInfo);
45540 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45541 A->setAttributeSpellingListIndex(0);
45542 return A;
45543 }
45544
45545 VectorCallAttr *VectorCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
45546 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45547 switch (S) {
45548 case GNU_vectorcall:
45549 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45550 case CXX11_clang_vectorcall:
45551 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45552 case C23_clang_vectorcall:
45553 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45554 case Keyword_vectorcall:
45555 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45556 default:
45557 llvm_unreachable("Unknown attribute spelling!");
45558 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45559 }
45560 }());
45561 return CreateImplicit(Ctx, I);
45562 }
45563
45564 VectorCallAttr *VectorCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
45565 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45566 switch (S) {
45567 case GNU_vectorcall:
45568 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45569 case CXX11_clang_vectorcall:
45570 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45571 case C23_clang_vectorcall:
45572 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45573 case Keyword_vectorcall:
45574 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45575 default:
45576 llvm_unreachable("Unknown attribute spelling!");
45577 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45578 }
45579 }());
45580 return Create(Ctx, I);
45581 }
45582
45583 VectorCallAttr::VectorCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45584 )
45585 : InheritableAttr(Ctx, CommonInfo, attr::VectorCall, /*IsLateParsed=*/false, false)
45586 {
45587 }
45588
45589 VectorCallAttr *VectorCallAttr::clone(ASTContext &C) const {
45590 auto *A = new (C) VectorCallAttr(C, *this);
45591 A->Inherited = Inherited;
45592 A->IsPackExpansion = IsPackExpansion;
45593 A->setImplicit(Implicit);
45594 return A;
45595 }
45596
45597 void VectorCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
45598 bool IsFirstArgument = true; (void)IsFirstArgument;
45599 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
45600 switch (getAttributeSpellingListIndex()) {
45601 default:
45602 llvm_unreachable("Unknown attribute spelling!");
45603 break;
45604 case 0 : {
45605 OS << "__attribute__((vectorcall";
45606 OS << "))";
45607 break;
45608 }
45609 case 1 : {
45610 OS << "[[clang::vectorcall";
45611 OS << "]]";
45612 break;
45613 }
45614 case 2 : {
45615 OS << "[[clang::vectorcall";
45616 OS << "]]";
45617 break;
45618 }
45619 case 3 : {
45620 OS << "__vectorcall";
45621 OS << "";
45622 break;
45623 }
45624 case 4 : {
45625 OS << "_vectorcall";
45626 OS << "";
45627 break;
45628 }
45629 }
45630 }
45631
45632 const char *VectorCallAttr::getSpelling() const {
45633 switch (getAttributeSpellingListIndex()) {
45634 default:
45635 llvm_unreachable("Unknown attribute spelling!");
45636 return "(No spelling)";
45637 case 0:
45638 return "vectorcall";
45639 case 1:
45640 return "vectorcall";
45641 case 2:
45642 return "vectorcall";
45643 case 3:
45644 return "__vectorcall";
45645 case 4:
45646 return "_vectorcall";
45647 }
45648 }
45649
45650
45651 // VisibilityAttr implementation
45652
45653 VisibilityAttr *VisibilityAttr::CreateImplicit(ASTContext &Ctx, VisibilityAttr::VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) {
45654 auto *A = new (Ctx) VisibilityAttr(Ctx, CommonInfo, Visibility);
45655 A->setImplicit(true);
45656 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45657 A->setAttributeSpellingListIndex(0);
45658 return A;
45659 }
45660
45661 VisibilityAttr *VisibilityAttr::Create(ASTContext &Ctx, VisibilityAttr::VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) {
45662 auto *A = new (Ctx) VisibilityAttr(Ctx, CommonInfo, Visibility);
45663 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45664 A->setAttributeSpellingListIndex(0);
45665 return A;
45666 }
45667
45668 VisibilityAttr *VisibilityAttr::CreateImplicit(ASTContext &Ctx, VisibilityAttr::VisibilityType Visibility, SourceRange Range, Spelling S) {
45669 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45670 switch (S) {
45671 case GNU_visibility:
45672 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45673 case CXX11_gnu_visibility:
45674 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45675 case C23_gnu_visibility:
45676 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45677 default:
45678 llvm_unreachable("Unknown attribute spelling!");
45679 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45680 }
45681 }());
45682 return CreateImplicit(Ctx, Visibility, I);
45683 }
45684
45685 VisibilityAttr *VisibilityAttr::Create(ASTContext &Ctx, VisibilityAttr::VisibilityType Visibility, SourceRange Range, Spelling S) {
45686 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45687 switch (S) {
45688 case GNU_visibility:
45689 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45690 case CXX11_gnu_visibility:
45691 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45692 case C23_gnu_visibility:
45693 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45694 default:
45695 llvm_unreachable("Unknown attribute spelling!");
45696 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45697 }
45698 }());
45699 return Create(Ctx, Visibility, I);
45700 }
45701
45702 VisibilityAttr::VisibilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45703 , VisibilityAttr::VisibilityType Visibility
45704 )
45705 : InheritableAttr(Ctx, CommonInfo, attr::Visibility, /*IsLateParsed=*/false, false)
45706 , visibility(Visibility)
45707 {
45708 }
45709
45710
45711
45712 bool VisibilityAttr::ConvertStrToVisibilityType(StringRef Val, VisibilityAttr::VisibilityType &Out) {
45713 std::optional<VisibilityAttr::VisibilityType> R = llvm::StringSwitch<std::optional<VisibilityAttr::VisibilityType>>(Val)
45714 .Case("default", VisibilityAttr::VisibilityType::Default)
45715 .Case("hidden", VisibilityAttr::VisibilityType::Hidden)
45716 .Case("internal", VisibilityAttr::VisibilityType::Hidden)
45717 .Case("protected", VisibilityAttr::VisibilityType::Protected)
45718 .Default(std::optional<VisibilityAttr::VisibilityType>());
45719 if (R) {
45720 Out = *R;
45721 return true;
45722 }
45723 return false;
45724 }
45725
45726 const char *VisibilityAttr::ConvertVisibilityTypeToStr(VisibilityAttr::VisibilityType Val) {
45727 switch(Val) {
45728 case VisibilityAttr::VisibilityType::Default: return "default";
45729 case VisibilityAttr::VisibilityType::Hidden: return "hidden";
45730 case VisibilityAttr::VisibilityType::Protected: return "protected";
45731 }
45732 llvm_unreachable("No enumerator with that value");
45733 }
45734 VisibilityAttr *VisibilityAttr::clone(ASTContext &C) const {
45735 auto *A = new (C) VisibilityAttr(C, *this, visibility);
45736 A->Inherited = Inherited;
45737 A->IsPackExpansion = IsPackExpansion;
45738 A->setImplicit(Implicit);
45739 return A;
45740 }
45741
45742 void VisibilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
45743 bool IsFirstArgument = true; (void)IsFirstArgument;
45744 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
45745 switch (getAttributeSpellingListIndex()) {
45746 default:
45747 llvm_unreachable("Unknown attribute spelling!");
45748 break;
45749 case 0 : {
45750 OS << "__attribute__((visibility";
45751 DelimitAttributeArgument(OS, IsFirstArgument);
45752 OS << "\"" << VisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\"";
45753 if (!IsFirstArgument)
45754 OS << ")";
45755 OS << "))";
45756 break;
45757 }
45758 case 1 : {
45759 OS << "[[gnu::visibility";
45760 DelimitAttributeArgument(OS, IsFirstArgument);
45761 OS << "\"" << VisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\"";
45762 if (!IsFirstArgument)
45763 OS << ")";
45764 OS << "]]";
45765 break;
45766 }
45767 case 2 : {
45768 OS << "[[gnu::visibility";
45769 DelimitAttributeArgument(OS, IsFirstArgument);
45770 OS << "\"" << VisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\"";
45771 if (!IsFirstArgument)
45772 OS << ")";
45773 OS << "]]";
45774 break;
45775 }
45776 }
45777 }
45778
45779 const char *VisibilityAttr::getSpelling() const {
45780 switch (getAttributeSpellingListIndex()) {
45781 default:
45782 llvm_unreachable("Unknown attribute spelling!");
45783 return "(No spelling)";
45784 case 0:
45785 return "visibility";
45786 case 1:
45787 return "visibility";
45788 case 2:
45789 return "visibility";
45790 }
45791 }
45792
45793
45794 // WarnUnusedAttr implementation
45795
45796 WarnUnusedAttr *WarnUnusedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
45797 auto *A = new (Ctx) WarnUnusedAttr(Ctx, CommonInfo);
45798 A->setImplicit(true);
45799 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45800 A->setAttributeSpellingListIndex(0);
45801 return A;
45802 }
45803
45804 WarnUnusedAttr *WarnUnusedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
45805 auto *A = new (Ctx) WarnUnusedAttr(Ctx, CommonInfo);
45806 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45807 A->setAttributeSpellingListIndex(0);
45808 return A;
45809 }
45810
45811 WarnUnusedAttr *WarnUnusedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
45812 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45813 switch (S) {
45814 case GNU_warn_unused:
45815 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45816 case CXX11_gnu_warn_unused:
45817 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45818 case C23_gnu_warn_unused:
45819 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45820 default:
45821 llvm_unreachable("Unknown attribute spelling!");
45822 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45823 }
45824 }());
45825 return CreateImplicit(Ctx, I);
45826 }
45827
45828 WarnUnusedAttr *WarnUnusedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
45829 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45830 switch (S) {
45831 case GNU_warn_unused:
45832 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45833 case CXX11_gnu_warn_unused:
45834 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45835 case C23_gnu_warn_unused:
45836 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45837 default:
45838 llvm_unreachable("Unknown attribute spelling!");
45839 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45840 }
45841 }());
45842 return Create(Ctx, I);
45843 }
45844
45845 WarnUnusedAttr::WarnUnusedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45846 )
45847 : InheritableAttr(Ctx, CommonInfo, attr::WarnUnused, /*IsLateParsed=*/false, false)
45848 {
45849 }
45850
45851 WarnUnusedAttr *WarnUnusedAttr::clone(ASTContext &C) const {
45852 auto *A = new (C) WarnUnusedAttr(C, *this);
45853 A->Inherited = Inherited;
45854 A->IsPackExpansion = IsPackExpansion;
45855 A->setImplicit(Implicit);
45856 return A;
45857 }
45858
45859 void WarnUnusedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
45860 bool IsFirstArgument = true; (void)IsFirstArgument;
45861 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
45862 switch (getAttributeSpellingListIndex()) {
45863 default:
45864 llvm_unreachable("Unknown attribute spelling!");
45865 break;
45866 case 0 : {
45867 OS << "__attribute__((warn_unused";
45868 OS << "))";
45869 break;
45870 }
45871 case 1 : {
45872 OS << "[[gnu::warn_unused";
45873 OS << "]]";
45874 break;
45875 }
45876 case 2 : {
45877 OS << "[[gnu::warn_unused";
45878 OS << "]]";
45879 break;
45880 }
45881 }
45882 }
45883
45884 const char *WarnUnusedAttr::getSpelling() const {
45885 switch (getAttributeSpellingListIndex()) {
45886 default:
45887 llvm_unreachable("Unknown attribute spelling!");
45888 return "(No spelling)";
45889 case 0:
45890 return "warn_unused";
45891 case 1:
45892 return "warn_unused";
45893 case 2:
45894 return "warn_unused";
45895 }
45896 }
45897
45898
45899 // WarnUnusedResultAttr implementation
45900
45901 WarnUnusedResultAttr *WarnUnusedResultAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) {
45902 auto *A = new (Ctx) WarnUnusedResultAttr(Ctx, CommonInfo, Message);
45903 A->setImplicit(true);
45904 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
45905 A->setAttributeSpellingListIndex(0);
45906 return A;
45907 }
45908
45909 WarnUnusedResultAttr *WarnUnusedResultAttr::Create(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) {
45910 auto *A = new (Ctx) WarnUnusedResultAttr(Ctx, CommonInfo, Message);
45911 return A;
45912 }
45913
45914 WarnUnusedResultAttr *WarnUnusedResultAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) {
45915 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45916 switch (S) {
45917 case CXX11_nodiscard:
45918 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_nodiscard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45919 case C23_nodiscard:
45920 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_nodiscard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45921 case CXX11_clang_warn_unused_result:
45922 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45923 case GNU_warn_unused_result:
45924 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45925 case CXX11_gnu_warn_unused_result:
45926 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45927 case C23_gnu_warn_unused_result:
45928 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45929 default:
45930 llvm_unreachable("Unknown attribute spelling!");
45931 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45932 }
45933 }());
45934 return CreateImplicit(Ctx, Message, I);
45935 }
45936
45937 WarnUnusedResultAttr *WarnUnusedResultAttr::Create(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) {
45938 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
45939 switch (S) {
45940 case CXX11_nodiscard:
45941 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_nodiscard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45942 case C23_nodiscard:
45943 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_nodiscard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45944 case CXX11_clang_warn_unused_result:
45945 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45946 case GNU_warn_unused_result:
45947 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45948 case CXX11_gnu_warn_unused_result:
45949 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45950 case C23_gnu_warn_unused_result:
45951 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45952 default:
45953 llvm_unreachable("Unknown attribute spelling!");
45954 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
45955 }
45956 }());
45957 return Create(Ctx, Message, I);
45958 }
45959
45960 WarnUnusedResultAttr::WarnUnusedResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45961 , llvm::StringRef Message
45962 )
45963 : InheritableAttr(Ctx, CommonInfo, attr::WarnUnusedResult, /*IsLateParsed=*/false, false)
45964 , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
45965 {
45966 if (!Message.empty())
45967 std::memcpy(message, Message.data(), messageLength);
45968 }
45969
45970 WarnUnusedResultAttr::WarnUnusedResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
45971 )
45972 : InheritableAttr(Ctx, CommonInfo, attr::WarnUnusedResult, /*IsLateParsed=*/false, false)
45973 , messageLength(0),message(nullptr)
45974 {
45975 }
45976
45977 WarnUnusedResultAttr::Spelling WarnUnusedResultAttr::getSemanticSpelling() const {
45978 switch (getAttributeSpellingListIndex()) {
45979 default: llvm_unreachable("Unknown spelling list index");
45980 case 0: return CXX11_nodiscard;
45981 case 1: return C23_nodiscard;
45982 case 2: return CXX11_clang_warn_unused_result;
45983 case 3: return GNU_warn_unused_result;
45984 case 4: return CXX11_gnu_warn_unused_result;
45985 case 5: return C23_gnu_warn_unused_result;
45986 }
45987 }
45988
45989
45990 WarnUnusedResultAttr *WarnUnusedResultAttr::clone(ASTContext &C) const {
45991 auto *A = new (C) WarnUnusedResultAttr(C, *this, getMessage());
45992 A->Inherited = Inherited;
45993 A->IsPackExpansion = IsPackExpansion;
45994 A->setImplicit(Implicit);
45995 return A;
45996 }
45997
45998 void WarnUnusedResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
45999 bool IsFirstArgument = true; (void)IsFirstArgument;
46000 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
46001 switch (getAttributeSpellingListIndex()) {
46002 default:
46003 llvm_unreachable("Unknown attribute spelling!");
46004 break;
46005 case 0 : {
46006 OS << "[[nodiscard";
46007 DelimitAttributeArgument(OS, IsFirstArgument);
46008 OS << "\"" << getMessage() << "\"";
46009 if (!IsFirstArgument)
46010 OS << ")";
46011 OS << "]]";
46012 break;
46013 }
46014 case 1 : {
46015 OS << "[[nodiscard";
46016 DelimitAttributeArgument(OS, IsFirstArgument);
46017 OS << "\"" << getMessage() << "\"";
46018 if (!IsFirstArgument)
46019 OS << ")";
46020 OS << "]]";
46021 break;
46022 }
46023 case 2 : {
46024 OS << "[[clang::warn_unused_result";
46025 DelimitAttributeArgument(OS, IsFirstArgument);
46026 OS << "\"" << getMessage() << "\"";
46027 if (!IsFirstArgument)
46028 OS << ")";
46029 OS << "]]";
46030 break;
46031 }
46032 case 3 : {
46033 OS << "__attribute__((warn_unused_result";
46034 DelimitAttributeArgument(OS, IsFirstArgument);
46035 OS << "\"" << getMessage() << "\"";
46036 if (!IsFirstArgument)
46037 OS << ")";
46038 OS << "))";
46039 break;
46040 }
46041 case 4 : {
46042 OS << "[[gnu::warn_unused_result";
46043 DelimitAttributeArgument(OS, IsFirstArgument);
46044 OS << "\"" << getMessage() << "\"";
46045 if (!IsFirstArgument)
46046 OS << ")";
46047 OS << "]]";
46048 break;
46049 }
46050 case 5 : {
46051 OS << "[[gnu::warn_unused_result";
46052 DelimitAttributeArgument(OS, IsFirstArgument);
46053 OS << "\"" << getMessage() << "\"";
46054 if (!IsFirstArgument)
46055 OS << ")";
46056 OS << "]]";
46057 break;
46058 }
46059 }
46060 }
46061
46062 const char *WarnUnusedResultAttr::getSpelling() const {
46063 switch (getAttributeSpellingListIndex()) {
46064 default:
46065 llvm_unreachable("Unknown attribute spelling!");
46066 return "(No spelling)";
46067 case 0:
46068 return "nodiscard";
46069 case 1:
46070 return "nodiscard";
46071 case 2:
46072 return "warn_unused_result";
46073 case 3:
46074 return "warn_unused_result";
46075 case 4:
46076 return "warn_unused_result";
46077 case 5:
46078 return "warn_unused_result";
46079 }
46080 }
46081
46082
46083 // WeakAttr implementation
46084
46085 WeakAttr *WeakAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
46086 auto *A = new (Ctx) WeakAttr(Ctx, CommonInfo);
46087 A->setImplicit(true);
46088 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46089 A->setAttributeSpellingListIndex(0);
46090 return A;
46091 }
46092
46093 WeakAttr *WeakAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
46094 auto *A = new (Ctx) WeakAttr(Ctx, CommonInfo);
46095 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46096 A->setAttributeSpellingListIndex(0);
46097 return A;
46098 }
46099
46100 WeakAttr *WeakAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
46101 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46102 switch (S) {
46103 case GNU_weak:
46104 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46105 case CXX11_gnu_weak:
46106 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46107 case C23_gnu_weak:
46108 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46109 default:
46110 llvm_unreachable("Unknown attribute spelling!");
46111 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46112 }
46113 }());
46114 return CreateImplicit(Ctx, I);
46115 }
46116
46117 WeakAttr *WeakAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
46118 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46119 switch (S) {
46120 case GNU_weak:
46121 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46122 case CXX11_gnu_weak:
46123 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46124 case C23_gnu_weak:
46125 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46126 default:
46127 llvm_unreachable("Unknown attribute spelling!");
46128 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46129 }
46130 }());
46131 return Create(Ctx, I);
46132 }
46133
46134 WeakAttr::WeakAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46135 )
46136 : InheritableAttr(Ctx, CommonInfo, attr::Weak, /*IsLateParsed=*/false, false)
46137 {
46138 }
46139
46140 WeakAttr *WeakAttr::clone(ASTContext &C) const {
46141 auto *A = new (C) WeakAttr(C, *this);
46142 A->Inherited = Inherited;
46143 A->IsPackExpansion = IsPackExpansion;
46144 A->setImplicit(Implicit);
46145 return A;
46146 }
46147
46148 void WeakAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
46149 bool IsFirstArgument = true; (void)IsFirstArgument;
46150 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
46151 switch (getAttributeSpellingListIndex()) {
46152 default:
46153 llvm_unreachable("Unknown attribute spelling!");
46154 break;
46155 case 0 : {
46156 OS << "__attribute__((weak";
46157 OS << "))";
46158 break;
46159 }
46160 case 1 : {
46161 OS << "[[gnu::weak";
46162 OS << "]]";
46163 break;
46164 }
46165 case 2 : {
46166 OS << "[[gnu::weak";
46167 OS << "]]";
46168 break;
46169 }
46170 }
46171 }
46172
46173 const char *WeakAttr::getSpelling() const {
46174 switch (getAttributeSpellingListIndex()) {
46175 default:
46176 llvm_unreachable("Unknown attribute spelling!");
46177 return "(No spelling)";
46178 case 0:
46179 return "weak";
46180 case 1:
46181 return "weak";
46182 case 2:
46183 return "weak";
46184 }
46185 }
46186
46187
46188 // WeakImportAttr implementation
46189
46190 WeakImportAttr *WeakImportAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
46191 auto *A = new (Ctx) WeakImportAttr(Ctx, CommonInfo);
46192 A->setImplicit(true);
46193 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46194 A->setAttributeSpellingListIndex(0);
46195 return A;
46196 }
46197
46198 WeakImportAttr *WeakImportAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
46199 auto *A = new (Ctx) WeakImportAttr(Ctx, CommonInfo);
46200 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46201 A->setAttributeSpellingListIndex(0);
46202 return A;
46203 }
46204
46205 WeakImportAttr *WeakImportAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
46206 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46207 switch (S) {
46208 case GNU_weak_import:
46209 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46210 case CXX11_clang_weak_import:
46211 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46212 case C23_clang_weak_import:
46213 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46214 default:
46215 llvm_unreachable("Unknown attribute spelling!");
46216 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46217 }
46218 }());
46219 return CreateImplicit(Ctx, I);
46220 }
46221
46222 WeakImportAttr *WeakImportAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
46223 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46224 switch (S) {
46225 case GNU_weak_import:
46226 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46227 case CXX11_clang_weak_import:
46228 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46229 case C23_clang_weak_import:
46230 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46231 default:
46232 llvm_unreachable("Unknown attribute spelling!");
46233 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46234 }
46235 }());
46236 return Create(Ctx, I);
46237 }
46238
46239 WeakImportAttr::WeakImportAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46240 )
46241 : InheritableAttr(Ctx, CommonInfo, attr::WeakImport, /*IsLateParsed=*/false, false)
46242 {
46243 }
46244
46245 WeakImportAttr *WeakImportAttr::clone(ASTContext &C) const {
46246 auto *A = new (C) WeakImportAttr(C, *this);
46247 A->Inherited = Inherited;
46248 A->IsPackExpansion = IsPackExpansion;
46249 A->setImplicit(Implicit);
46250 return A;
46251 }
46252
46253 void WeakImportAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
46254 bool IsFirstArgument = true; (void)IsFirstArgument;
46255 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
46256 switch (getAttributeSpellingListIndex()) {
46257 default:
46258 llvm_unreachable("Unknown attribute spelling!");
46259 break;
46260 case 0 : {
46261 OS << "__attribute__((weak_import";
46262 OS << "))";
46263 break;
46264 }
46265 case 1 : {
46266 OS << "[[clang::weak_import";
46267 OS << "]]";
46268 break;
46269 }
46270 case 2 : {
46271 OS << "[[clang::weak_import";
46272 OS << "]]";
46273 break;
46274 }
46275 }
46276 }
46277
46278 const char *WeakImportAttr::getSpelling() const {
46279 switch (getAttributeSpellingListIndex()) {
46280 default:
46281 llvm_unreachable("Unknown attribute spelling!");
46282 return "(No spelling)";
46283 case 0:
46284 return "weak_import";
46285 case 1:
46286 return "weak_import";
46287 case 2:
46288 return "weak_import";
46289 }
46290 }
46291
46292
46293 // WeakRefAttr implementation
46294
46295 WeakRefAttr *WeakRefAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) {
46296 auto *A = new (Ctx) WeakRefAttr(Ctx, CommonInfo, Aliasee);
46297 A->setImplicit(true);
46298 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46299 A->setAttributeSpellingListIndex(0);
46300 return A;
46301 }
46302
46303 WeakRefAttr *WeakRefAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) {
46304 auto *A = new (Ctx) WeakRefAttr(Ctx, CommonInfo, Aliasee);
46305 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46306 A->setAttributeSpellingListIndex(0);
46307 return A;
46308 }
46309
46310 WeakRefAttr *WeakRefAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, Spelling S) {
46311 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46312 switch (S) {
46313 case GNU_weakref:
46314 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46315 case CXX11_gnu_weakref:
46316 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46317 case C23_gnu_weakref:
46318 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46319 default:
46320 llvm_unreachable("Unknown attribute spelling!");
46321 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46322 }
46323 }());
46324 return CreateImplicit(Ctx, Aliasee, I);
46325 }
46326
46327 WeakRefAttr *WeakRefAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, Spelling S) {
46328 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46329 switch (S) {
46330 case GNU_weakref:
46331 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46332 case CXX11_gnu_weakref:
46333 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46334 case C23_gnu_weakref:
46335 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46336 default:
46337 llvm_unreachable("Unknown attribute spelling!");
46338 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46339 }
46340 }());
46341 return Create(Ctx, Aliasee, I);
46342 }
46343
46344 WeakRefAttr::WeakRefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46345 , llvm::StringRef Aliasee
46346 )
46347 : InheritableAttr(Ctx, CommonInfo, attr::WeakRef, /*IsLateParsed=*/false, false)
46348 , aliaseeLength(Aliasee.size()),aliasee(new (Ctx, 1) char[aliaseeLength])
46349 {
46350 if (!Aliasee.empty())
46351 std::memcpy(aliasee, Aliasee.data(), aliaseeLength);
46352 }
46353
46354 WeakRefAttr::WeakRefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46355 )
46356 : InheritableAttr(Ctx, CommonInfo, attr::WeakRef, /*IsLateParsed=*/false, false)
46357 , aliaseeLength(0),aliasee(nullptr)
46358 {
46359 }
46360
46361
46362
46363 WeakRefAttr *WeakRefAttr::clone(ASTContext &C) const {
46364 auto *A = new (C) WeakRefAttr(C, *this, getAliasee());
46365 A->Inherited = Inherited;
46366 A->IsPackExpansion = IsPackExpansion;
46367 A->setImplicit(Implicit);
46368 return A;
46369 }
46370
46371 void WeakRefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
46372 bool IsFirstArgument = true; (void)IsFirstArgument;
46373 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
46374 switch (getAttributeSpellingListIndex()) {
46375 default:
46376 llvm_unreachable("Unknown attribute spelling!");
46377 break;
46378 case 0 : {
46379 OS << "__attribute__((weakref";
46380 DelimitAttributeArgument(OS, IsFirstArgument);
46381 OS << "\"" << getAliasee() << "\"";
46382 if (!IsFirstArgument)
46383 OS << ")";
46384 OS << "))";
46385 break;
46386 }
46387 case 1 : {
46388 OS << "[[gnu::weakref";
46389 DelimitAttributeArgument(OS, IsFirstArgument);
46390 OS << "\"" << getAliasee() << "\"";
46391 if (!IsFirstArgument)
46392 OS << ")";
46393 OS << "]]";
46394 break;
46395 }
46396 case 2 : {
46397 OS << "[[gnu::weakref";
46398 DelimitAttributeArgument(OS, IsFirstArgument);
46399 OS << "\"" << getAliasee() << "\"";
46400 if (!IsFirstArgument)
46401 OS << ")";
46402 OS << "]]";
46403 break;
46404 }
46405 }
46406 }
46407
46408 const char *WeakRefAttr::getSpelling() const {
46409 switch (getAttributeSpellingListIndex()) {
46410 default:
46411 llvm_unreachable("Unknown attribute spelling!");
46412 return "(No spelling)";
46413 case 0:
46414 return "weakref";
46415 case 1:
46416 return "weakref";
46417 case 2:
46418 return "weakref";
46419 }
46420 }
46421
46422
46423 // WebAssemblyExportNameAttr implementation
46424
46425 WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ExportName, const AttributeCommonInfo &CommonInfo) {
46426 auto *A = new (Ctx) WebAssemblyExportNameAttr(Ctx, CommonInfo, ExportName);
46427 A->setImplicit(true);
46428 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46429 A->setAttributeSpellingListIndex(0);
46430 return A;
46431 }
46432
46433 WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ExportName, const AttributeCommonInfo &CommonInfo) {
46434 auto *A = new (Ctx) WebAssemblyExportNameAttr(Ctx, CommonInfo, ExportName);
46435 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46436 A->setAttributeSpellingListIndex(0);
46437 return A;
46438 }
46439
46440 WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ExportName, SourceRange Range, Spelling S) {
46441 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46442 switch (S) {
46443 case GNU_export_name:
46444 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46445 case CXX11_clang_export_name:
46446 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46447 case C23_clang_export_name:
46448 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46449 default:
46450 llvm_unreachable("Unknown attribute spelling!");
46451 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46452 }
46453 }());
46454 return CreateImplicit(Ctx, ExportName, I);
46455 }
46456
46457 WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ExportName, SourceRange Range, Spelling S) {
46458 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46459 switch (S) {
46460 case GNU_export_name:
46461 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46462 case CXX11_clang_export_name:
46463 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46464 case C23_clang_export_name:
46465 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46466 default:
46467 llvm_unreachable("Unknown attribute spelling!");
46468 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46469 }
46470 }());
46471 return Create(Ctx, ExportName, I);
46472 }
46473
46474 WebAssemblyExportNameAttr::WebAssemblyExportNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46475 , llvm::StringRef ExportName
46476 )
46477 : InheritableAttr(Ctx, CommonInfo, attr::WebAssemblyExportName, /*IsLateParsed=*/false, false)
46478 , exportNameLength(ExportName.size()),exportName(new (Ctx, 1) char[exportNameLength])
46479 {
46480 if (!ExportName.empty())
46481 std::memcpy(exportName, ExportName.data(), exportNameLength);
46482 }
46483
46484
46485
46486 WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::clone(ASTContext &C) const {
46487 auto *A = new (C) WebAssemblyExportNameAttr(C, *this, getExportName());
46488 A->Inherited = Inherited;
46489 A->IsPackExpansion = IsPackExpansion;
46490 A->setImplicit(Implicit);
46491 return A;
46492 }
46493
46494 void WebAssemblyExportNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
46495 bool IsFirstArgument = true; (void)IsFirstArgument;
46496 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
46497 switch (getAttributeSpellingListIndex()) {
46498 default:
46499 llvm_unreachable("Unknown attribute spelling!");
46500 break;
46501 case 0 : {
46502 OS << "__attribute__((export_name";
46503 DelimitAttributeArgument(OS, IsFirstArgument);
46504 OS << "\"" << getExportName() << "\"";
46505 if (!IsFirstArgument)
46506 OS << ")";
46507 OS << "))";
46508 break;
46509 }
46510 case 1 : {
46511 OS << "[[clang::export_name";
46512 DelimitAttributeArgument(OS, IsFirstArgument);
46513 OS << "\"" << getExportName() << "\"";
46514 if (!IsFirstArgument)
46515 OS << ")";
46516 OS << "]]";
46517 break;
46518 }
46519 case 2 : {
46520 OS << "[[clang::export_name";
46521 DelimitAttributeArgument(OS, IsFirstArgument);
46522 OS << "\"" << getExportName() << "\"";
46523 if (!IsFirstArgument)
46524 OS << ")";
46525 OS << "]]";
46526 break;
46527 }
46528 }
46529 }
46530
46531 const char *WebAssemblyExportNameAttr::getSpelling() const {
46532 switch (getAttributeSpellingListIndex()) {
46533 default:
46534 llvm_unreachable("Unknown attribute spelling!");
46535 return "(No spelling)";
46536 case 0:
46537 return "export_name";
46538 case 1:
46539 return "export_name";
46540 case 2:
46541 return "export_name";
46542 }
46543 }
46544
46545
46546 // WebAssemblyFuncrefAttr implementation
46547
46548 WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
46549 auto *A = new (Ctx) WebAssemblyFuncrefAttr(Ctx, CommonInfo);
46550 A->setImplicit(true);
46551 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46552 A->setAttributeSpellingListIndex(0);
46553 return A;
46554 }
46555
46556 WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
46557 auto *A = new (Ctx) WebAssemblyFuncrefAttr(Ctx, CommonInfo);
46558 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46559 A->setAttributeSpellingListIndex(0);
46560 return A;
46561 }
46562
46563 WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) {
46564 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
46565 return CreateImplicit(Ctx, I);
46566 }
46567
46568 WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::Create(ASTContext &Ctx, SourceRange Range) {
46569 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
46570 return Create(Ctx, I);
46571 }
46572
46573 WebAssemblyFuncrefAttr::WebAssemblyFuncrefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46574 )
46575 : TypeAttr(Ctx, CommonInfo, attr::WebAssemblyFuncref, /*IsLateParsed=*/false)
46576 {
46577 }
46578
46579 WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::clone(ASTContext &C) const {
46580 auto *A = new (C) WebAssemblyFuncrefAttr(C, *this);
46581 A->Inherited = Inherited;
46582 A->IsPackExpansion = IsPackExpansion;
46583 A->setImplicit(Implicit);
46584 return A;
46585 }
46586
46587 void WebAssemblyFuncrefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
46588 bool IsFirstArgument = true; (void)IsFirstArgument;
46589 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
46590 switch (getAttributeSpellingListIndex()) {
46591 default:
46592 llvm_unreachable("Unknown attribute spelling!");
46593 break;
46594 case 0 : {
46595 OS << "__funcref";
46596 OS << "";
46597 break;
46598 }
46599 }
46600 }
46601
46602 const char *WebAssemblyFuncrefAttr::getSpelling() const {
46603 switch (getAttributeSpellingListIndex()) {
46604 default:
46605 llvm_unreachable("Unknown attribute spelling!");
46606 return "(No spelling)";
46607 case 0:
46608 return "__funcref";
46609 }
46610 }
46611
46612
46613 // WebAssemblyImportModuleAttr implementation
46614
46615 WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportModule, const AttributeCommonInfo &CommonInfo) {
46616 auto *A = new (Ctx) WebAssemblyImportModuleAttr(Ctx, CommonInfo, ImportModule);
46617 A->setImplicit(true);
46618 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46619 A->setAttributeSpellingListIndex(0);
46620 return A;
46621 }
46622
46623 WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::Create(ASTContext &Ctx, llvm::StringRef ImportModule, const AttributeCommonInfo &CommonInfo) {
46624 auto *A = new (Ctx) WebAssemblyImportModuleAttr(Ctx, CommonInfo, ImportModule);
46625 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46626 A->setAttributeSpellingListIndex(0);
46627 return A;
46628 }
46629
46630 WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportModule, SourceRange Range, Spelling S) {
46631 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46632 switch (S) {
46633 case GNU_import_module:
46634 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46635 case CXX11_clang_import_module:
46636 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46637 case C23_clang_import_module:
46638 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46639 default:
46640 llvm_unreachable("Unknown attribute spelling!");
46641 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46642 }
46643 }());
46644 return CreateImplicit(Ctx, ImportModule, I);
46645 }
46646
46647 WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::Create(ASTContext &Ctx, llvm::StringRef ImportModule, SourceRange Range, Spelling S) {
46648 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46649 switch (S) {
46650 case GNU_import_module:
46651 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46652 case CXX11_clang_import_module:
46653 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46654 case C23_clang_import_module:
46655 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46656 default:
46657 llvm_unreachable("Unknown attribute spelling!");
46658 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46659 }
46660 }());
46661 return Create(Ctx, ImportModule, I);
46662 }
46663
46664 WebAssemblyImportModuleAttr::WebAssemblyImportModuleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46665 , llvm::StringRef ImportModule
46666 )
46667 : InheritableAttr(Ctx, CommonInfo, attr::WebAssemblyImportModule, /*IsLateParsed=*/false, false)
46668 , importModuleLength(ImportModule.size()),importModule(new (Ctx, 1) char[importModuleLength])
46669 {
46670 if (!ImportModule.empty())
46671 std::memcpy(importModule, ImportModule.data(), importModuleLength);
46672 }
46673
46674
46675
46676 WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::clone(ASTContext &C) const {
46677 auto *A = new (C) WebAssemblyImportModuleAttr(C, *this, getImportModule());
46678 A->Inherited = Inherited;
46679 A->IsPackExpansion = IsPackExpansion;
46680 A->setImplicit(Implicit);
46681 return A;
46682 }
46683
46684 void WebAssemblyImportModuleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
46685 bool IsFirstArgument = true; (void)IsFirstArgument;
46686 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
46687 switch (getAttributeSpellingListIndex()) {
46688 default:
46689 llvm_unreachable("Unknown attribute spelling!");
46690 break;
46691 case 0 : {
46692 OS << "__attribute__((import_module";
46693 DelimitAttributeArgument(OS, IsFirstArgument);
46694 OS << "\"" << getImportModule() << "\"";
46695 if (!IsFirstArgument)
46696 OS << ")";
46697 OS << "))";
46698 break;
46699 }
46700 case 1 : {
46701 OS << "[[clang::import_module";
46702 DelimitAttributeArgument(OS, IsFirstArgument);
46703 OS << "\"" << getImportModule() << "\"";
46704 if (!IsFirstArgument)
46705 OS << ")";
46706 OS << "]]";
46707 break;
46708 }
46709 case 2 : {
46710 OS << "[[clang::import_module";
46711 DelimitAttributeArgument(OS, IsFirstArgument);
46712 OS << "\"" << getImportModule() << "\"";
46713 if (!IsFirstArgument)
46714 OS << ")";
46715 OS << "]]";
46716 break;
46717 }
46718 }
46719 }
46720
46721 const char *WebAssemblyImportModuleAttr::getSpelling() const {
46722 switch (getAttributeSpellingListIndex()) {
46723 default:
46724 llvm_unreachable("Unknown attribute spelling!");
46725 return "(No spelling)";
46726 case 0:
46727 return "import_module";
46728 case 1:
46729 return "import_module";
46730 case 2:
46731 return "import_module";
46732 }
46733 }
46734
46735
46736 // WebAssemblyImportNameAttr implementation
46737
46738 WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportName, const AttributeCommonInfo &CommonInfo) {
46739 auto *A = new (Ctx) WebAssemblyImportNameAttr(Ctx, CommonInfo, ImportName);
46740 A->setImplicit(true);
46741 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46742 A->setAttributeSpellingListIndex(0);
46743 return A;
46744 }
46745
46746 WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ImportName, const AttributeCommonInfo &CommonInfo) {
46747 auto *A = new (Ctx) WebAssemblyImportNameAttr(Ctx, CommonInfo, ImportName);
46748 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46749 A->setAttributeSpellingListIndex(0);
46750 return A;
46751 }
46752
46753 WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportName, SourceRange Range, Spelling S) {
46754 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46755 switch (S) {
46756 case GNU_import_name:
46757 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46758 case CXX11_clang_import_name:
46759 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46760 case C23_clang_import_name:
46761 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46762 default:
46763 llvm_unreachable("Unknown attribute spelling!");
46764 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46765 }
46766 }());
46767 return CreateImplicit(Ctx, ImportName, I);
46768 }
46769
46770 WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ImportName, SourceRange Range, Spelling S) {
46771 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46772 switch (S) {
46773 case GNU_import_name:
46774 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46775 case CXX11_clang_import_name:
46776 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46777 case C23_clang_import_name:
46778 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46779 default:
46780 llvm_unreachable("Unknown attribute spelling!");
46781 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46782 }
46783 }());
46784 return Create(Ctx, ImportName, I);
46785 }
46786
46787 WebAssemblyImportNameAttr::WebAssemblyImportNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46788 , llvm::StringRef ImportName
46789 )
46790 : InheritableAttr(Ctx, CommonInfo, attr::WebAssemblyImportName, /*IsLateParsed=*/false, false)
46791 , importNameLength(ImportName.size()),importName(new (Ctx, 1) char[importNameLength])
46792 {
46793 if (!ImportName.empty())
46794 std::memcpy(importName, ImportName.data(), importNameLength);
46795 }
46796
46797
46798
46799 WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::clone(ASTContext &C) const {
46800 auto *A = new (C) WebAssemblyImportNameAttr(C, *this, getImportName());
46801 A->Inherited = Inherited;
46802 A->IsPackExpansion = IsPackExpansion;
46803 A->setImplicit(Implicit);
46804 return A;
46805 }
46806
46807 void WebAssemblyImportNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
46808 bool IsFirstArgument = true; (void)IsFirstArgument;
46809 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
46810 switch (getAttributeSpellingListIndex()) {
46811 default:
46812 llvm_unreachable("Unknown attribute spelling!");
46813 break;
46814 case 0 : {
46815 OS << "__attribute__((import_name";
46816 DelimitAttributeArgument(OS, IsFirstArgument);
46817 OS << "\"" << getImportName() << "\"";
46818 if (!IsFirstArgument)
46819 OS << ")";
46820 OS << "))";
46821 break;
46822 }
46823 case 1 : {
46824 OS << "[[clang::import_name";
46825 DelimitAttributeArgument(OS, IsFirstArgument);
46826 OS << "\"" << getImportName() << "\"";
46827 if (!IsFirstArgument)
46828 OS << ")";
46829 OS << "]]";
46830 break;
46831 }
46832 case 2 : {
46833 OS << "[[clang::import_name";
46834 DelimitAttributeArgument(OS, IsFirstArgument);
46835 OS << "\"" << getImportName() << "\"";
46836 if (!IsFirstArgument)
46837 OS << ")";
46838 OS << "]]";
46839 break;
46840 }
46841 }
46842 }
46843
46844 const char *WebAssemblyImportNameAttr::getSpelling() const {
46845 switch (getAttributeSpellingListIndex()) {
46846 default:
46847 llvm_unreachable("Unknown attribute spelling!");
46848 return "(No spelling)";
46849 case 0:
46850 return "import_name";
46851 case 1:
46852 return "import_name";
46853 case 2:
46854 return "import_name";
46855 }
46856 }
46857
46858
46859 // WorkGroupSizeHintAttr implementation
46860
46861 WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) {
46862 auto *A = new (Ctx) WorkGroupSizeHintAttr(Ctx, CommonInfo, XDim, YDim, ZDim);
46863 A->setImplicit(true);
46864 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46865 A->setAttributeSpellingListIndex(0);
46866 return A;
46867 }
46868
46869 WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) {
46870 auto *A = new (Ctx) WorkGroupSizeHintAttr(Ctx, CommonInfo, XDim, YDim, ZDim);
46871 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46872 A->setAttributeSpellingListIndex(0);
46873 return A;
46874 }
46875
46876 WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range) {
46877 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
46878 return CreateImplicit(Ctx, XDim, YDim, ZDim, I);
46879 }
46880
46881 WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range) {
46882 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/});
46883 return Create(Ctx, XDim, YDim, ZDim, I);
46884 }
46885
46886 WorkGroupSizeHintAttr::WorkGroupSizeHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46887 , unsigned XDim
46888 , unsigned YDim
46889 , unsigned ZDim
46890 )
46891 : InheritableAttr(Ctx, CommonInfo, attr::WorkGroupSizeHint, /*IsLateParsed=*/false, false)
46892 , xDim(XDim)
46893 , yDim(YDim)
46894 , zDim(ZDim)
46895 {
46896 }
46897
46898
46899
46900
46901
46902
46903
46904 WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::clone(ASTContext &C) const {
46905 auto *A = new (C) WorkGroupSizeHintAttr(C, *this, xDim, yDim, zDim);
46906 A->Inherited = Inherited;
46907 A->IsPackExpansion = IsPackExpansion;
46908 A->setImplicit(Implicit);
46909 return A;
46910 }
46911
46912 void WorkGroupSizeHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
46913 bool IsFirstArgument = true; (void)IsFirstArgument;
46914 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
46915 switch (getAttributeSpellingListIndex()) {
46916 default:
46917 llvm_unreachable("Unknown attribute spelling!");
46918 break;
46919 case 0 : {
46920 OS << "__attribute__((work_group_size_hint";
46921 DelimitAttributeArgument(OS, IsFirstArgument);
46922 OS << "" << getXDim() << "";
46923 DelimitAttributeArgument(OS, IsFirstArgument);
46924 OS << "" << getYDim() << "";
46925 DelimitAttributeArgument(OS, IsFirstArgument);
46926 OS << "" << getZDim() << "";
46927 if (!IsFirstArgument)
46928 OS << ")";
46929 OS << "))";
46930 break;
46931 }
46932 }
46933 }
46934
46935 const char *WorkGroupSizeHintAttr::getSpelling() const {
46936 switch (getAttributeSpellingListIndex()) {
46937 default:
46938 llvm_unreachable("Unknown attribute spelling!");
46939 return "(No spelling)";
46940 case 0:
46941 return "work_group_size_hint";
46942 }
46943 }
46944
46945
46946 // X86ForceAlignArgPointerAttr implementation
46947
46948 X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
46949 auto *A = new (Ctx) X86ForceAlignArgPointerAttr(Ctx, CommonInfo);
46950 A->setImplicit(true);
46951 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46952 A->setAttributeSpellingListIndex(0);
46953 return A;
46954 }
46955
46956 X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
46957 auto *A = new (Ctx) X86ForceAlignArgPointerAttr(Ctx, CommonInfo);
46958 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
46959 A->setAttributeSpellingListIndex(0);
46960 return A;
46961 }
46962
46963 X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
46964 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46965 switch (S) {
46966 case GNU_force_align_arg_pointer:
46967 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46968 case CXX11_gnu_force_align_arg_pointer:
46969 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46970 case C23_gnu_force_align_arg_pointer:
46971 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46972 default:
46973 llvm_unreachable("Unknown attribute spelling!");
46974 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46975 }
46976 }());
46977 return CreateImplicit(Ctx, I);
46978 }
46979
46980 X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
46981 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
46982 switch (S) {
46983 case GNU_force_align_arg_pointer:
46984 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46985 case CXX11_gnu_force_align_arg_pointer:
46986 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46987 case C23_gnu_force_align_arg_pointer:
46988 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46989 default:
46990 llvm_unreachable("Unknown attribute spelling!");
46991 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
46992 }
46993 }());
46994 return Create(Ctx, I);
46995 }
46996
46997 X86ForceAlignArgPointerAttr::X86ForceAlignArgPointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
46998 )
46999 : InheritableAttr(Ctx, CommonInfo, attr::X86ForceAlignArgPointer, /*IsLateParsed=*/false, false)
47000 {
47001 }
47002
47003 X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::clone(ASTContext &C) const {
47004 auto *A = new (C) X86ForceAlignArgPointerAttr(C, *this);
47005 A->Inherited = Inherited;
47006 A->IsPackExpansion = IsPackExpansion;
47007 A->setImplicit(Implicit);
47008 return A;
47009 }
47010
47011 void X86ForceAlignArgPointerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
47012 bool IsFirstArgument = true; (void)IsFirstArgument;
47013 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
47014 switch (getAttributeSpellingListIndex()) {
47015 default:
47016 llvm_unreachable("Unknown attribute spelling!");
47017 break;
47018 case 0 : {
47019 OS << "__attribute__((force_align_arg_pointer";
47020 OS << "))";
47021 break;
47022 }
47023 case 1 : {
47024 OS << "[[gnu::force_align_arg_pointer";
47025 OS << "]]";
47026 break;
47027 }
47028 case 2 : {
47029 OS << "[[gnu::force_align_arg_pointer";
47030 OS << "]]";
47031 break;
47032 }
47033 }
47034 }
47035
47036 const char *X86ForceAlignArgPointerAttr::getSpelling() const {
47037 switch (getAttributeSpellingListIndex()) {
47038 default:
47039 llvm_unreachable("Unknown attribute spelling!");
47040 return "(No spelling)";
47041 case 0:
47042 return "force_align_arg_pointer";
47043 case 1:
47044 return "force_align_arg_pointer";
47045 case 2:
47046 return "force_align_arg_pointer";
47047 }
47048 }
47049
47050
47051 // XRayInstrumentAttr implementation
47052
47053 XRayInstrumentAttr *XRayInstrumentAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
47054 auto *A = new (Ctx) XRayInstrumentAttr(Ctx, CommonInfo);
47055 A->setImplicit(true);
47056 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
47057 A->setAttributeSpellingListIndex(0);
47058 return A;
47059 }
47060
47061 XRayInstrumentAttr *XRayInstrumentAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) {
47062 auto *A = new (Ctx) XRayInstrumentAttr(Ctx, CommonInfo);
47063 return A;
47064 }
47065
47066 XRayInstrumentAttr *XRayInstrumentAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
47067 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
47068 switch (S) {
47069 case GNU_xray_always_instrument:
47070 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47071 case CXX11_clang_xray_always_instrument:
47072 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47073 case C23_clang_xray_always_instrument:
47074 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47075 case GNU_xray_never_instrument:
47076 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47077 case CXX11_clang_xray_never_instrument:
47078 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47079 case C23_clang_xray_never_instrument:
47080 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47081 default:
47082 llvm_unreachable("Unknown attribute spelling!");
47083 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47084 }
47085 }());
47086 return CreateImplicit(Ctx, I);
47087 }
47088
47089 XRayInstrumentAttr *XRayInstrumentAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) {
47090 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
47091 switch (S) {
47092 case GNU_xray_always_instrument:
47093 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47094 case CXX11_clang_xray_always_instrument:
47095 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47096 case C23_clang_xray_always_instrument:
47097 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47098 case GNU_xray_never_instrument:
47099 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47100 case CXX11_clang_xray_never_instrument:
47101 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47102 case C23_clang_xray_never_instrument:
47103 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47104 default:
47105 llvm_unreachable("Unknown attribute spelling!");
47106 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47107 }
47108 }());
47109 return Create(Ctx, I);
47110 }
47111
47112 XRayInstrumentAttr::XRayInstrumentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
47113 )
47114 : InheritableAttr(Ctx, CommonInfo, attr::XRayInstrument, /*IsLateParsed=*/false, false)
47115 {
47116 }
47117
47118 XRayInstrumentAttr::Spelling XRayInstrumentAttr::getSemanticSpelling() const {
47119 switch (getAttributeSpellingListIndex()) {
47120 default: llvm_unreachable("Unknown spelling list index");
47121 case 0: return GNU_xray_always_instrument;
47122 case 1: return CXX11_clang_xray_always_instrument;
47123 case 2: return C23_clang_xray_always_instrument;
47124 case 3: return GNU_xray_never_instrument;
47125 case 4: return CXX11_clang_xray_never_instrument;
47126 case 5: return C23_clang_xray_never_instrument;
47127 }
47128 }
47129 XRayInstrumentAttr *XRayInstrumentAttr::clone(ASTContext &C) const {
47130 auto *A = new (C) XRayInstrumentAttr(C, *this);
47131 A->Inherited = Inherited;
47132 A->IsPackExpansion = IsPackExpansion;
47133 A->setImplicit(Implicit);
47134 return A;
47135 }
47136
47137 void XRayInstrumentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
47138 bool IsFirstArgument = true; (void)IsFirstArgument;
47139 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
47140 switch (getAttributeSpellingListIndex()) {
47141 default:
47142 llvm_unreachable("Unknown attribute spelling!");
47143 break;
47144 case 0 : {
47145 OS << "__attribute__((xray_always_instrument";
47146 OS << "))";
47147 break;
47148 }
47149 case 1 : {
47150 OS << "[[clang::xray_always_instrument";
47151 OS << "]]";
47152 break;
47153 }
47154 case 2 : {
47155 OS << "[[clang::xray_always_instrument";
47156 OS << "]]";
47157 break;
47158 }
47159 case 3 : {
47160 OS << "__attribute__((xray_never_instrument";
47161 OS << "))";
47162 break;
47163 }
47164 case 4 : {
47165 OS << "[[clang::xray_never_instrument";
47166 OS << "]]";
47167 break;
47168 }
47169 case 5 : {
47170 OS << "[[clang::xray_never_instrument";
47171 OS << "]]";
47172 break;
47173 }
47174 }
47175 }
47176
47177 const char *XRayInstrumentAttr::getSpelling() const {
47178 switch (getAttributeSpellingListIndex()) {
47179 default:
47180 llvm_unreachable("Unknown attribute spelling!");
47181 return "(No spelling)";
47182 case 0:
47183 return "xray_always_instrument";
47184 case 1:
47185 return "xray_always_instrument";
47186 case 2:
47187 return "xray_always_instrument";
47188 case 3:
47189 return "xray_never_instrument";
47190 case 4:
47191 return "xray_never_instrument";
47192 case 5:
47193 return "xray_never_instrument";
47194 }
47195 }
47196
47197
47198 // XRayLogArgsAttr implementation
47199
47200 XRayLogArgsAttr *XRayLogArgsAttr::CreateImplicit(ASTContext &Ctx, unsigned ArgumentCount, const AttributeCommonInfo &CommonInfo) {
47201 auto *A = new (Ctx) XRayLogArgsAttr(Ctx, CommonInfo, ArgumentCount);
47202 A->setImplicit(true);
47203 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
47204 A->setAttributeSpellingListIndex(0);
47205 return A;
47206 }
47207
47208 XRayLogArgsAttr *XRayLogArgsAttr::Create(ASTContext &Ctx, unsigned ArgumentCount, const AttributeCommonInfo &CommonInfo) {
47209 auto *A = new (Ctx) XRayLogArgsAttr(Ctx, CommonInfo, ArgumentCount);
47210 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
47211 A->setAttributeSpellingListIndex(0);
47212 return A;
47213 }
47214
47215 XRayLogArgsAttr *XRayLogArgsAttr::CreateImplicit(ASTContext &Ctx, unsigned ArgumentCount, SourceRange Range, Spelling S) {
47216 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
47217 switch (S) {
47218 case GNU_xray_log_args:
47219 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47220 case CXX11_clang_xray_log_args:
47221 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47222 case C23_clang_xray_log_args:
47223 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47224 default:
47225 llvm_unreachable("Unknown attribute spelling!");
47226 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47227 }
47228 }());
47229 return CreateImplicit(Ctx, ArgumentCount, I);
47230 }
47231
47232 XRayLogArgsAttr *XRayLogArgsAttr::Create(ASTContext &Ctx, unsigned ArgumentCount, SourceRange Range, Spelling S) {
47233 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
47234 switch (S) {
47235 case GNU_xray_log_args:
47236 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47237 case CXX11_clang_xray_log_args:
47238 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47239 case C23_clang_xray_log_args:
47240 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47241 default:
47242 llvm_unreachable("Unknown attribute spelling!");
47243 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47244 }
47245 }());
47246 return Create(Ctx, ArgumentCount, I);
47247 }
47248
47249 XRayLogArgsAttr::XRayLogArgsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
47250 , unsigned ArgumentCount
47251 )
47252 : InheritableAttr(Ctx, CommonInfo, attr::XRayLogArgs, /*IsLateParsed=*/false, false)
47253 , argumentCount(ArgumentCount)
47254 {
47255 }
47256
47257
47258
47259 XRayLogArgsAttr *XRayLogArgsAttr::clone(ASTContext &C) const {
47260 auto *A = new (C) XRayLogArgsAttr(C, *this, argumentCount);
47261 A->Inherited = Inherited;
47262 A->IsPackExpansion = IsPackExpansion;
47263 A->setImplicit(Implicit);
47264 return A;
47265 }
47266
47267 void XRayLogArgsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
47268 bool IsFirstArgument = true; (void)IsFirstArgument;
47269 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
47270 switch (getAttributeSpellingListIndex()) {
47271 default:
47272 llvm_unreachable("Unknown attribute spelling!");
47273 break;
47274 case 0 : {
47275 OS << "__attribute__((xray_log_args";
47276 DelimitAttributeArgument(OS, IsFirstArgument);
47277 OS << "" << getArgumentCount() << "";
47278 if (!IsFirstArgument)
47279 OS << ")";
47280 OS << "))";
47281 break;
47282 }
47283 case 1 : {
47284 OS << "[[clang::xray_log_args";
47285 DelimitAttributeArgument(OS, IsFirstArgument);
47286 OS << "" << getArgumentCount() << "";
47287 if (!IsFirstArgument)
47288 OS << ")";
47289 OS << "]]";
47290 break;
47291 }
47292 case 2 : {
47293 OS << "[[clang::xray_log_args";
47294 DelimitAttributeArgument(OS, IsFirstArgument);
47295 OS << "" << getArgumentCount() << "";
47296 if (!IsFirstArgument)
47297 OS << ")";
47298 OS << "]]";
47299 break;
47300 }
47301 }
47302 }
47303
47304 const char *XRayLogArgsAttr::getSpelling() const {
47305 switch (getAttributeSpellingListIndex()) {
47306 default:
47307 llvm_unreachable("Unknown attribute spelling!");
47308 return "(No spelling)";
47309 case 0:
47310 return "xray_log_args";
47311 case 1:
47312 return "xray_log_args";
47313 case 2:
47314 return "xray_log_args";
47315 }
47316 }
47317
47318
47319 // ZeroCallUsedRegsAttr implementation
47320
47321 ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::CreateImplicit(ASTContext &Ctx, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs, const AttributeCommonInfo &CommonInfo) {
47322 auto *A = new (Ctx) ZeroCallUsedRegsAttr(Ctx, CommonInfo, ZeroCallUsedRegs);
47323 A->setImplicit(true);
47324 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
47325 A->setAttributeSpellingListIndex(0);
47326 return A;
47327 }
47328
47329 ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::Create(ASTContext &Ctx, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs, const AttributeCommonInfo &CommonInfo) {
47330 auto *A = new (Ctx) ZeroCallUsedRegsAttr(Ctx, CommonInfo, ZeroCallUsedRegs);
47331 if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
47332 A->setAttributeSpellingListIndex(0);
47333 return A;
47334 }
47335
47336 ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::CreateImplicit(ASTContext &Ctx, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs, SourceRange Range, Spelling S) {
47337 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
47338 switch (S) {
47339 case GNU_zero_call_used_regs:
47340 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47341 case CXX11_gnu_zero_call_used_regs:
47342 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47343 case C23_gnu_zero_call_used_regs:
47344 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47345 default:
47346 llvm_unreachable("Unknown attribute spelling!");
47347 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47348 }
47349 }());
47350 return CreateImplicit(Ctx, ZeroCallUsedRegs, I);
47351 }
47352
47353 ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::Create(ASTContext &Ctx, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs, SourceRange Range, Spelling S) {
47354 AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
47355 switch (S) {
47356 case GNU_zero_call_used_regs:
47357 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47358 case CXX11_gnu_zero_call_used_regs:
47359 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47360 case C23_gnu_zero_call_used_regs:
47361 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47362 default:
47363 llvm_unreachable("Unknown attribute spelling!");
47364 return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
47365 }
47366 }());
47367 return Create(Ctx, ZeroCallUsedRegs, I);
47368 }
47369
47370 ZeroCallUsedRegsAttr::ZeroCallUsedRegsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo
47371 , ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs
47372 )
47373 : InheritableAttr(Ctx, CommonInfo, attr::ZeroCallUsedRegs, /*IsLateParsed=*/false, false)
47374 , zeroCallUsedRegs(ZeroCallUsedRegs)
47375 {
47376 }
47377
47378
47379
47380 bool ZeroCallUsedRegsAttr::ConvertStrToZeroCallUsedRegsKind(StringRef Val, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind &Out) {
47381 std::optional<ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind> R = llvm::StringSwitch<std::optional<ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind>>(Val)
47382 .Case("skip", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::Skip)
47383 .Case("used-gpr-arg", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedGPRArg)
47384 .Case("used-gpr", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedGPR)
47385 .Case("used-arg", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedArg)
47386 .Case("used", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::Used)
47387 .Case("all-gpr-arg", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllGPRArg)
47388 .Case("all-gpr", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllGPR)
47389 .Case("all-arg", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllArg)
47390 .Case("all", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::All)
47391 .Default(std::optional<ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind>());
47392 if (R) {
47393 Out = *R;
47394 return true;
47395 }
47396 return false;
47397 }
47398
47399 const char *ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind Val) {
47400 switch(Val) {
47401 case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::Skip: return "skip";
47402 case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedGPRArg: return "used-gpr-arg";
47403 case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedGPR: return "used-gpr";
47404 case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedArg: return "used-arg";
47405 case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::Used: return "used";
47406 case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllGPRArg: return "all-gpr-arg";
47407 case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllGPR: return "all-gpr";
47408 case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllArg: return "all-arg";
47409 case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::All: return "all";
47410 }
47411 llvm_unreachable("No enumerator with that value");
47412 }
47413 ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::clone(ASTContext &C) const {
47414 auto *A = new (C) ZeroCallUsedRegsAttr(C, *this, zeroCallUsedRegs);
47415 A->Inherited = Inherited;
47416 A->IsPackExpansion = IsPackExpansion;
47417 A->setImplicit(Implicit);
47418 return A;
47419 }
47420
47421 void ZeroCallUsedRegsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
47422 bool IsFirstArgument = true; (void)IsFirstArgument;
47423 unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs;
47424 switch (getAttributeSpellingListIndex()) {
47425 default:
47426 llvm_unreachable("Unknown attribute spelling!");
47427 break;
47428 case 0 : {
47429 OS << "__attribute__((zero_call_used_regs";
47430 DelimitAttributeArgument(OS, IsFirstArgument);
47431 OS << "\"" << ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(getZeroCallUsedRegs()) << "\"";
47432 if (!IsFirstArgument)
47433 OS << ")";
47434 OS << "))";
47435 break;
47436 }
47437 case 1 : {
47438 OS << "[[gnu::zero_call_used_regs";
47439 DelimitAttributeArgument(OS, IsFirstArgument);
47440 OS << "\"" << ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(getZeroCallUsedRegs()) << "\"";
47441 if (!IsFirstArgument)
47442 OS << ")";
47443 OS << "]]";
47444 break;
47445 }
47446 case 2 : {
47447 OS << "[[gnu::zero_call_used_regs";
47448 DelimitAttributeArgument(OS, IsFirstArgument);
47449 OS << "\"" << ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(getZeroCallUsedRegs()) << "\"";
47450 if (!IsFirstArgument)
47451 OS << ")";
47452 OS << "]]";
47453 break;
47454 }
47455 }
47456 }
47457
47458 const char *ZeroCallUsedRegsAttr::getSpelling() const {
47459 switch (getAttributeSpellingListIndex()) {
47460 default:
47461 llvm_unreachable("Unknown attribute spelling!");
47462 return "(No spelling)";
47463 case 0:
47464 return "zero_call_used_regs";
47465 case 1:
47466 return "zero_call_used_regs";
47467 case 2:
47468 return "zero_call_used_regs";
47469 }
47470 }
47471
47472 const char *Attr::getSpelling() const {
47473 switch (getKind()) {
47474 case attr::AArch64SVEPcs:
47475 return cast<AArch64SVEPcsAttr>(this)->getSpelling();
47476 case attr::AArch64VectorPcs:
47477 return cast<AArch64VectorPcsAttr>(this)->getSpelling();
47478 case attr::AMDGPUFlatWorkGroupSize:
47479 return cast<AMDGPUFlatWorkGroupSizeAttr>(this)->getSpelling();
47480 case attr::AMDGPUKernelCall:
47481 return cast<AMDGPUKernelCallAttr>(this)->getSpelling();
47482 case attr::AMDGPUMaxNumWorkGroups:
47483 return cast<AMDGPUMaxNumWorkGroupsAttr>(this)->getSpelling();
47484 case attr::AMDGPUNumSGPR:
47485 return cast<AMDGPUNumSGPRAttr>(this)->getSpelling();
47486 case attr::AMDGPUNumVGPR:
47487 return cast<AMDGPUNumVGPRAttr>(this)->getSpelling();
47488 case attr::AMDGPUWavesPerEU:
47489 return cast<AMDGPUWavesPerEUAttr>(this)->getSpelling();
47490 case attr::ARMInterrupt:
47491 return cast<ARMInterruptAttr>(this)->getSpelling();
47492 case attr::AVRInterrupt:
47493 return cast<AVRInterruptAttr>(this)->getSpelling();
47494 case attr::AVRSignal:
47495 return cast<AVRSignalAttr>(this)->getSpelling();
47496 case attr::AbiTag:
47497 return cast<AbiTagAttr>(this)->getSpelling();
47498 case attr::AcquireCapability:
47499 return cast<AcquireCapabilityAttr>(this)->getSpelling();
47500 case attr::AcquireHandle:
47501 return cast<AcquireHandleAttr>(this)->getSpelling();
47502 case attr::AcquiredAfter:
47503 return cast<AcquiredAfterAttr>(this)->getSpelling();
47504 case attr::AcquiredBefore:
47505 return cast<AcquiredBeforeAttr>(this)->getSpelling();
47506 case attr::AddressSpace:
47507 return cast<AddressSpaceAttr>(this)->getSpelling();
47508 case attr::Alias:
47509 return cast<AliasAttr>(this)->getSpelling();
47510 case attr::AlignMac68k:
47511 return cast<AlignMac68kAttr>(this)->getSpelling();
47512 case attr::AlignNatural:
47513 return cast<AlignNaturalAttr>(this)->getSpelling();
47514 case attr::AlignValue:
47515 return cast<AlignValueAttr>(this)->getSpelling();
47516 case attr::Aligned:
47517 return cast<AlignedAttr>(this)->getSpelling();
47518 case attr::AllocAlign:
47519 return cast<AllocAlignAttr>(this)->getSpelling();
47520 case attr::AllocSize:
47521 return cast<AllocSizeAttr>(this)->getSpelling();
47522 case attr::Allocating:
47523 return cast<AllocatingAttr>(this)->getSpelling();
47524 case attr::AlwaysDestroy:
47525 return cast<AlwaysDestroyAttr>(this)->getSpelling();
47526 case attr::AlwaysInline:
47527 return cast<AlwaysInlineAttr>(this)->getSpelling();
47528 case attr::AnalyzerNoReturn:
47529 return cast<AnalyzerNoReturnAttr>(this)->getSpelling();
47530 case attr::Annotate:
47531 return cast<AnnotateAttr>(this)->getSpelling();
47532 case attr::AnnotateType:
47533 return cast<AnnotateTypeAttr>(this)->getSpelling();
47534 case attr::AnyX86Interrupt:
47535 return cast<AnyX86InterruptAttr>(this)->getSpelling();
47536 case attr::AnyX86NoCallerSavedRegisters:
47537 return cast<AnyX86NoCallerSavedRegistersAttr>(this)->getSpelling();
47538 case attr::AnyX86NoCfCheck:
47539 return cast<AnyX86NoCfCheckAttr>(this)->getSpelling();
47540 case attr::ArcWeakrefUnavailable:
47541 return cast<ArcWeakrefUnavailableAttr>(this)->getSpelling();
47542 case attr::ArgumentWithTypeTag:
47543 return cast<ArgumentWithTypeTagAttr>(this)->getSpelling();
47544 case attr::ArmAgnostic:
47545 return cast<ArmAgnosticAttr>(this)->getSpelling();
47546 case attr::ArmBuiltinAlias:
47547 return cast<ArmBuiltinAliasAttr>(this)->getSpelling();
47548 case attr::ArmIn:
47549 return cast<ArmInAttr>(this)->getSpelling();
47550 case attr::ArmInOut:
47551 return cast<ArmInOutAttr>(this)->getSpelling();
47552 case attr::ArmLocallyStreaming:
47553 return cast<ArmLocallyStreamingAttr>(this)->getSpelling();
47554 case attr::ArmMveStrictPolymorphism:
47555 return cast<ArmMveStrictPolymorphismAttr>(this)->getSpelling();
47556 case attr::ArmNew:
47557 return cast<ArmNewAttr>(this)->getSpelling();
47558 case attr::ArmOut:
47559 return cast<ArmOutAttr>(this)->getSpelling();
47560 case attr::ArmPreserves:
47561 return cast<ArmPreservesAttr>(this)->getSpelling();
47562 case attr::ArmStreaming:
47563 return cast<ArmStreamingAttr>(this)->getSpelling();
47564 case attr::ArmStreamingCompatible:
47565 return cast<ArmStreamingCompatibleAttr>(this)->getSpelling();
47566 case attr::Artificial:
47567 return cast<ArtificialAttr>(this)->getSpelling();
47568 case attr::AsmLabel:
47569 return cast<AsmLabelAttr>(this)->getSpelling();
47570 case attr::AssertCapability:
47571 return cast<AssertCapabilityAttr>(this)->getSpelling();
47572 case attr::AssertExclusiveLock:
47573 return cast<AssertExclusiveLockAttr>(this)->getSpelling();
47574 case attr::AssertSharedLock:
47575 return cast<AssertSharedLockAttr>(this)->getSpelling();
47576 case attr::AssumeAligned:
47577 return cast<AssumeAlignedAttr>(this)->getSpelling();
47578 case attr::Availability:
47579 return cast<AvailabilityAttr>(this)->getSpelling();
47580 case attr::AvailableOnlyInDefaultEvalMethod:
47581 return cast<AvailableOnlyInDefaultEvalMethodAttr>(this)->getSpelling();
47582 case attr::BPFFastCall:
47583 return cast<BPFFastCallAttr>(this)->getSpelling();
47584 case attr::BPFPreserveAccessIndex:
47585 return cast<BPFPreserveAccessIndexAttr>(this)->getSpelling();
47586 case attr::BPFPreserveStaticOffset:
47587 return cast<BPFPreserveStaticOffsetAttr>(this)->getSpelling();
47588 case attr::BTFDeclTag:
47589 return cast<BTFDeclTagAttr>(this)->getSpelling();
47590 case attr::BTFTypeTag:
47591 return cast<BTFTypeTagAttr>(this)->getSpelling();
47592 case attr::Blocking:
47593 return cast<BlockingAttr>(this)->getSpelling();
47594 case attr::Blocks:
47595 return cast<BlocksAttr>(this)->getSpelling();
47596 case attr::Builtin:
47597 return cast<BuiltinAttr>(this)->getSpelling();
47598 case attr::BuiltinAlias:
47599 return cast<BuiltinAliasAttr>(this)->getSpelling();
47600 case attr::C11NoReturn:
47601 return cast<C11NoReturnAttr>(this)->getSpelling();
47602 case attr::CDecl:
47603 return cast<CDeclAttr>(this)->getSpelling();
47604 case attr::CFAuditedTransfer:
47605 return cast<CFAuditedTransferAttr>(this)->getSpelling();
47606 case attr::CFConsumed:
47607 return cast<CFConsumedAttr>(this)->getSpelling();
47608 case attr::CFGuard:
47609 return cast<CFGuardAttr>(this)->getSpelling();
47610 case attr::CFICanonicalJumpTable:
47611 return cast<CFICanonicalJumpTableAttr>(this)->getSpelling();
47612 case attr::CFReturnsNotRetained:
47613 return cast<CFReturnsNotRetainedAttr>(this)->getSpelling();
47614 case attr::CFReturnsRetained:
47615 return cast<CFReturnsRetainedAttr>(this)->getSpelling();
47616 case attr::CFUnknownTransfer:
47617 return cast<CFUnknownTransferAttr>(this)->getSpelling();
47618 case attr::CPUDispatch:
47619 return cast<CPUDispatchAttr>(this)->getSpelling();
47620 case attr::CPUSpecific:
47621 return cast<CPUSpecificAttr>(this)->getSpelling();
47622 case attr::CUDAConstant:
47623 return cast<CUDAConstantAttr>(this)->getSpelling();
47624 case attr::CUDADevice:
47625 return cast<CUDADeviceAttr>(this)->getSpelling();
47626 case attr::CUDADeviceBuiltinSurfaceType:
47627 return cast<CUDADeviceBuiltinSurfaceTypeAttr>(this)->getSpelling();
47628 case attr::CUDADeviceBuiltinTextureType:
47629 return cast<CUDADeviceBuiltinTextureTypeAttr>(this)->getSpelling();
47630 case attr::CUDAGlobal:
47631 return cast<CUDAGlobalAttr>(this)->getSpelling();
47632 case attr::CUDAGridConstant:
47633 return cast<CUDAGridConstantAttr>(this)->getSpelling();
47634 case attr::CUDAHost:
47635 return cast<CUDAHostAttr>(this)->getSpelling();
47636 case attr::CUDAInvalidTarget:
47637 return cast<CUDAInvalidTargetAttr>(this)->getSpelling();
47638 case attr::CUDALaunchBounds:
47639 return cast<CUDALaunchBoundsAttr>(this)->getSpelling();
47640 case attr::CUDAShared:
47641 return cast<CUDASharedAttr>(this)->getSpelling();
47642 case attr::CXX11NoReturn:
47643 return cast<CXX11NoReturnAttr>(this)->getSpelling();
47644 case attr::CXXAssume:
47645 return cast<CXXAssumeAttr>(this)->getSpelling();
47646 case attr::CallableWhen:
47647 return cast<CallableWhenAttr>(this)->getSpelling();
47648 case attr::Callback:
47649 return cast<CallbackAttr>(this)->getSpelling();
47650 case attr::CalledOnce:
47651 return cast<CalledOnceAttr>(this)->getSpelling();
47652 case attr::Capability:
47653 return cast<CapabilityAttr>(this)->getSpelling();
47654 case attr::CapturedRecord:
47655 return cast<CapturedRecordAttr>(this)->getSpelling();
47656 case attr::CarriesDependency:
47657 return cast<CarriesDependencyAttr>(this)->getSpelling();
47658 case attr::Cleanup:
47659 return cast<CleanupAttr>(this)->getSpelling();
47660 case attr::ClspvLibclcBuiltin:
47661 return cast<ClspvLibclcBuiltinAttr>(this)->getSpelling();
47662 case attr::CmseNSCall:
47663 return cast<CmseNSCallAttr>(this)->getSpelling();
47664 case attr::CmseNSEntry:
47665 return cast<CmseNSEntryAttr>(this)->getSpelling();
47666 case attr::CodeAlign:
47667 return cast<CodeAlignAttr>(this)->getSpelling();
47668 case attr::CodeModel:
47669 return cast<CodeModelAttr>(this)->getSpelling();
47670 case attr::CodeSeg:
47671 return cast<CodeSegAttr>(this)->getSpelling();
47672 case attr::Cold:
47673 return cast<ColdAttr>(this)->getSpelling();
47674 case attr::Common:
47675 return cast<CommonAttr>(this)->getSpelling();
47676 case attr::Const:
47677 return cast<ConstAttr>(this)->getSpelling();
47678 case attr::ConstInit:
47679 return cast<ConstInitAttr>(this)->getSpelling();
47680 case attr::Constructor:
47681 return cast<ConstructorAttr>(this)->getSpelling();
47682 case attr::Consumable:
47683 return cast<ConsumableAttr>(this)->getSpelling();
47684 case attr::ConsumableAutoCast:
47685 return cast<ConsumableAutoCastAttr>(this)->getSpelling();
47686 case attr::ConsumableSetOnRead:
47687 return cast<ConsumableSetOnReadAttr>(this)->getSpelling();
47688 case attr::Convergent:
47689 return cast<ConvergentAttr>(this)->getSpelling();
47690 case attr::CoroAwaitElidable:
47691 return cast<CoroAwaitElidableAttr>(this)->getSpelling();
47692 case attr::CoroAwaitElidableArgument:
47693 return cast<CoroAwaitElidableArgumentAttr>(this)->getSpelling();
47694 case attr::CoroDisableLifetimeBound:
47695 return cast<CoroDisableLifetimeBoundAttr>(this)->getSpelling();
47696 case attr::CoroLifetimeBound:
47697 return cast<CoroLifetimeBoundAttr>(this)->getSpelling();
47698 case attr::CoroOnlyDestroyWhenComplete:
47699 return cast<CoroOnlyDestroyWhenCompleteAttr>(this)->getSpelling();
47700 case attr::CoroReturnType:
47701 return cast<CoroReturnTypeAttr>(this)->getSpelling();
47702 case attr::CoroWrapper:
47703 return cast<CoroWrapperAttr>(this)->getSpelling();
47704 case attr::CountedBy:
47705 return cast<CountedByAttr>(this)->getSpelling();
47706 case attr::CountedByOrNull:
47707 return cast<CountedByOrNullAttr>(this)->getSpelling();
47708 case attr::DLLExport:
47709 return cast<DLLExportAttr>(this)->getSpelling();
47710 case attr::DLLExportStaticLocal:
47711 return cast<DLLExportStaticLocalAttr>(this)->getSpelling();
47712 case attr::DLLImport:
47713 return cast<DLLImportAttr>(this)->getSpelling();
47714 case attr::DLLImportStaticLocal:
47715 return cast<DLLImportStaticLocalAttr>(this)->getSpelling();
47716 case attr::Deprecated:
47717 return cast<DeprecatedAttr>(this)->getSpelling();
47718 case attr::Destructor:
47719 return cast<DestructorAttr>(this)->getSpelling();
47720 case attr::DiagnoseAsBuiltin:
47721 return cast<DiagnoseAsBuiltinAttr>(this)->getSpelling();
47722 case attr::DiagnoseIf:
47723 return cast<DiagnoseIfAttr>(this)->getSpelling();
47724 case attr::DisableSanitizerInstrumentation:
47725 return cast<DisableSanitizerInstrumentationAttr>(this)->getSpelling();
47726 case attr::DisableTailCalls:
47727 return cast<DisableTailCallsAttr>(this)->getSpelling();
47728 case attr::EmptyBases:
47729 return cast<EmptyBasesAttr>(this)->getSpelling();
47730 case attr::EnableIf:
47731 return cast<EnableIfAttr>(this)->getSpelling();
47732 case attr::EnforceTCB:
47733 return cast<EnforceTCBAttr>(this)->getSpelling();
47734 case attr::EnforceTCBLeaf:
47735 return cast<EnforceTCBLeafAttr>(this)->getSpelling();
47736 case attr::EnumExtensibility:
47737 return cast<EnumExtensibilityAttr>(this)->getSpelling();
47738 case attr::Error:
47739 return cast<ErrorAttr>(this)->getSpelling();
47740 case attr::ExcludeFromExplicitInstantiation:
47741 return cast<ExcludeFromExplicitInstantiationAttr>(this)->getSpelling();
47742 case attr::ExclusiveTrylockFunction:
47743 return cast<ExclusiveTrylockFunctionAttr>(this)->getSpelling();
47744 case attr::ExplicitInit:
47745 return cast<ExplicitInitAttr>(this)->getSpelling();
47746 case attr::ExternalSourceSymbol:
47747 return cast<ExternalSourceSymbolAttr>(this)->getSpelling();
47748 case attr::FallThrough:
47749 return cast<FallThroughAttr>(this)->getSpelling();
47750 case attr::FastCall:
47751 return cast<FastCallAttr>(this)->getSpelling();
47752 case attr::Final:
47753 return cast<FinalAttr>(this)->getSpelling();
47754 case attr::FlagEnum:
47755 return cast<FlagEnumAttr>(this)->getSpelling();
47756 case attr::Flatten:
47757 return cast<FlattenAttr>(this)->getSpelling();
47758 case attr::Format:
47759 return cast<FormatAttr>(this)->getSpelling();
47760 case attr::FormatArg:
47761 return cast<FormatArgAttr>(this)->getSpelling();
47762 case attr::FunctionReturnThunks:
47763 return cast<FunctionReturnThunksAttr>(this)->getSpelling();
47764 case attr::GNUInline:
47765 return cast<GNUInlineAttr>(this)->getSpelling();
47766 case attr::GuardedBy:
47767 return cast<GuardedByAttr>(this)->getSpelling();
47768 case attr::GuardedVar:
47769 return cast<GuardedVarAttr>(this)->getSpelling();
47770 case attr::HIPManaged:
47771 return cast<HIPManagedAttr>(this)->getSpelling();
47772 case attr::HLSLContainedType:
47773 return cast<HLSLContainedTypeAttr>(this)->getSpelling();
47774 case attr::HLSLControlFlowHint:
47775 return cast<HLSLControlFlowHintAttr>(this)->getSpelling();
47776 case attr::HLSLGroupSharedAddressSpace:
47777 return cast<HLSLGroupSharedAddressSpaceAttr>(this)->getSpelling();
47778 case attr::HLSLLoopHint:
47779 return cast<HLSLLoopHintAttr>(this)->getSpelling();
47780 case attr::HLSLNumThreads:
47781 return cast<HLSLNumThreadsAttr>(this)->getSpelling();
47782 case attr::HLSLPackOffset:
47783 return cast<HLSLPackOffsetAttr>(this)->getSpelling();
47784 case attr::HLSLParamModifier:
47785 return cast<HLSLParamModifierAttr>(this)->getSpelling();
47786 case attr::HLSLROV:
47787 return cast<HLSLROVAttr>(this)->getSpelling();
47788 case attr::HLSLRawBuffer:
47789 return cast<HLSLRawBufferAttr>(this)->getSpelling();
47790 case attr::HLSLResource:
47791 return cast<HLSLResourceAttr>(this)->getSpelling();
47792 case attr::HLSLResourceBinding:
47793 return cast<HLSLResourceBindingAttr>(this)->getSpelling();
47794 case attr::HLSLResourceClass:
47795 return cast<HLSLResourceClassAttr>(this)->getSpelling();
47796 case attr::HLSLSV_DispatchThreadID:
47797 return cast<HLSLSV_DispatchThreadIDAttr>(this)->getSpelling();
47798 case attr::HLSLSV_GroupID:
47799 return cast<HLSLSV_GroupIDAttr>(this)->getSpelling();
47800 case attr::HLSLSV_GroupIndex:
47801 return cast<HLSLSV_GroupIndexAttr>(this)->getSpelling();
47802 case attr::HLSLSV_GroupThreadID:
47803 return cast<HLSLSV_GroupThreadIDAttr>(this)->getSpelling();
47804 case attr::HLSLShader:
47805 return cast<HLSLShaderAttr>(this)->getSpelling();
47806 case attr::HLSLWaveSize:
47807 return cast<HLSLWaveSizeAttr>(this)->getSpelling();
47808 case attr::Hot:
47809 return cast<HotAttr>(this)->getSpelling();
47810 case attr::HybridPatchable:
47811 return cast<HybridPatchableAttr>(this)->getSpelling();
47812 case attr::IBAction:
47813 return cast<IBActionAttr>(this)->getSpelling();
47814 case attr::IBOutlet:
47815 return cast<IBOutletAttr>(this)->getSpelling();
47816 case attr::IBOutletCollection:
47817 return cast<IBOutletCollectionAttr>(this)->getSpelling();
47818 case attr::IFunc:
47819 return cast<IFuncAttr>(this)->getSpelling();
47820 case attr::InitPriority:
47821 return cast<InitPriorityAttr>(this)->getSpelling();
47822 case attr::InitSeg:
47823 return cast<InitSegAttr>(this)->getSpelling();
47824 case attr::IntelOclBicc:
47825 return cast<IntelOclBiccAttr>(this)->getSpelling();
47826 case attr::InternalLinkage:
47827 return cast<InternalLinkageAttr>(this)->getSpelling();
47828 case attr::LTOVisibilityPublic:
47829 return cast<LTOVisibilityPublicAttr>(this)->getSpelling();
47830 case attr::LayoutVersion:
47831 return cast<LayoutVersionAttr>(this)->getSpelling();
47832 case attr::Leaf:
47833 return cast<LeafAttr>(this)->getSpelling();
47834 case attr::LifetimeBound:
47835 return cast<LifetimeBoundAttr>(this)->getSpelling();
47836 case attr::LifetimeCaptureBy:
47837 return cast<LifetimeCaptureByAttr>(this)->getSpelling();
47838 case attr::Likely:
47839 return cast<LikelyAttr>(this)->getSpelling();
47840 case attr::LoaderUninitialized:
47841 return cast<LoaderUninitializedAttr>(this)->getSpelling();
47842 case attr::LockReturned:
47843 return cast<LockReturnedAttr>(this)->getSpelling();
47844 case attr::LocksExcluded:
47845 return cast<LocksExcludedAttr>(this)->getSpelling();
47846 case attr::LoopHint:
47847 return cast<LoopHintAttr>(this)->getSpelling();
47848 case attr::M68kInterrupt:
47849 return cast<M68kInterruptAttr>(this)->getSpelling();
47850 case attr::M68kRTD:
47851 return cast<M68kRTDAttr>(this)->getSpelling();
47852 case attr::MIGServerRoutine:
47853 return cast<MIGServerRoutineAttr>(this)->getSpelling();
47854 case attr::MSABI:
47855 return cast<MSABIAttr>(this)->getSpelling();
47856 case attr::MSAllocator:
47857 return cast<MSAllocatorAttr>(this)->getSpelling();
47858 case attr::MSConstexpr:
47859 return cast<MSConstexprAttr>(this)->getSpelling();
47860 case attr::MSInheritance:
47861 return cast<MSInheritanceAttr>(this)->getSpelling();
47862 case attr::MSNoVTable:
47863 return cast<MSNoVTableAttr>(this)->getSpelling();
47864 case attr::MSP430Interrupt:
47865 return cast<MSP430InterruptAttr>(this)->getSpelling();
47866 case attr::MSStruct:
47867 return cast<MSStructAttr>(this)->getSpelling();
47868 case attr::MSVtorDisp:
47869 return cast<MSVtorDispAttr>(this)->getSpelling();
47870 case attr::MaxFieldAlignment:
47871 return cast<MaxFieldAlignmentAttr>(this)->getSpelling();
47872 case attr::MayAlias:
47873 return cast<MayAliasAttr>(this)->getSpelling();
47874 case attr::MaybeUndef:
47875 return cast<MaybeUndefAttr>(this)->getSpelling();
47876 case attr::MicroMips:
47877 return cast<MicroMipsAttr>(this)->getSpelling();
47878 case attr::MinSize:
47879 return cast<MinSizeAttr>(this)->getSpelling();
47880 case attr::MinVectorWidth:
47881 return cast<MinVectorWidthAttr>(this)->getSpelling();
47882 case attr::Mips16:
47883 return cast<Mips16Attr>(this)->getSpelling();
47884 case attr::MipsInterrupt:
47885 return cast<MipsInterruptAttr>(this)->getSpelling();
47886 case attr::MipsLongCall:
47887 return cast<MipsLongCallAttr>(this)->getSpelling();
47888 case attr::MipsShortCall:
47889 return cast<MipsShortCallAttr>(this)->getSpelling();
47890 case attr::Mode:
47891 return cast<ModeAttr>(this)->getSpelling();
47892 case attr::MustTail:
47893 return cast<MustTailAttr>(this)->getSpelling();
47894 case attr::NSConsumed:
47895 return cast<NSConsumedAttr>(this)->getSpelling();
47896 case attr::NSConsumesSelf:
47897 return cast<NSConsumesSelfAttr>(this)->getSpelling();
47898 case attr::NSErrorDomain:
47899 return cast<NSErrorDomainAttr>(this)->getSpelling();
47900 case attr::NSReturnsAutoreleased:
47901 return cast<NSReturnsAutoreleasedAttr>(this)->getSpelling();
47902 case attr::NSReturnsNotRetained:
47903 return cast<NSReturnsNotRetainedAttr>(this)->getSpelling();
47904 case attr::NSReturnsRetained:
47905 return cast<NSReturnsRetainedAttr>(this)->getSpelling();
47906 case attr::NVPTXKernel:
47907 return cast<NVPTXKernelAttr>(this)->getSpelling();
47908 case attr::Naked:
47909 return cast<NakedAttr>(this)->getSpelling();
47910 case attr::NoAlias:
47911 return cast<NoAliasAttr>(this)->getSpelling();
47912 case attr::NoBuiltin:
47913 return cast<NoBuiltinAttr>(this)->getSpelling();
47914 case attr::NoCommon:
47915 return cast<NoCommonAttr>(this)->getSpelling();
47916 case attr::NoConvergent:
47917 return cast<NoConvergentAttr>(this)->getSpelling();
47918 case attr::NoDebug:
47919 return cast<NoDebugAttr>(this)->getSpelling();
47920 case attr::NoDeref:
47921 return cast<NoDerefAttr>(this)->getSpelling();
47922 case attr::NoDestroy:
47923 return cast<NoDestroyAttr>(this)->getSpelling();
47924 case attr::NoDuplicate:
47925 return cast<NoDuplicateAttr>(this)->getSpelling();
47926 case attr::NoEscape:
47927 return cast<NoEscapeAttr>(this)->getSpelling();
47928 case attr::NoInline:
47929 return cast<NoInlineAttr>(this)->getSpelling();
47930 case attr::NoInstrumentFunction:
47931 return cast<NoInstrumentFunctionAttr>(this)->getSpelling();
47932 case attr::NoMerge:
47933 return cast<NoMergeAttr>(this)->getSpelling();
47934 case attr::NoMicroMips:
47935 return cast<NoMicroMipsAttr>(this)->getSpelling();
47936 case attr::NoMips16:
47937 return cast<NoMips16Attr>(this)->getSpelling();
47938 case attr::NoProfileFunction:
47939 return cast<NoProfileFunctionAttr>(this)->getSpelling();
47940 case attr::NoRandomizeLayout:
47941 return cast<NoRandomizeLayoutAttr>(this)->getSpelling();
47942 case attr::NoReturn:
47943 return cast<NoReturnAttr>(this)->getSpelling();
47944 case attr::NoSanitize:
47945 return cast<NoSanitizeAttr>(this)->getSpelling();
47946 case attr::NoSpecializations:
47947 return cast<NoSpecializationsAttr>(this)->getSpelling();
47948 case attr::NoSpeculativeLoadHardening:
47949 return cast<NoSpeculativeLoadHardeningAttr>(this)->getSpelling();
47950 case attr::NoSplitStack:
47951 return cast<NoSplitStackAttr>(this)->getSpelling();
47952 case attr::NoStackProtector:
47953 return cast<NoStackProtectorAttr>(this)->getSpelling();
47954 case attr::NoThreadSafetyAnalysis:
47955 return cast<NoThreadSafetyAnalysisAttr>(this)->getSpelling();
47956 case attr::NoThrow:
47957 return cast<NoThrowAttr>(this)->getSpelling();
47958 case attr::NoTrivialAutoVarInit:
47959 return cast<NoTrivialAutoVarInitAttr>(this)->getSpelling();
47960 case attr::NoUniqueAddress:
47961 return cast<NoUniqueAddressAttr>(this)->getSpelling();
47962 case attr::NoUwtable:
47963 return cast<NoUwtableAttr>(this)->getSpelling();
47964 case attr::NonAllocating:
47965 return cast<NonAllocatingAttr>(this)->getSpelling();
47966 case attr::NonBlocking:
47967 return cast<NonBlockingAttr>(this)->getSpelling();
47968 case attr::NonNull:
47969 return cast<NonNullAttr>(this)->getSpelling();
47970 case attr::NotTailCalled:
47971 return cast<NotTailCalledAttr>(this)->getSpelling();
47972 case attr::OMPAllocateDecl:
47973 return cast<OMPAllocateDeclAttr>(this)->getSpelling();
47974 case attr::OMPAssume:
47975 return cast<OMPAssumeAttr>(this)->getSpelling();
47976 case attr::OMPCaptureKind:
47977 return cast<OMPCaptureKindAttr>(this)->getSpelling();
47978 case attr::OMPCaptureNoInit:
47979 return cast<OMPCaptureNoInitAttr>(this)->getSpelling();
47980 case attr::OMPDeclareSimdDecl:
47981 return cast<OMPDeclareSimdDeclAttr>(this)->getSpelling();
47982 case attr::OMPDeclareTargetDecl:
47983 return cast<OMPDeclareTargetDeclAttr>(this)->getSpelling();
47984 case attr::OMPDeclareVariant:
47985 return cast<OMPDeclareVariantAttr>(this)->getSpelling();
47986 case attr::OMPReferencedVar:
47987 return cast<OMPReferencedVarAttr>(this)->getSpelling();
47988 case attr::OMPThreadPrivateDecl:
47989 return cast<OMPThreadPrivateDeclAttr>(this)->getSpelling();
47990 case attr::OSConsumed:
47991 return cast<OSConsumedAttr>(this)->getSpelling();
47992 case attr::OSConsumesThis:
47993 return cast<OSConsumesThisAttr>(this)->getSpelling();
47994 case attr::OSReturnsNotRetained:
47995 return cast<OSReturnsNotRetainedAttr>(this)->getSpelling();
47996 case attr::OSReturnsRetained:
47997 return cast<OSReturnsRetainedAttr>(this)->getSpelling();
47998 case attr::OSReturnsRetainedOnNonZero:
47999 return cast<OSReturnsRetainedOnNonZeroAttr>(this)->getSpelling();
48000 case attr::OSReturnsRetainedOnZero:
48001 return cast<OSReturnsRetainedOnZeroAttr>(this)->getSpelling();
48002 case attr::ObjCBoxable:
48003 return cast<ObjCBoxableAttr>(this)->getSpelling();
48004 case attr::ObjCBridge:
48005 return cast<ObjCBridgeAttr>(this)->getSpelling();
48006 case attr::ObjCBridgeMutable:
48007 return cast<ObjCBridgeMutableAttr>(this)->getSpelling();
48008 case attr::ObjCBridgeRelated:
48009 return cast<ObjCBridgeRelatedAttr>(this)->getSpelling();
48010 case attr::ObjCClassStub:
48011 return cast<ObjCClassStubAttr>(this)->getSpelling();
48012 case attr::ObjCDesignatedInitializer:
48013 return cast<ObjCDesignatedInitializerAttr>(this)->getSpelling();
48014 case attr::ObjCDirect:
48015 return cast<ObjCDirectAttr>(this)->getSpelling();
48016 case attr::ObjCDirectMembers:
48017 return cast<ObjCDirectMembersAttr>(this)->getSpelling();
48018 case attr::ObjCException:
48019 return cast<ObjCExceptionAttr>(this)->getSpelling();
48020 case attr::ObjCExplicitProtocolImpl:
48021 return cast<ObjCExplicitProtocolImplAttr>(this)->getSpelling();
48022 case attr::ObjCExternallyRetained:
48023 return cast<ObjCExternallyRetainedAttr>(this)->getSpelling();
48024 case attr::ObjCGC:
48025 return cast<ObjCGCAttr>(this)->getSpelling();
48026 case attr::ObjCIndependentClass:
48027 return cast<ObjCIndependentClassAttr>(this)->getSpelling();
48028 case attr::ObjCInertUnsafeUnretained:
48029 return cast<ObjCInertUnsafeUnretainedAttr>(this)->getSpelling();
48030 case attr::ObjCKindOf:
48031 return cast<ObjCKindOfAttr>(this)->getSpelling();
48032 case attr::ObjCMethodFamily:
48033 return cast<ObjCMethodFamilyAttr>(this)->getSpelling();
48034 case attr::ObjCNSObject:
48035 return cast<ObjCNSObjectAttr>(this)->getSpelling();
48036 case attr::ObjCNonLazyClass:
48037 return cast<ObjCNonLazyClassAttr>(this)->getSpelling();
48038 case attr::ObjCNonRuntimeProtocol:
48039 return cast<ObjCNonRuntimeProtocolAttr>(this)->getSpelling();
48040 case attr::ObjCOwnership:
48041 return cast<ObjCOwnershipAttr>(this)->getSpelling();
48042 case attr::ObjCPreciseLifetime:
48043 return cast<ObjCPreciseLifetimeAttr>(this)->getSpelling();
48044 case attr::ObjCRequiresPropertyDefs:
48045 return cast<ObjCRequiresPropertyDefsAttr>(this)->getSpelling();
48046 case attr::ObjCRequiresSuper:
48047 return cast<ObjCRequiresSuperAttr>(this)->getSpelling();
48048 case attr::ObjCReturnsInnerPointer:
48049 return cast<ObjCReturnsInnerPointerAttr>(this)->getSpelling();
48050 case attr::ObjCRootClass:
48051 return cast<ObjCRootClassAttr>(this)->getSpelling();
48052 case attr::ObjCRuntimeName:
48053 return cast<ObjCRuntimeNameAttr>(this)->getSpelling();
48054 case attr::ObjCRuntimeVisible:
48055 return cast<ObjCRuntimeVisibleAttr>(this)->getSpelling();
48056 case attr::ObjCSubclassingRestricted:
48057 return cast<ObjCSubclassingRestrictedAttr>(this)->getSpelling();
48058 case attr::OpenCLAccess:
48059 return cast<OpenCLAccessAttr>(this)->getSpelling();
48060 case attr::OpenCLConstantAddressSpace:
48061 return cast<OpenCLConstantAddressSpaceAttr>(this)->getSpelling();
48062 case attr::OpenCLGenericAddressSpace:
48063 return cast<OpenCLGenericAddressSpaceAttr>(this)->getSpelling();
48064 case attr::OpenCLGlobalAddressSpace:
48065 return cast<OpenCLGlobalAddressSpaceAttr>(this)->getSpelling();
48066 case attr::OpenCLGlobalDeviceAddressSpace:
48067 return cast<OpenCLGlobalDeviceAddressSpaceAttr>(this)->getSpelling();
48068 case attr::OpenCLGlobalHostAddressSpace:
48069 return cast<OpenCLGlobalHostAddressSpaceAttr>(this)->getSpelling();
48070 case attr::OpenCLIntelReqdSubGroupSize:
48071 return cast<OpenCLIntelReqdSubGroupSizeAttr>(this)->getSpelling();
48072 case attr::OpenCLKernel:
48073 return cast<OpenCLKernelAttr>(this)->getSpelling();
48074 case attr::OpenCLLocalAddressSpace:
48075 return cast<OpenCLLocalAddressSpaceAttr>(this)->getSpelling();
48076 case attr::OpenCLPrivateAddressSpace:
48077 return cast<OpenCLPrivateAddressSpaceAttr>(this)->getSpelling();
48078 case attr::OpenCLUnrollHint:
48079 return cast<OpenCLUnrollHintAttr>(this)->getSpelling();
48080 case attr::OptimizeNone:
48081 return cast<OptimizeNoneAttr>(this)->getSpelling();
48082 case attr::Overloadable:
48083 return cast<OverloadableAttr>(this)->getSpelling();
48084 case attr::Override:
48085 return cast<OverrideAttr>(this)->getSpelling();
48086 case attr::Owner:
48087 return cast<OwnerAttr>(this)->getSpelling();
48088 case attr::Ownership:
48089 return cast<OwnershipAttr>(this)->getSpelling();
48090 case attr::Packed:
48091 return cast<PackedAttr>(this)->getSpelling();
48092 case attr::ParamTypestate:
48093 return cast<ParamTypestateAttr>(this)->getSpelling();
48094 case attr::Pascal:
48095 return cast<PascalAttr>(this)->getSpelling();
48096 case attr::PassObjectSize:
48097 return cast<PassObjectSizeAttr>(this)->getSpelling();
48098 case attr::PatchableFunctionEntry:
48099 return cast<PatchableFunctionEntryAttr>(this)->getSpelling();
48100 case attr::Pcs:
48101 return cast<PcsAttr>(this)->getSpelling();
48102 case attr::Pointer:
48103 return cast<PointerAttr>(this)->getSpelling();
48104 case attr::PragmaClangBSSSection:
48105 return cast<PragmaClangBSSSectionAttr>(this)->getSpelling();
48106 case attr::PragmaClangDataSection:
48107 return cast<PragmaClangDataSectionAttr>(this)->getSpelling();
48108 case attr::PragmaClangRelroSection:
48109 return cast<PragmaClangRelroSectionAttr>(this)->getSpelling();
48110 case attr::PragmaClangRodataSection:
48111 return cast<PragmaClangRodataSectionAttr>(this)->getSpelling();
48112 case attr::PragmaClangTextSection:
48113 return cast<PragmaClangTextSectionAttr>(this)->getSpelling();
48114 case attr::PreferredName:
48115 return cast<PreferredNameAttr>(this)->getSpelling();
48116 case attr::PreferredType:
48117 return cast<PreferredTypeAttr>(this)->getSpelling();
48118 case attr::PreserveAll:
48119 return cast<PreserveAllAttr>(this)->getSpelling();
48120 case attr::PreserveMost:
48121 return cast<PreserveMostAttr>(this)->getSpelling();
48122 case attr::PreserveNone:
48123 return cast<PreserveNoneAttr>(this)->getSpelling();
48124 case attr::PtGuardedBy:
48125 return cast<PtGuardedByAttr>(this)->getSpelling();
48126 case attr::PtGuardedVar:
48127 return cast<PtGuardedVarAttr>(this)->getSpelling();
48128 case attr::Ptr32:
48129 return cast<Ptr32Attr>(this)->getSpelling();
48130 case attr::Ptr64:
48131 return cast<Ptr64Attr>(this)->getSpelling();
48132 case attr::Pure:
48133 return cast<PureAttr>(this)->getSpelling();
48134 case attr::RISCVInterrupt:
48135 return cast<RISCVInterruptAttr>(this)->getSpelling();
48136 case attr::RISCVVectorCC:
48137 return cast<RISCVVectorCCAttr>(this)->getSpelling();
48138 case attr::RandomizeLayout:
48139 return cast<RandomizeLayoutAttr>(this)->getSpelling();
48140 case attr::ReadOnlyPlacement:
48141 return cast<ReadOnlyPlacementAttr>(this)->getSpelling();
48142 case attr::RegCall:
48143 return cast<RegCallAttr>(this)->getSpelling();
48144 case attr::Reinitializes:
48145 return cast<ReinitializesAttr>(this)->getSpelling();
48146 case attr::ReleaseCapability:
48147 return cast<ReleaseCapabilityAttr>(this)->getSpelling();
48148 case attr::ReleaseHandle:
48149 return cast<ReleaseHandleAttr>(this)->getSpelling();
48150 case attr::ReqdWorkGroupSize:
48151 return cast<ReqdWorkGroupSizeAttr>(this)->getSpelling();
48152 case attr::RequiresCapability:
48153 return cast<RequiresCapabilityAttr>(this)->getSpelling();
48154 case attr::Restrict:
48155 return cast<RestrictAttr>(this)->getSpelling();
48156 case attr::Retain:
48157 return cast<RetainAttr>(this)->getSpelling();
48158 case attr::ReturnTypestate:
48159 return cast<ReturnTypestateAttr>(this)->getSpelling();
48160 case attr::ReturnsNonNull:
48161 return cast<ReturnsNonNullAttr>(this)->getSpelling();
48162 case attr::ReturnsTwice:
48163 return cast<ReturnsTwiceAttr>(this)->getSpelling();
48164 case attr::SPtr:
48165 return cast<SPtrAttr>(this)->getSpelling();
48166 case attr::SYCLKernel:
48167 return cast<SYCLKernelAttr>(this)->getSpelling();
48168 case attr::SYCLKernelEntryPoint:
48169 return cast<SYCLKernelEntryPointAttr>(this)->getSpelling();
48170 case attr::SYCLSpecialClass:
48171 return cast<SYCLSpecialClassAttr>(this)->getSpelling();
48172 case attr::ScopedLockable:
48173 return cast<ScopedLockableAttr>(this)->getSpelling();
48174 case attr::Section:
48175 return cast<SectionAttr>(this)->getSpelling();
48176 case attr::SelectAny:
48177 return cast<SelectAnyAttr>(this)->getSpelling();
48178 case attr::Sentinel:
48179 return cast<SentinelAttr>(this)->getSpelling();
48180 case attr::SetTypestate:
48181 return cast<SetTypestateAttr>(this)->getSpelling();
48182 case attr::SharedTrylockFunction:
48183 return cast<SharedTrylockFunctionAttr>(this)->getSpelling();
48184 case attr::SizedBy:
48185 return cast<SizedByAttr>(this)->getSpelling();
48186 case attr::SizedByOrNull:
48187 return cast<SizedByOrNullAttr>(this)->getSpelling();
48188 case attr::SpeculativeLoadHardening:
48189 return cast<SpeculativeLoadHardeningAttr>(this)->getSpelling();
48190 case attr::StandaloneDebug:
48191 return cast<StandaloneDebugAttr>(this)->getSpelling();
48192 case attr::StdCall:
48193 return cast<StdCallAttr>(this)->getSpelling();
48194 case attr::StrictFP:
48195 return cast<StrictFPAttr>(this)->getSpelling();
48196 case attr::StrictGuardStackCheck:
48197 return cast<StrictGuardStackCheckAttr>(this)->getSpelling();
48198 case attr::Suppress:
48199 return cast<SuppressAttr>(this)->getSpelling();
48200 case attr::SwiftAsync:
48201 return cast<SwiftAsyncAttr>(this)->getSpelling();
48202 case attr::SwiftAsyncCall:
48203 return cast<SwiftAsyncCallAttr>(this)->getSpelling();
48204 case attr::SwiftAsyncContext:
48205 return cast<SwiftAsyncContextAttr>(this)->getSpelling();
48206 case attr::SwiftAsyncError:
48207 return cast<SwiftAsyncErrorAttr>(this)->getSpelling();
48208 case attr::SwiftAsyncName:
48209 return cast<SwiftAsyncNameAttr>(this)->getSpelling();
48210 case attr::SwiftAttr:
48211 return cast<SwiftAttrAttr>(this)->getSpelling();
48212 case attr::SwiftBridge:
48213 return cast<SwiftBridgeAttr>(this)->getSpelling();
48214 case attr::SwiftBridgedTypedef:
48215 return cast<SwiftBridgedTypedefAttr>(this)->getSpelling();
48216 case attr::SwiftCall:
48217 return cast<SwiftCallAttr>(this)->getSpelling();
48218 case attr::SwiftContext:
48219 return cast<SwiftContextAttr>(this)->getSpelling();
48220 case attr::SwiftError:
48221 return cast<SwiftErrorAttr>(this)->getSpelling();
48222 case attr::SwiftErrorResult:
48223 return cast<SwiftErrorResultAttr>(this)->getSpelling();
48224 case attr::SwiftImportAsNonGeneric:
48225 return cast<SwiftImportAsNonGenericAttr>(this)->getSpelling();
48226 case attr::SwiftImportPropertyAsAccessors:
48227 return cast<SwiftImportPropertyAsAccessorsAttr>(this)->getSpelling();
48228 case attr::SwiftIndirectResult:
48229 return cast<SwiftIndirectResultAttr>(this)->getSpelling();
48230 case attr::SwiftName:
48231 return cast<SwiftNameAttr>(this)->getSpelling();
48232 case attr::SwiftNewType:
48233 return cast<SwiftNewTypeAttr>(this)->getSpelling();
48234 case attr::SwiftObjCMembers:
48235 return cast<SwiftObjCMembersAttr>(this)->getSpelling();
48236 case attr::SwiftPrivate:
48237 return cast<SwiftPrivateAttr>(this)->getSpelling();
48238 case attr::SwiftVersionedAddition:
48239 return cast<SwiftVersionedAdditionAttr>(this)->getSpelling();
48240 case attr::SwiftVersionedRemoval:
48241 return cast<SwiftVersionedRemovalAttr>(this)->getSpelling();
48242 case attr::SysVABI:
48243 return cast<SysVABIAttr>(this)->getSpelling();
48244 case attr::TLSModel:
48245 return cast<TLSModelAttr>(this)->getSpelling();
48246 case attr::Target:
48247 return cast<TargetAttr>(this)->getSpelling();
48248 case attr::TargetClones:
48249 return cast<TargetClonesAttr>(this)->getSpelling();
48250 case attr::TargetVersion:
48251 return cast<TargetVersionAttr>(this)->getSpelling();
48252 case attr::TestTypestate:
48253 return cast<TestTypestateAttr>(this)->getSpelling();
48254 case attr::ThisCall:
48255 return cast<ThisCallAttr>(this)->getSpelling();
48256 case attr::Thread:
48257 return cast<ThreadAttr>(this)->getSpelling();
48258 case attr::TransparentUnion:
48259 return cast<TransparentUnionAttr>(this)->getSpelling();
48260 case attr::TrivialABI:
48261 return cast<TrivialABIAttr>(this)->getSpelling();
48262 case attr::TryAcquireCapability:
48263 return cast<TryAcquireCapabilityAttr>(this)->getSpelling();
48264 case attr::TypeNonNull:
48265 return cast<TypeNonNullAttr>(this)->getSpelling();
48266 case attr::TypeNullUnspecified:
48267 return cast<TypeNullUnspecifiedAttr>(this)->getSpelling();
48268 case attr::TypeNullable:
48269 return cast<TypeNullableAttr>(this)->getSpelling();
48270 case attr::TypeNullableResult:
48271 return cast<TypeNullableResultAttr>(this)->getSpelling();
48272 case attr::TypeTagForDatatype:
48273 return cast<TypeTagForDatatypeAttr>(this)->getSpelling();
48274 case attr::TypeVisibility:
48275 return cast<TypeVisibilityAttr>(this)->getSpelling();
48276 case attr::UPtr:
48277 return cast<UPtrAttr>(this)->getSpelling();
48278 case attr::Unavailable:
48279 return cast<UnavailableAttr>(this)->getSpelling();
48280 case attr::Uninitialized:
48281 return cast<UninitializedAttr>(this)->getSpelling();
48282 case attr::Unlikely:
48283 return cast<UnlikelyAttr>(this)->getSpelling();
48284 case attr::UnsafeBufferUsage:
48285 return cast<UnsafeBufferUsageAttr>(this)->getSpelling();
48286 case attr::Unused:
48287 return cast<UnusedAttr>(this)->getSpelling();
48288 case attr::UseHandle:
48289 return cast<UseHandleAttr>(this)->getSpelling();
48290 case attr::Used:
48291 return cast<UsedAttr>(this)->getSpelling();
48292 case attr::UsingIfExists:
48293 return cast<UsingIfExistsAttr>(this)->getSpelling();
48294 case attr::Uuid:
48295 return cast<UuidAttr>(this)->getSpelling();
48296 case attr::VTablePointerAuthentication:
48297 return cast<VTablePointerAuthenticationAttr>(this)->getSpelling();
48298 case attr::VecReturn:
48299 return cast<VecReturnAttr>(this)->getSpelling();
48300 case attr::VecTypeHint:
48301 return cast<VecTypeHintAttr>(this)->getSpelling();
48302 case attr::VectorCall:
48303 return cast<VectorCallAttr>(this)->getSpelling();
48304 case attr::Visibility:
48305 return cast<VisibilityAttr>(this)->getSpelling();
48306 case attr::WarnUnused:
48307 return cast<WarnUnusedAttr>(this)->getSpelling();
48308 case attr::WarnUnusedResult:
48309 return cast<WarnUnusedResultAttr>(this)->getSpelling();
48310 case attr::Weak:
48311 return cast<WeakAttr>(this)->getSpelling();
48312 case attr::WeakImport:
48313 return cast<WeakImportAttr>(this)->getSpelling();
48314 case attr::WeakRef:
48315 return cast<WeakRefAttr>(this)->getSpelling();
48316 case attr::WebAssemblyExportName:
48317 return cast<WebAssemblyExportNameAttr>(this)->getSpelling();
48318 case attr::WebAssemblyFuncref:
48319 return cast<WebAssemblyFuncrefAttr>(this)->getSpelling();
48320 case attr::WebAssemblyImportModule:
48321 return cast<WebAssemblyImportModuleAttr>(this)->getSpelling();
48322 case attr::WebAssemblyImportName:
48323 return cast<WebAssemblyImportNameAttr>(this)->getSpelling();
48324 case attr::WorkGroupSizeHint:
48325 return cast<WorkGroupSizeHintAttr>(this)->getSpelling();
48326 case attr::X86ForceAlignArgPointer:
48327 return cast<X86ForceAlignArgPointerAttr>(this)->getSpelling();
48328 case attr::XRayInstrument:
48329 return cast<XRayInstrumentAttr>(this)->getSpelling();
48330 case attr::XRayLogArgs:
48331 return cast<XRayLogArgsAttr>(this)->getSpelling();
48332 case attr::ZeroCallUsedRegs:
48333 return cast<ZeroCallUsedRegsAttr>(this)->getSpelling();
48334 }
48335 llvm_unreachable("Unexpected attribute kind!");
48336 }
48337
48338 Attr *Attr::clone(ASTContext &C) const {
48339 switch (getKind()) {
48340 case attr::AArch64SVEPcs:
48341 return cast<AArch64SVEPcsAttr>(this)->clone(C);
48342 case attr::AArch64VectorPcs:
48343 return cast<AArch64VectorPcsAttr>(this)->clone(C);
48344 case attr::AMDGPUFlatWorkGroupSize:
48345 return cast<AMDGPUFlatWorkGroupSizeAttr>(this)->clone(C);
48346 case attr::AMDGPUKernelCall:
48347 return cast<AMDGPUKernelCallAttr>(this)->clone(C);
48348 case attr::AMDGPUMaxNumWorkGroups:
48349 return cast<AMDGPUMaxNumWorkGroupsAttr>(this)->clone(C);
48350 case attr::AMDGPUNumSGPR:
48351 return cast<AMDGPUNumSGPRAttr>(this)->clone(C);
48352 case attr::AMDGPUNumVGPR:
48353 return cast<AMDGPUNumVGPRAttr>(this)->clone(C);
48354 case attr::AMDGPUWavesPerEU:
48355 return cast<AMDGPUWavesPerEUAttr>(this)->clone(C);
48356 case attr::ARMInterrupt:
48357 return cast<ARMInterruptAttr>(this)->clone(C);
48358 case attr::AVRInterrupt:
48359 return cast<AVRInterruptAttr>(this)->clone(C);
48360 case attr::AVRSignal:
48361 return cast<AVRSignalAttr>(this)->clone(C);
48362 case attr::AbiTag:
48363 return cast<AbiTagAttr>(this)->clone(C);
48364 case attr::AcquireCapability:
48365 return cast<AcquireCapabilityAttr>(this)->clone(C);
48366 case attr::AcquireHandle:
48367 return cast<AcquireHandleAttr>(this)->clone(C);
48368 case attr::AcquiredAfter:
48369 return cast<AcquiredAfterAttr>(this)->clone(C);
48370 case attr::AcquiredBefore:
48371 return cast<AcquiredBeforeAttr>(this)->clone(C);
48372 case attr::AddressSpace:
48373 return cast<AddressSpaceAttr>(this)->clone(C);
48374 case attr::Alias:
48375 return cast<AliasAttr>(this)->clone(C);
48376 case attr::AlignMac68k:
48377 return cast<AlignMac68kAttr>(this)->clone(C);
48378 case attr::AlignNatural:
48379 return cast<AlignNaturalAttr>(this)->clone(C);
48380 case attr::AlignValue:
48381 return cast<AlignValueAttr>(this)->clone(C);
48382 case attr::Aligned:
48383 return cast<AlignedAttr>(this)->clone(C);
48384 case attr::AllocAlign:
48385 return cast<AllocAlignAttr>(this)->clone(C);
48386 case attr::AllocSize:
48387 return cast<AllocSizeAttr>(this)->clone(C);
48388 case attr::Allocating:
48389 return cast<AllocatingAttr>(this)->clone(C);
48390 case attr::AlwaysDestroy:
48391 return cast<AlwaysDestroyAttr>(this)->clone(C);
48392 case attr::AlwaysInline:
48393 return cast<AlwaysInlineAttr>(this)->clone(C);
48394 case attr::AnalyzerNoReturn:
48395 return cast<AnalyzerNoReturnAttr>(this)->clone(C);
48396 case attr::Annotate:
48397 return cast<AnnotateAttr>(this)->clone(C);
48398 case attr::AnnotateType:
48399 return cast<AnnotateTypeAttr>(this)->clone(C);
48400 case attr::AnyX86Interrupt:
48401 return cast<AnyX86InterruptAttr>(this)->clone(C);
48402 case attr::AnyX86NoCallerSavedRegisters:
48403 return cast<AnyX86NoCallerSavedRegistersAttr>(this)->clone(C);
48404 case attr::AnyX86NoCfCheck:
48405 return cast<AnyX86NoCfCheckAttr>(this)->clone(C);
48406 case attr::ArcWeakrefUnavailable:
48407 return cast<ArcWeakrefUnavailableAttr>(this)->clone(C);
48408 case attr::ArgumentWithTypeTag:
48409 return cast<ArgumentWithTypeTagAttr>(this)->clone(C);
48410 case attr::ArmAgnostic:
48411 return cast<ArmAgnosticAttr>(this)->clone(C);
48412 case attr::ArmBuiltinAlias:
48413 return cast<ArmBuiltinAliasAttr>(this)->clone(C);
48414 case attr::ArmIn:
48415 return cast<ArmInAttr>(this)->clone(C);
48416 case attr::ArmInOut:
48417 return cast<ArmInOutAttr>(this)->clone(C);
48418 case attr::ArmLocallyStreaming:
48419 return cast<ArmLocallyStreamingAttr>(this)->clone(C);
48420 case attr::ArmMveStrictPolymorphism:
48421 return cast<ArmMveStrictPolymorphismAttr>(this)->clone(C);
48422 case attr::ArmNew:
48423 return cast<ArmNewAttr>(this)->clone(C);
48424 case attr::ArmOut:
48425 return cast<ArmOutAttr>(this)->clone(C);
48426 case attr::ArmPreserves:
48427 return cast<ArmPreservesAttr>(this)->clone(C);
48428 case attr::ArmStreaming:
48429 return cast<ArmStreamingAttr>(this)->clone(C);
48430 case attr::ArmStreamingCompatible:
48431 return cast<ArmStreamingCompatibleAttr>(this)->clone(C);
48432 case attr::Artificial:
48433 return cast<ArtificialAttr>(this)->clone(C);
48434 case attr::AsmLabel:
48435 return cast<AsmLabelAttr>(this)->clone(C);
48436 case attr::AssertCapability:
48437 return cast<AssertCapabilityAttr>(this)->clone(C);
48438 case attr::AssertExclusiveLock:
48439 return cast<AssertExclusiveLockAttr>(this)->clone(C);
48440 case attr::AssertSharedLock:
48441 return cast<AssertSharedLockAttr>(this)->clone(C);
48442 case attr::AssumeAligned:
48443 return cast<AssumeAlignedAttr>(this)->clone(C);
48444 case attr::Availability:
48445 return cast<AvailabilityAttr>(this)->clone(C);
48446 case attr::AvailableOnlyInDefaultEvalMethod:
48447 return cast<AvailableOnlyInDefaultEvalMethodAttr>(this)->clone(C);
48448 case attr::BPFFastCall:
48449 return cast<BPFFastCallAttr>(this)->clone(C);
48450 case attr::BPFPreserveAccessIndex:
48451 return cast<BPFPreserveAccessIndexAttr>(this)->clone(C);
48452 case attr::BPFPreserveStaticOffset:
48453 return cast<BPFPreserveStaticOffsetAttr>(this)->clone(C);
48454 case attr::BTFDeclTag:
48455 return cast<BTFDeclTagAttr>(this)->clone(C);
48456 case attr::BTFTypeTag:
48457 return cast<BTFTypeTagAttr>(this)->clone(C);
48458 case attr::Blocking:
48459 return cast<BlockingAttr>(this)->clone(C);
48460 case attr::Blocks:
48461 return cast<BlocksAttr>(this)->clone(C);
48462 case attr::Builtin:
48463 return cast<BuiltinAttr>(this)->clone(C);
48464 case attr::BuiltinAlias:
48465 return cast<BuiltinAliasAttr>(this)->clone(C);
48466 case attr::C11NoReturn:
48467 return cast<C11NoReturnAttr>(this)->clone(C);
48468 case attr::CDecl:
48469 return cast<CDeclAttr>(this)->clone(C);
48470 case attr::CFAuditedTransfer:
48471 return cast<CFAuditedTransferAttr>(this)->clone(C);
48472 case attr::CFConsumed:
48473 return cast<CFConsumedAttr>(this)->clone(C);
48474 case attr::CFGuard:
48475 return cast<CFGuardAttr>(this)->clone(C);
48476 case attr::CFICanonicalJumpTable:
48477 return cast<CFICanonicalJumpTableAttr>(this)->clone(C);
48478 case attr::CFReturnsNotRetained:
48479 return cast<CFReturnsNotRetainedAttr>(this)->clone(C);
48480 case attr::CFReturnsRetained:
48481 return cast<CFReturnsRetainedAttr>(this)->clone(C);
48482 case attr::CFUnknownTransfer:
48483 return cast<CFUnknownTransferAttr>(this)->clone(C);
48484 case attr::CPUDispatch:
48485 return cast<CPUDispatchAttr>(this)->clone(C);
48486 case attr::CPUSpecific:
48487 return cast<CPUSpecificAttr>(this)->clone(C);
48488 case attr::CUDAConstant:
48489 return cast<CUDAConstantAttr>(this)->clone(C);
48490 case attr::CUDADevice:
48491 return cast<CUDADeviceAttr>(this)->clone(C);
48492 case attr::CUDADeviceBuiltinSurfaceType:
48493 return cast<CUDADeviceBuiltinSurfaceTypeAttr>(this)->clone(C);
48494 case attr::CUDADeviceBuiltinTextureType:
48495 return cast<CUDADeviceBuiltinTextureTypeAttr>(this)->clone(C);
48496 case attr::CUDAGlobal:
48497 return cast<CUDAGlobalAttr>(this)->clone(C);
48498 case attr::CUDAGridConstant:
48499 return cast<CUDAGridConstantAttr>(this)->clone(C);
48500 case attr::CUDAHost:
48501 return cast<CUDAHostAttr>(this)->clone(C);
48502 case attr::CUDAInvalidTarget:
48503 return cast<CUDAInvalidTargetAttr>(this)->clone(C);
48504 case attr::CUDALaunchBounds:
48505 return cast<CUDALaunchBoundsAttr>(this)->clone(C);
48506 case attr::CUDAShared:
48507 return cast<CUDASharedAttr>(this)->clone(C);
48508 case attr::CXX11NoReturn:
48509 return cast<CXX11NoReturnAttr>(this)->clone(C);
48510 case attr::CXXAssume:
48511 return cast<CXXAssumeAttr>(this)->clone(C);
48512 case attr::CallableWhen:
48513 return cast<CallableWhenAttr>(this)->clone(C);
48514 case attr::Callback:
48515 return cast<CallbackAttr>(this)->clone(C);
48516 case attr::CalledOnce:
48517 return cast<CalledOnceAttr>(this)->clone(C);
48518 case attr::Capability:
48519 return cast<CapabilityAttr>(this)->clone(C);
48520 case attr::CapturedRecord:
48521 return cast<CapturedRecordAttr>(this)->clone(C);
48522 case attr::CarriesDependency:
48523 return cast<CarriesDependencyAttr>(this)->clone(C);
48524 case attr::Cleanup:
48525 return cast<CleanupAttr>(this)->clone(C);
48526 case attr::ClspvLibclcBuiltin:
48527 return cast<ClspvLibclcBuiltinAttr>(this)->clone(C);
48528 case attr::CmseNSCall:
48529 return cast<CmseNSCallAttr>(this)->clone(C);
48530 case attr::CmseNSEntry:
48531 return cast<CmseNSEntryAttr>(this)->clone(C);
48532 case attr::CodeAlign:
48533 return cast<CodeAlignAttr>(this)->clone(C);
48534 case attr::CodeModel:
48535 return cast<CodeModelAttr>(this)->clone(C);
48536 case attr::CodeSeg:
48537 return cast<CodeSegAttr>(this)->clone(C);
48538 case attr::Cold:
48539 return cast<ColdAttr>(this)->clone(C);
48540 case attr::Common:
48541 return cast<CommonAttr>(this)->clone(C);
48542 case attr::Const:
48543 return cast<ConstAttr>(this)->clone(C);
48544 case attr::ConstInit:
48545 return cast<ConstInitAttr>(this)->clone(C);
48546 case attr::Constructor:
48547 return cast<ConstructorAttr>(this)->clone(C);
48548 case attr::Consumable:
48549 return cast<ConsumableAttr>(this)->clone(C);
48550 case attr::ConsumableAutoCast:
48551 return cast<ConsumableAutoCastAttr>(this)->clone(C);
48552 case attr::ConsumableSetOnRead:
48553 return cast<ConsumableSetOnReadAttr>(this)->clone(C);
48554 case attr::Convergent:
48555 return cast<ConvergentAttr>(this)->clone(C);
48556 case attr::CoroAwaitElidable:
48557 return cast<CoroAwaitElidableAttr>(this)->clone(C);
48558 case attr::CoroAwaitElidableArgument:
48559 return cast<CoroAwaitElidableArgumentAttr>(this)->clone(C);
48560 case attr::CoroDisableLifetimeBound:
48561 return cast<CoroDisableLifetimeBoundAttr>(this)->clone(C);
48562 case attr::CoroLifetimeBound:
48563 return cast<CoroLifetimeBoundAttr>(this)->clone(C);
48564 case attr::CoroOnlyDestroyWhenComplete:
48565 return cast<CoroOnlyDestroyWhenCompleteAttr>(this)->clone(C);
48566 case attr::CoroReturnType:
48567 return cast<CoroReturnTypeAttr>(this)->clone(C);
48568 case attr::CoroWrapper:
48569 return cast<CoroWrapperAttr>(this)->clone(C);
48570 case attr::CountedBy:
48571 return cast<CountedByAttr>(this)->clone(C);
48572 case attr::CountedByOrNull:
48573 return cast<CountedByOrNullAttr>(this)->clone(C);
48574 case attr::DLLExport:
48575 return cast<DLLExportAttr>(this)->clone(C);
48576 case attr::DLLExportStaticLocal:
48577 return cast<DLLExportStaticLocalAttr>(this)->clone(C);
48578 case attr::DLLImport:
48579 return cast<DLLImportAttr>(this)->clone(C);
48580 case attr::DLLImportStaticLocal:
48581 return cast<DLLImportStaticLocalAttr>(this)->clone(C);
48582 case attr::Deprecated:
48583 return cast<DeprecatedAttr>(this)->clone(C);
48584 case attr::Destructor:
48585 return cast<DestructorAttr>(this)->clone(C);
48586 case attr::DiagnoseAsBuiltin:
48587 return cast<DiagnoseAsBuiltinAttr>(this)->clone(C);
48588 case attr::DiagnoseIf:
48589 return cast<DiagnoseIfAttr>(this)->clone(C);
48590 case attr::DisableSanitizerInstrumentation:
48591 return cast<DisableSanitizerInstrumentationAttr>(this)->clone(C);
48592 case attr::DisableTailCalls:
48593 return cast<DisableTailCallsAttr>(this)->clone(C);
48594 case attr::EmptyBases:
48595 return cast<EmptyBasesAttr>(this)->clone(C);
48596 case attr::EnableIf:
48597 return cast<EnableIfAttr>(this)->clone(C);
48598 case attr::EnforceTCB:
48599 return cast<EnforceTCBAttr>(this)->clone(C);
48600 case attr::EnforceTCBLeaf:
48601 return cast<EnforceTCBLeafAttr>(this)->clone(C);
48602 case attr::EnumExtensibility:
48603 return cast<EnumExtensibilityAttr>(this)->clone(C);
48604 case attr::Error:
48605 return cast<ErrorAttr>(this)->clone(C);
48606 case attr::ExcludeFromExplicitInstantiation:
48607 return cast<ExcludeFromExplicitInstantiationAttr>(this)->clone(C);
48608 case attr::ExclusiveTrylockFunction:
48609 return cast<ExclusiveTrylockFunctionAttr>(this)->clone(C);
48610 case attr::ExplicitInit:
48611 return cast<ExplicitInitAttr>(this)->clone(C);
48612 case attr::ExternalSourceSymbol:
48613 return cast<ExternalSourceSymbolAttr>(this)->clone(C);
48614 case attr::FallThrough:
48615 return cast<FallThroughAttr>(this)->clone(C);
48616 case attr::FastCall:
48617 return cast<FastCallAttr>(this)->clone(C);
48618 case attr::Final:
48619 return cast<FinalAttr>(this)->clone(C);
48620 case attr::FlagEnum:
48621 return cast<FlagEnumAttr>(this)->clone(C);
48622 case attr::Flatten:
48623 return cast<FlattenAttr>(this)->clone(C);
48624 case attr::Format:
48625 return cast<FormatAttr>(this)->clone(C);
48626 case attr::FormatArg:
48627 return cast<FormatArgAttr>(this)->clone(C);
48628 case attr::FunctionReturnThunks:
48629 return cast<FunctionReturnThunksAttr>(this)->clone(C);
48630 case attr::GNUInline:
48631 return cast<GNUInlineAttr>(this)->clone(C);
48632 case attr::GuardedBy:
48633 return cast<GuardedByAttr>(this)->clone(C);
48634 case attr::GuardedVar:
48635 return cast<GuardedVarAttr>(this)->clone(C);
48636 case attr::HIPManaged:
48637 return cast<HIPManagedAttr>(this)->clone(C);
48638 case attr::HLSLContainedType:
48639 return cast<HLSLContainedTypeAttr>(this)->clone(C);
48640 case attr::HLSLControlFlowHint:
48641 return cast<HLSLControlFlowHintAttr>(this)->clone(C);
48642 case attr::HLSLGroupSharedAddressSpace:
48643 return cast<HLSLGroupSharedAddressSpaceAttr>(this)->clone(C);
48644 case attr::HLSLLoopHint:
48645 return cast<HLSLLoopHintAttr>(this)->clone(C);
48646 case attr::HLSLNumThreads:
48647 return cast<HLSLNumThreadsAttr>(this)->clone(C);
48648 case attr::HLSLPackOffset:
48649 return cast<HLSLPackOffsetAttr>(this)->clone(C);
48650 case attr::HLSLParamModifier:
48651 return cast<HLSLParamModifierAttr>(this)->clone(C);
48652 case attr::HLSLROV:
48653 return cast<HLSLROVAttr>(this)->clone(C);
48654 case attr::HLSLRawBuffer:
48655 return cast<HLSLRawBufferAttr>(this)->clone(C);
48656 case attr::HLSLResource:
48657 return cast<HLSLResourceAttr>(this)->clone(C);
48658 case attr::HLSLResourceBinding:
48659 return cast<HLSLResourceBindingAttr>(this)->clone(C);
48660 case attr::HLSLResourceClass:
48661 return cast<HLSLResourceClassAttr>(this)->clone(C);
48662 case attr::HLSLSV_DispatchThreadID:
48663 return cast<HLSLSV_DispatchThreadIDAttr>(this)->clone(C);
48664 case attr::HLSLSV_GroupID:
48665 return cast<HLSLSV_GroupIDAttr>(this)->clone(C);
48666 case attr::HLSLSV_GroupIndex:
48667 return cast<HLSLSV_GroupIndexAttr>(this)->clone(C);
48668 case attr::HLSLSV_GroupThreadID:
48669 return cast<HLSLSV_GroupThreadIDAttr>(this)->clone(C);
48670 case attr::HLSLShader:
48671 return cast<HLSLShaderAttr>(this)->clone(C);
48672 case attr::HLSLWaveSize:
48673 return cast<HLSLWaveSizeAttr>(this)->clone(C);
48674 case attr::Hot:
48675 return cast<HotAttr>(this)->clone(C);
48676 case attr::HybridPatchable:
48677 return cast<HybridPatchableAttr>(this)->clone(C);
48678 case attr::IBAction:
48679 return cast<IBActionAttr>(this)->clone(C);
48680 case attr::IBOutlet:
48681 return cast<IBOutletAttr>(this)->clone(C);
48682 case attr::IBOutletCollection:
48683 return cast<IBOutletCollectionAttr>(this)->clone(C);
48684 case attr::IFunc:
48685 return cast<IFuncAttr>(this)->clone(C);
48686 case attr::InitPriority:
48687 return cast<InitPriorityAttr>(this)->clone(C);
48688 case attr::InitSeg:
48689 return cast<InitSegAttr>(this)->clone(C);
48690 case attr::IntelOclBicc:
48691 return cast<IntelOclBiccAttr>(this)->clone(C);
48692 case attr::InternalLinkage:
48693 return cast<InternalLinkageAttr>(this)->clone(C);
48694 case attr::LTOVisibilityPublic:
48695 return cast<LTOVisibilityPublicAttr>(this)->clone(C);
48696 case attr::LayoutVersion:
48697 return cast<LayoutVersionAttr>(this)->clone(C);
48698 case attr::Leaf:
48699 return cast<LeafAttr>(this)->clone(C);
48700 case attr::LifetimeBound:
48701 return cast<LifetimeBoundAttr>(this)->clone(C);
48702 case attr::LifetimeCaptureBy:
48703 return cast<LifetimeCaptureByAttr>(this)->clone(C);
48704 case attr::Likely:
48705 return cast<LikelyAttr>(this)->clone(C);
48706 case attr::LoaderUninitialized:
48707 return cast<LoaderUninitializedAttr>(this)->clone(C);
48708 case attr::LockReturned:
48709 return cast<LockReturnedAttr>(this)->clone(C);
48710 case attr::LocksExcluded:
48711 return cast<LocksExcludedAttr>(this)->clone(C);
48712 case attr::LoopHint:
48713 return cast<LoopHintAttr>(this)->clone(C);
48714 case attr::M68kInterrupt:
48715 return cast<M68kInterruptAttr>(this)->clone(C);
48716 case attr::M68kRTD:
48717 return cast<M68kRTDAttr>(this)->clone(C);
48718 case attr::MIGServerRoutine:
48719 return cast<MIGServerRoutineAttr>(this)->clone(C);
48720 case attr::MSABI:
48721 return cast<MSABIAttr>(this)->clone(C);
48722 case attr::MSAllocator:
48723 return cast<MSAllocatorAttr>(this)->clone(C);
48724 case attr::MSConstexpr:
48725 return cast<MSConstexprAttr>(this)->clone(C);
48726 case attr::MSInheritance:
48727 return cast<MSInheritanceAttr>(this)->clone(C);
48728 case attr::MSNoVTable:
48729 return cast<MSNoVTableAttr>(this)->clone(C);
48730 case attr::MSP430Interrupt:
48731 return cast<MSP430InterruptAttr>(this)->clone(C);
48732 case attr::MSStruct:
48733 return cast<MSStructAttr>(this)->clone(C);
48734 case attr::MSVtorDisp:
48735 return cast<MSVtorDispAttr>(this)->clone(C);
48736 case attr::MaxFieldAlignment:
48737 return cast<MaxFieldAlignmentAttr>(this)->clone(C);
48738 case attr::MayAlias:
48739 return cast<MayAliasAttr>(this)->clone(C);
48740 case attr::MaybeUndef:
48741 return cast<MaybeUndefAttr>(this)->clone(C);
48742 case attr::MicroMips:
48743 return cast<MicroMipsAttr>(this)->clone(C);
48744 case attr::MinSize:
48745 return cast<MinSizeAttr>(this)->clone(C);
48746 case attr::MinVectorWidth:
48747 return cast<MinVectorWidthAttr>(this)->clone(C);
48748 case attr::Mips16:
48749 return cast<Mips16Attr>(this)->clone(C);
48750 case attr::MipsInterrupt:
48751 return cast<MipsInterruptAttr>(this)->clone(C);
48752 case attr::MipsLongCall:
48753 return cast<MipsLongCallAttr>(this)->clone(C);
48754 case attr::MipsShortCall:
48755 return cast<MipsShortCallAttr>(this)->clone(C);
48756 case attr::Mode:
48757 return cast<ModeAttr>(this)->clone(C);
48758 case attr::MustTail:
48759 return cast<MustTailAttr>(this)->clone(C);
48760 case attr::NSConsumed:
48761 return cast<NSConsumedAttr>(this)->clone(C);
48762 case attr::NSConsumesSelf:
48763 return cast<NSConsumesSelfAttr>(this)->clone(C);
48764 case attr::NSErrorDomain:
48765 return cast<NSErrorDomainAttr>(this)->clone(C);
48766 case attr::NSReturnsAutoreleased:
48767 return cast<NSReturnsAutoreleasedAttr>(this)->clone(C);
48768 case attr::NSReturnsNotRetained:
48769 return cast<NSReturnsNotRetainedAttr>(this)->clone(C);
48770 case attr::NSReturnsRetained:
48771 return cast<NSReturnsRetainedAttr>(this)->clone(C);
48772 case attr::NVPTXKernel:
48773 return cast<NVPTXKernelAttr>(this)->clone(C);
48774 case attr::Naked:
48775 return cast<NakedAttr>(this)->clone(C);
48776 case attr::NoAlias:
48777 return cast<NoAliasAttr>(this)->clone(C);
48778 case attr::NoBuiltin:
48779 return cast<NoBuiltinAttr>(this)->clone(C);
48780 case attr::NoCommon:
48781 return cast<NoCommonAttr>(this)->clone(C);
48782 case attr::NoConvergent:
48783 return cast<NoConvergentAttr>(this)->clone(C);
48784 case attr::NoDebug:
48785 return cast<NoDebugAttr>(this)->clone(C);
48786 case attr::NoDeref:
48787 return cast<NoDerefAttr>(this)->clone(C);
48788 case attr::NoDestroy:
48789 return cast<NoDestroyAttr>(this)->clone(C);
48790 case attr::NoDuplicate:
48791 return cast<NoDuplicateAttr>(this)->clone(C);
48792 case attr::NoEscape:
48793 return cast<NoEscapeAttr>(this)->clone(C);
48794 case attr::NoInline:
48795 return cast<NoInlineAttr>(this)->clone(C);
48796 case attr::NoInstrumentFunction:
48797 return cast<NoInstrumentFunctionAttr>(this)->clone(C);
48798 case attr::NoMerge:
48799 return cast<NoMergeAttr>(this)->clone(C);
48800 case attr::NoMicroMips:
48801 return cast<NoMicroMipsAttr>(this)->clone(C);
48802 case attr::NoMips16:
48803 return cast<NoMips16Attr>(this)->clone(C);
48804 case attr::NoProfileFunction:
48805 return cast<NoProfileFunctionAttr>(this)->clone(C);
48806 case attr::NoRandomizeLayout:
48807 return cast<NoRandomizeLayoutAttr>(this)->clone(C);
48808 case attr::NoReturn:
48809 return cast<NoReturnAttr>(this)->clone(C);
48810 case attr::NoSanitize:
48811 return cast<NoSanitizeAttr>(this)->clone(C);
48812 case attr::NoSpecializations:
48813 return cast<NoSpecializationsAttr>(this)->clone(C);
48814 case attr::NoSpeculativeLoadHardening:
48815 return cast<NoSpeculativeLoadHardeningAttr>(this)->clone(C);
48816 case attr::NoSplitStack:
48817 return cast<NoSplitStackAttr>(this)->clone(C);
48818 case attr::NoStackProtector:
48819 return cast<NoStackProtectorAttr>(this)->clone(C);
48820 case attr::NoThreadSafetyAnalysis:
48821 return cast<NoThreadSafetyAnalysisAttr>(this)->clone(C);
48822 case attr::NoThrow:
48823 return cast<NoThrowAttr>(this)->clone(C);
48824 case attr::NoTrivialAutoVarInit:
48825 return cast<NoTrivialAutoVarInitAttr>(this)->clone(C);
48826 case attr::NoUniqueAddress:
48827 return cast<NoUniqueAddressAttr>(this)->clone(C);
48828 case attr::NoUwtable:
48829 return cast<NoUwtableAttr>(this)->clone(C);
48830 case attr::NonAllocating:
48831 return cast<NonAllocatingAttr>(this)->clone(C);
48832 case attr::NonBlocking:
48833 return cast<NonBlockingAttr>(this)->clone(C);
48834 case attr::NonNull:
48835 return cast<NonNullAttr>(this)->clone(C);
48836 case attr::NotTailCalled:
48837 return cast<NotTailCalledAttr>(this)->clone(C);
48838 case attr::OMPAllocateDecl:
48839 return cast<OMPAllocateDeclAttr>(this)->clone(C);
48840 case attr::OMPAssume:
48841 return cast<OMPAssumeAttr>(this)->clone(C);
48842 case attr::OMPCaptureKind:
48843 return cast<OMPCaptureKindAttr>(this)->clone(C);
48844 case attr::OMPCaptureNoInit:
48845 return cast<OMPCaptureNoInitAttr>(this)->clone(C);
48846 case attr::OMPDeclareSimdDecl:
48847 return cast<OMPDeclareSimdDeclAttr>(this)->clone(C);
48848 case attr::OMPDeclareTargetDecl:
48849 return cast<OMPDeclareTargetDeclAttr>(this)->clone(C);
48850 case attr::OMPDeclareVariant:
48851 return cast<OMPDeclareVariantAttr>(this)->clone(C);
48852 case attr::OMPReferencedVar:
48853 return cast<OMPReferencedVarAttr>(this)->clone(C);
48854 case attr::OMPThreadPrivateDecl:
48855 return cast<OMPThreadPrivateDeclAttr>(this)->clone(C);
48856 case attr::OSConsumed:
48857 return cast<OSConsumedAttr>(this)->clone(C);
48858 case attr::OSConsumesThis:
48859 return cast<OSConsumesThisAttr>(this)->clone(C);
48860 case attr::OSReturnsNotRetained:
48861 return cast<OSReturnsNotRetainedAttr>(this)->clone(C);
48862 case attr::OSReturnsRetained:
48863 return cast<OSReturnsRetainedAttr>(this)->clone(C);
48864 case attr::OSReturnsRetainedOnNonZero:
48865 return cast<OSReturnsRetainedOnNonZeroAttr>(this)->clone(C);
48866 case attr::OSReturnsRetainedOnZero:
48867 return cast<OSReturnsRetainedOnZeroAttr>(this)->clone(C);
48868 case attr::ObjCBoxable:
48869 return cast<ObjCBoxableAttr>(this)->clone(C);
48870 case attr::ObjCBridge:
48871 return cast<ObjCBridgeAttr>(this)->clone(C);
48872 case attr::ObjCBridgeMutable:
48873 return cast<ObjCBridgeMutableAttr>(this)->clone(C);
48874 case attr::ObjCBridgeRelated:
48875 return cast<ObjCBridgeRelatedAttr>(this)->clone(C);
48876 case attr::ObjCClassStub:
48877 return cast<ObjCClassStubAttr>(this)->clone(C);
48878 case attr::ObjCDesignatedInitializer:
48879 return cast<ObjCDesignatedInitializerAttr>(this)->clone(C);
48880 case attr::ObjCDirect:
48881 return cast<ObjCDirectAttr>(this)->clone(C);
48882 case attr::ObjCDirectMembers:
48883 return cast<ObjCDirectMembersAttr>(this)->clone(C);
48884 case attr::ObjCException:
48885 return cast<ObjCExceptionAttr>(this)->clone(C);
48886 case attr::ObjCExplicitProtocolImpl:
48887 return cast<ObjCExplicitProtocolImplAttr>(this)->clone(C);
48888 case attr::ObjCExternallyRetained:
48889 return cast<ObjCExternallyRetainedAttr>(this)->clone(C);
48890 case attr::ObjCGC:
48891 return cast<ObjCGCAttr>(this)->clone(C);
48892 case attr::ObjCIndependentClass:
48893 return cast<ObjCIndependentClassAttr>(this)->clone(C);
48894 case attr::ObjCInertUnsafeUnretained:
48895 return cast<ObjCInertUnsafeUnretainedAttr>(this)->clone(C);
48896 case attr::ObjCKindOf:
48897 return cast<ObjCKindOfAttr>(this)->clone(C);
48898 case attr::ObjCMethodFamily:
48899 return cast<ObjCMethodFamilyAttr>(this)->clone(C);
48900 case attr::ObjCNSObject:
48901 return cast<ObjCNSObjectAttr>(this)->clone(C);
48902 case attr::ObjCNonLazyClass:
48903 return cast<ObjCNonLazyClassAttr>(this)->clone(C);
48904 case attr::ObjCNonRuntimeProtocol:
48905 return cast<ObjCNonRuntimeProtocolAttr>(this)->clone(C);
48906 case attr::ObjCOwnership:
48907 return cast<ObjCOwnershipAttr>(this)->clone(C);
48908 case attr::ObjCPreciseLifetime:
48909 return cast<ObjCPreciseLifetimeAttr>(this)->clone(C);
48910 case attr::ObjCRequiresPropertyDefs:
48911 return cast<ObjCRequiresPropertyDefsAttr>(this)->clone(C);
48912 case attr::ObjCRequiresSuper:
48913 return cast<ObjCRequiresSuperAttr>(this)->clone(C);
48914 case attr::ObjCReturnsInnerPointer:
48915 return cast<ObjCReturnsInnerPointerAttr>(this)->clone(C);
48916 case attr::ObjCRootClass:
48917 return cast<ObjCRootClassAttr>(this)->clone(C);
48918 case attr::ObjCRuntimeName:
48919 return cast<ObjCRuntimeNameAttr>(this)->clone(C);
48920 case attr::ObjCRuntimeVisible:
48921 return cast<ObjCRuntimeVisibleAttr>(this)->clone(C);
48922 case attr::ObjCSubclassingRestricted:
48923 return cast<ObjCSubclassingRestrictedAttr>(this)->clone(C);
48924 case attr::OpenCLAccess:
48925 return cast<OpenCLAccessAttr>(this)->clone(C);
48926 case attr::OpenCLConstantAddressSpace:
48927 return cast<OpenCLConstantAddressSpaceAttr>(this)->clone(C);
48928 case attr::OpenCLGenericAddressSpace:
48929 return cast<OpenCLGenericAddressSpaceAttr>(this)->clone(C);
48930 case attr::OpenCLGlobalAddressSpace:
48931 return cast<OpenCLGlobalAddressSpaceAttr>(this)->clone(C);
48932 case attr::OpenCLGlobalDeviceAddressSpace:
48933 return cast<OpenCLGlobalDeviceAddressSpaceAttr>(this)->clone(C);
48934 case attr::OpenCLGlobalHostAddressSpace:
48935 return cast<OpenCLGlobalHostAddressSpaceAttr>(this)->clone(C);
48936 case attr::OpenCLIntelReqdSubGroupSize:
48937 return cast<OpenCLIntelReqdSubGroupSizeAttr>(this)->clone(C);
48938 case attr::OpenCLKernel:
48939 return cast<OpenCLKernelAttr>(this)->clone(C);
48940 case attr::OpenCLLocalAddressSpace:
48941 return cast<OpenCLLocalAddressSpaceAttr>(this)->clone(C);
48942 case attr::OpenCLPrivateAddressSpace:
48943 return cast<OpenCLPrivateAddressSpaceAttr>(this)->clone(C);
48944 case attr::OpenCLUnrollHint:
48945 return cast<OpenCLUnrollHintAttr>(this)->clone(C);
48946 case attr::OptimizeNone:
48947 return cast<OptimizeNoneAttr>(this)->clone(C);
48948 case attr::Overloadable:
48949 return cast<OverloadableAttr>(this)->clone(C);
48950 case attr::Override:
48951 return cast<OverrideAttr>(this)->clone(C);
48952 case attr::Owner:
48953 return cast<OwnerAttr>(this)->clone(C);
48954 case attr::Ownership:
48955 return cast<OwnershipAttr>(this)->clone(C);
48956 case attr::Packed:
48957 return cast<PackedAttr>(this)->clone(C);
48958 case attr::ParamTypestate:
48959 return cast<ParamTypestateAttr>(this)->clone(C);
48960 case attr::Pascal:
48961 return cast<PascalAttr>(this)->clone(C);
48962 case attr::PassObjectSize:
48963 return cast<PassObjectSizeAttr>(this)->clone(C);
48964 case attr::PatchableFunctionEntry:
48965 return cast<PatchableFunctionEntryAttr>(this)->clone(C);
48966 case attr::Pcs:
48967 return cast<PcsAttr>(this)->clone(C);
48968 case attr::Pointer:
48969 return cast<PointerAttr>(this)->clone(C);
48970 case attr::PragmaClangBSSSection:
48971 return cast<PragmaClangBSSSectionAttr>(this)->clone(C);
48972 case attr::PragmaClangDataSection:
48973 return cast<PragmaClangDataSectionAttr>(this)->clone(C);
48974 case attr::PragmaClangRelroSection:
48975 return cast<PragmaClangRelroSectionAttr>(this)->clone(C);
48976 case attr::PragmaClangRodataSection:
48977 return cast<PragmaClangRodataSectionAttr>(this)->clone(C);
48978 case attr::PragmaClangTextSection:
48979 return cast<PragmaClangTextSectionAttr>(this)->clone(C);
48980 case attr::PreferredName:
48981 return cast<PreferredNameAttr>(this)->clone(C);
48982 case attr::PreferredType:
48983 return cast<PreferredTypeAttr>(this)->clone(C);
48984 case attr::PreserveAll:
48985 return cast<PreserveAllAttr>(this)->clone(C);
48986 case attr::PreserveMost:
48987 return cast<PreserveMostAttr>(this)->clone(C);
48988 case attr::PreserveNone:
48989 return cast<PreserveNoneAttr>(this)->clone(C);
48990 case attr::PtGuardedBy:
48991 return cast<PtGuardedByAttr>(this)->clone(C);
48992 case attr::PtGuardedVar:
48993 return cast<PtGuardedVarAttr>(this)->clone(C);
48994 case attr::Ptr32:
48995 return cast<Ptr32Attr>(this)->clone(C);
48996 case attr::Ptr64:
48997 return cast<Ptr64Attr>(this)->clone(C);
48998 case attr::Pure:
48999 return cast<PureAttr>(this)->clone(C);
49000 case attr::RISCVInterrupt:
49001 return cast<RISCVInterruptAttr>(this)->clone(C);
49002 case attr::RISCVVectorCC:
49003 return cast<RISCVVectorCCAttr>(this)->clone(C);
49004 case attr::RandomizeLayout:
49005 return cast<RandomizeLayoutAttr>(this)->clone(C);
49006 case attr::ReadOnlyPlacement:
49007 return cast<ReadOnlyPlacementAttr>(this)->clone(C);
49008 case attr::RegCall:
49009 return cast<RegCallAttr>(this)->clone(C);
49010 case attr::Reinitializes:
49011 return cast<ReinitializesAttr>(this)->clone(C);
49012 case attr::ReleaseCapability:
49013 return cast<ReleaseCapabilityAttr>(this)->clone(C);
49014 case attr::ReleaseHandle:
49015 return cast<ReleaseHandleAttr>(this)->clone(C);
49016 case attr::ReqdWorkGroupSize:
49017 return cast<ReqdWorkGroupSizeAttr>(this)->clone(C);
49018 case attr::RequiresCapability:
49019 return cast<RequiresCapabilityAttr>(this)->clone(C);
49020 case attr::Restrict:
49021 return cast<RestrictAttr>(this)->clone(C);
49022 case attr::Retain:
49023 return cast<RetainAttr>(this)->clone(C);
49024 case attr::ReturnTypestate:
49025 return cast<ReturnTypestateAttr>(this)->clone(C);
49026 case attr::ReturnsNonNull:
49027 return cast<ReturnsNonNullAttr>(this)->clone(C);
49028 case attr::ReturnsTwice:
49029 return cast<ReturnsTwiceAttr>(this)->clone(C);
49030 case attr::SPtr:
49031 return cast<SPtrAttr>(this)->clone(C);
49032 case attr::SYCLKernel:
49033 return cast<SYCLKernelAttr>(this)->clone(C);
49034 case attr::SYCLKernelEntryPoint:
49035 return cast<SYCLKernelEntryPointAttr>(this)->clone(C);
49036 case attr::SYCLSpecialClass:
49037 return cast<SYCLSpecialClassAttr>(this)->clone(C);
49038 case attr::ScopedLockable:
49039 return cast<ScopedLockableAttr>(this)->clone(C);
49040 case attr::Section:
49041 return cast<SectionAttr>(this)->clone(C);
49042 case attr::SelectAny:
49043 return cast<SelectAnyAttr>(this)->clone(C);
49044 case attr::Sentinel:
49045 return cast<SentinelAttr>(this)->clone(C);
49046 case attr::SetTypestate:
49047 return cast<SetTypestateAttr>(this)->clone(C);
49048 case attr::SharedTrylockFunction:
49049 return cast<SharedTrylockFunctionAttr>(this)->clone(C);
49050 case attr::SizedBy:
49051 return cast<SizedByAttr>(this)->clone(C);
49052 case attr::SizedByOrNull:
49053 return cast<SizedByOrNullAttr>(this)->clone(C);
49054 case attr::SpeculativeLoadHardening:
49055 return cast<SpeculativeLoadHardeningAttr>(this)->clone(C);
49056 case attr::StandaloneDebug:
49057 return cast<StandaloneDebugAttr>(this)->clone(C);
49058 case attr::StdCall:
49059 return cast<StdCallAttr>(this)->clone(C);
49060 case attr::StrictFP:
49061 return cast<StrictFPAttr>(this)->clone(C);
49062 case attr::StrictGuardStackCheck:
49063 return cast<StrictGuardStackCheckAttr>(this)->clone(C);
49064 case attr::Suppress:
49065 return cast<SuppressAttr>(this)->clone(C);
49066 case attr::SwiftAsync:
49067 return cast<SwiftAsyncAttr>(this)->clone(C);
49068 case attr::SwiftAsyncCall:
49069 return cast<SwiftAsyncCallAttr>(this)->clone(C);
49070 case attr::SwiftAsyncContext:
49071 return cast<SwiftAsyncContextAttr>(this)->clone(C);
49072 case attr::SwiftAsyncError:
49073 return cast<SwiftAsyncErrorAttr>(this)->clone(C);
49074 case attr::SwiftAsyncName:
49075 return cast<SwiftAsyncNameAttr>(this)->clone(C);
49076 case attr::SwiftAttr:
49077 return cast<SwiftAttrAttr>(this)->clone(C);
49078 case attr::SwiftBridge:
49079 return cast<SwiftBridgeAttr>(this)->clone(C);
49080 case attr::SwiftBridgedTypedef:
49081 return cast<SwiftBridgedTypedefAttr>(this)->clone(C);
49082 case attr::SwiftCall:
49083 return cast<SwiftCallAttr>(this)->clone(C);
49084 case attr::SwiftContext:
49085 return cast<SwiftContextAttr>(this)->clone(C);
49086 case attr::SwiftError:
49087 return cast<SwiftErrorAttr>(this)->clone(C);
49088 case attr::SwiftErrorResult:
49089 return cast<SwiftErrorResultAttr>(this)->clone(C);
49090 case attr::SwiftImportAsNonGeneric:
49091 return cast<SwiftImportAsNonGenericAttr>(this)->clone(C);
49092 case attr::SwiftImportPropertyAsAccessors:
49093 return cast<SwiftImportPropertyAsAccessorsAttr>(this)->clone(C);
49094 case attr::SwiftIndirectResult:
49095 return cast<SwiftIndirectResultAttr>(this)->clone(C);
49096 case attr::SwiftName:
49097 return cast<SwiftNameAttr>(this)->clone(C);
49098 case attr::SwiftNewType:
49099 return cast<SwiftNewTypeAttr>(this)->clone(C);
49100 case attr::SwiftObjCMembers:
49101 return cast<SwiftObjCMembersAttr>(this)->clone(C);
49102 case attr::SwiftPrivate:
49103 return cast<SwiftPrivateAttr>(this)->clone(C);
49104 case attr::SwiftVersionedAddition:
49105 return cast<SwiftVersionedAdditionAttr>(this)->clone(C);
49106 case attr::SwiftVersionedRemoval:
49107 return cast<SwiftVersionedRemovalAttr>(this)->clone(C);
49108 case attr::SysVABI:
49109 return cast<SysVABIAttr>(this)->clone(C);
49110 case attr::TLSModel:
49111 return cast<TLSModelAttr>(this)->clone(C);
49112 case attr::Target:
49113 return cast<TargetAttr>(this)->clone(C);
49114 case attr::TargetClones:
49115 return cast<TargetClonesAttr>(this)->clone(C);
49116 case attr::TargetVersion:
49117 return cast<TargetVersionAttr>(this)->clone(C);
49118 case attr::TestTypestate:
49119 return cast<TestTypestateAttr>(this)->clone(C);
49120 case attr::ThisCall:
49121 return cast<ThisCallAttr>(this)->clone(C);
49122 case attr::Thread:
49123 return cast<ThreadAttr>(this)->clone(C);
49124 case attr::TransparentUnion:
49125 return cast<TransparentUnionAttr>(this)->clone(C);
49126 case attr::TrivialABI:
49127 return cast<TrivialABIAttr>(this)->clone(C);
49128 case attr::TryAcquireCapability:
49129 return cast<TryAcquireCapabilityAttr>(this)->clone(C);
49130 case attr::TypeNonNull:
49131 return cast<TypeNonNullAttr>(this)->clone(C);
49132 case attr::TypeNullUnspecified:
49133 return cast<TypeNullUnspecifiedAttr>(this)->clone(C);
49134 case attr::TypeNullable:
49135 return cast<TypeNullableAttr>(this)->clone(C);
49136 case attr::TypeNullableResult:
49137 return cast<TypeNullableResultAttr>(this)->clone(C);
49138 case attr::TypeTagForDatatype:
49139 return cast<TypeTagForDatatypeAttr>(this)->clone(C);
49140 case attr::TypeVisibility:
49141 return cast<TypeVisibilityAttr>(this)->clone(C);
49142 case attr::UPtr:
49143 return cast<UPtrAttr>(this)->clone(C);
49144 case attr::Unavailable:
49145 return cast<UnavailableAttr>(this)->clone(C);
49146 case attr::Uninitialized:
49147 return cast<UninitializedAttr>(this)->clone(C);
49148 case attr::Unlikely:
49149 return cast<UnlikelyAttr>(this)->clone(C);
49150 case attr::UnsafeBufferUsage:
49151 return cast<UnsafeBufferUsageAttr>(this)->clone(C);
49152 case attr::Unused:
49153 return cast<UnusedAttr>(this)->clone(C);
49154 case attr::UseHandle:
49155 return cast<UseHandleAttr>(this)->clone(C);
49156 case attr::Used:
49157 return cast<UsedAttr>(this)->clone(C);
49158 case attr::UsingIfExists:
49159 return cast<UsingIfExistsAttr>(this)->clone(C);
49160 case attr::Uuid:
49161 return cast<UuidAttr>(this)->clone(C);
49162 case attr::VTablePointerAuthentication:
49163 return cast<VTablePointerAuthenticationAttr>(this)->clone(C);
49164 case attr::VecReturn:
49165 return cast<VecReturnAttr>(this)->clone(C);
49166 case attr::VecTypeHint:
49167 return cast<VecTypeHintAttr>(this)->clone(C);
49168 case attr::VectorCall:
49169 return cast<VectorCallAttr>(this)->clone(C);
49170 case attr::Visibility:
49171 return cast<VisibilityAttr>(this)->clone(C);
49172 case attr::WarnUnused:
49173 return cast<WarnUnusedAttr>(this)->clone(C);
49174 case attr::WarnUnusedResult:
49175 return cast<WarnUnusedResultAttr>(this)->clone(C);
49176 case attr::Weak:
49177 return cast<WeakAttr>(this)->clone(C);
49178 case attr::WeakImport:
49179 return cast<WeakImportAttr>(this)->clone(C);
49180 case attr::WeakRef:
49181 return cast<WeakRefAttr>(this)->clone(C);
49182 case attr::WebAssemblyExportName:
49183 return cast<WebAssemblyExportNameAttr>(this)->clone(C);
49184 case attr::WebAssemblyFuncref:
49185 return cast<WebAssemblyFuncrefAttr>(this)->clone(C);
49186 case attr::WebAssemblyImportModule:
49187 return cast<WebAssemblyImportModuleAttr>(this)->clone(C);
49188 case attr::WebAssemblyImportName:
49189 return cast<WebAssemblyImportNameAttr>(this)->clone(C);
49190 case attr::WorkGroupSizeHint:
49191 return cast<WorkGroupSizeHintAttr>(this)->clone(C);
49192 case attr::X86ForceAlignArgPointer:
49193 return cast<X86ForceAlignArgPointerAttr>(this)->clone(C);
49194 case attr::XRayInstrument:
49195 return cast<XRayInstrumentAttr>(this)->clone(C);
49196 case attr::XRayLogArgs:
49197 return cast<XRayLogArgsAttr>(this)->clone(C);
49198 case attr::ZeroCallUsedRegs:
49199 return cast<ZeroCallUsedRegsAttr>(this)->clone(C);
49200 }
49201 llvm_unreachable("Unexpected attribute kind!");
49202 }
49203
49204 void Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const {
49205 switch (getKind()) {
49206 case attr::AArch64SVEPcs:
49207 return cast<AArch64SVEPcsAttr>(this)->printPretty(OS, Policy);
49208 case attr::AArch64VectorPcs:
49209 return cast<AArch64VectorPcsAttr>(this)->printPretty(OS, Policy);
49210 case attr::AMDGPUFlatWorkGroupSize:
49211 return cast<AMDGPUFlatWorkGroupSizeAttr>(this)->printPretty(OS, Policy);
49212 case attr::AMDGPUKernelCall:
49213 return cast<AMDGPUKernelCallAttr>(this)->printPretty(OS, Policy);
49214 case attr::AMDGPUMaxNumWorkGroups:
49215 return cast<AMDGPUMaxNumWorkGroupsAttr>(this)->printPretty(OS, Policy);
49216 case attr::AMDGPUNumSGPR:
49217 return cast<AMDGPUNumSGPRAttr>(this)->printPretty(OS, Policy);
49218 case attr::AMDGPUNumVGPR:
49219 return cast<AMDGPUNumVGPRAttr>(this)->printPretty(OS, Policy);
49220 case attr::AMDGPUWavesPerEU:
49221 return cast<AMDGPUWavesPerEUAttr>(this)->printPretty(OS, Policy);
49222 case attr::ARMInterrupt:
49223 return cast<ARMInterruptAttr>(this)->printPretty(OS, Policy);
49224 case attr::AVRInterrupt:
49225 return cast<AVRInterruptAttr>(this)->printPretty(OS, Policy);
49226 case attr::AVRSignal:
49227 return cast<AVRSignalAttr>(this)->printPretty(OS, Policy);
49228 case attr::AbiTag:
49229 return cast<AbiTagAttr>(this)->printPretty(OS, Policy);
49230 case attr::AcquireCapability:
49231 return cast<AcquireCapabilityAttr>(this)->printPretty(OS, Policy);
49232 case attr::AcquireHandle:
49233 return cast<AcquireHandleAttr>(this)->printPretty(OS, Policy);
49234 case attr::AcquiredAfter:
49235 return cast<AcquiredAfterAttr>(this)->printPretty(OS, Policy);
49236 case attr::AcquiredBefore:
49237 return cast<AcquiredBeforeAttr>(this)->printPretty(OS, Policy);
49238 case attr::AddressSpace:
49239 return cast<AddressSpaceAttr>(this)->printPretty(OS, Policy);
49240 case attr::Alias:
49241 return cast<AliasAttr>(this)->printPretty(OS, Policy);
49242 case attr::AlignMac68k:
49243 return cast<AlignMac68kAttr>(this)->printPretty(OS, Policy);
49244 case attr::AlignNatural:
49245 return cast<AlignNaturalAttr>(this)->printPretty(OS, Policy);
49246 case attr::AlignValue:
49247 return cast<AlignValueAttr>(this)->printPretty(OS, Policy);
49248 case attr::Aligned:
49249 return cast<AlignedAttr>(this)->printPretty(OS, Policy);
49250 case attr::AllocAlign:
49251 return cast<AllocAlignAttr>(this)->printPretty(OS, Policy);
49252 case attr::AllocSize:
49253 return cast<AllocSizeAttr>(this)->printPretty(OS, Policy);
49254 case attr::Allocating:
49255 return cast<AllocatingAttr>(this)->printPretty(OS, Policy);
49256 case attr::AlwaysDestroy:
49257 return cast<AlwaysDestroyAttr>(this)->printPretty(OS, Policy);
49258 case attr::AlwaysInline:
49259 return cast<AlwaysInlineAttr>(this)->printPretty(OS, Policy);
49260 case attr::AnalyzerNoReturn:
49261 return cast<AnalyzerNoReturnAttr>(this)->printPretty(OS, Policy);
49262 case attr::Annotate:
49263 return cast<AnnotateAttr>(this)->printPretty(OS, Policy);
49264 case attr::AnnotateType:
49265 return cast<AnnotateTypeAttr>(this)->printPretty(OS, Policy);
49266 case attr::AnyX86Interrupt:
49267 return cast<AnyX86InterruptAttr>(this)->printPretty(OS, Policy);
49268 case attr::AnyX86NoCallerSavedRegisters:
49269 return cast<AnyX86NoCallerSavedRegistersAttr>(this)->printPretty(OS, Policy);
49270 case attr::AnyX86NoCfCheck:
49271 return cast<AnyX86NoCfCheckAttr>(this)->printPretty(OS, Policy);
49272 case attr::ArcWeakrefUnavailable:
49273 return cast<ArcWeakrefUnavailableAttr>(this)->printPretty(OS, Policy);
49274 case attr::ArgumentWithTypeTag:
49275 return cast<ArgumentWithTypeTagAttr>(this)->printPretty(OS, Policy);
49276 case attr::ArmAgnostic:
49277 return cast<ArmAgnosticAttr>(this)->printPretty(OS, Policy);
49278 case attr::ArmBuiltinAlias:
49279 return cast<ArmBuiltinAliasAttr>(this)->printPretty(OS, Policy);
49280 case attr::ArmIn:
49281 return cast<ArmInAttr>(this)->printPretty(OS, Policy);
49282 case attr::ArmInOut:
49283 return cast<ArmInOutAttr>(this)->printPretty(OS, Policy);
49284 case attr::ArmLocallyStreaming:
49285 return cast<ArmLocallyStreamingAttr>(this)->printPretty(OS, Policy);
49286 case attr::ArmMveStrictPolymorphism:
49287 return cast<ArmMveStrictPolymorphismAttr>(this)->printPretty(OS, Policy);
49288 case attr::ArmNew:
49289 return cast<ArmNewAttr>(this)->printPretty(OS, Policy);
49290 case attr::ArmOut:
49291 return cast<ArmOutAttr>(this)->printPretty(OS, Policy);
49292 case attr::ArmPreserves:
49293 return cast<ArmPreservesAttr>(this)->printPretty(OS, Policy);
49294 case attr::ArmStreaming:
49295 return cast<ArmStreamingAttr>(this)->printPretty(OS, Policy);
49296 case attr::ArmStreamingCompatible:
49297 return cast<ArmStreamingCompatibleAttr>(this)->printPretty(OS, Policy);
49298 case attr::Artificial:
49299 return cast<ArtificialAttr>(this)->printPretty(OS, Policy);
49300 case attr::AsmLabel:
49301 return cast<AsmLabelAttr>(this)->printPretty(OS, Policy);
49302 case attr::AssertCapability:
49303 return cast<AssertCapabilityAttr>(this)->printPretty(OS, Policy);
49304 case attr::AssertExclusiveLock:
49305 return cast<AssertExclusiveLockAttr>(this)->printPretty(OS, Policy);
49306 case attr::AssertSharedLock:
49307 return cast<AssertSharedLockAttr>(this)->printPretty(OS, Policy);
49308 case attr::AssumeAligned:
49309 return cast<AssumeAlignedAttr>(this)->printPretty(OS, Policy);
49310 case attr::Availability:
49311 return cast<AvailabilityAttr>(this)->printPretty(OS, Policy);
49312 case attr::AvailableOnlyInDefaultEvalMethod:
49313 return cast<AvailableOnlyInDefaultEvalMethodAttr>(this)->printPretty(OS, Policy);
49314 case attr::BPFFastCall:
49315 return cast<BPFFastCallAttr>(this)->printPretty(OS, Policy);
49316 case attr::BPFPreserveAccessIndex:
49317 return cast<BPFPreserveAccessIndexAttr>(this)->printPretty(OS, Policy);
49318 case attr::BPFPreserveStaticOffset:
49319 return cast<BPFPreserveStaticOffsetAttr>(this)->printPretty(OS, Policy);
49320 case attr::BTFDeclTag:
49321 return cast<BTFDeclTagAttr>(this)->printPretty(OS, Policy);
49322 case attr::BTFTypeTag:
49323 return cast<BTFTypeTagAttr>(this)->printPretty(OS, Policy);
49324 case attr::Blocking:
49325 return cast<BlockingAttr>(this)->printPretty(OS, Policy);
49326 case attr::Blocks:
49327 return cast<BlocksAttr>(this)->printPretty(OS, Policy);
49328 case attr::Builtin:
49329 return cast<BuiltinAttr>(this)->printPretty(OS, Policy);
49330 case attr::BuiltinAlias:
49331 return cast<BuiltinAliasAttr>(this)->printPretty(OS, Policy);
49332 case attr::C11NoReturn:
49333 return cast<C11NoReturnAttr>(this)->printPretty(OS, Policy);
49334 case attr::CDecl:
49335 return cast<CDeclAttr>(this)->printPretty(OS, Policy);
49336 case attr::CFAuditedTransfer:
49337 return cast<CFAuditedTransferAttr>(this)->printPretty(OS, Policy);
49338 case attr::CFConsumed:
49339 return cast<CFConsumedAttr>(this)->printPretty(OS, Policy);
49340 case attr::CFGuard:
49341 return cast<CFGuardAttr>(this)->printPretty(OS, Policy);
49342 case attr::CFICanonicalJumpTable:
49343 return cast<CFICanonicalJumpTableAttr>(this)->printPretty(OS, Policy);
49344 case attr::CFReturnsNotRetained:
49345 return cast<CFReturnsNotRetainedAttr>(this)->printPretty(OS, Policy);
49346 case attr::CFReturnsRetained:
49347 return cast<CFReturnsRetainedAttr>(this)->printPretty(OS, Policy);
49348 case attr::CFUnknownTransfer:
49349 return cast<CFUnknownTransferAttr>(this)->printPretty(OS, Policy);
49350 case attr::CPUDispatch:
49351 return cast<CPUDispatchAttr>(this)->printPretty(OS, Policy);
49352 case attr::CPUSpecific:
49353 return cast<CPUSpecificAttr>(this)->printPretty(OS, Policy);
49354 case attr::CUDAConstant:
49355 return cast<CUDAConstantAttr>(this)->printPretty(OS, Policy);
49356 case attr::CUDADevice:
49357 return cast<CUDADeviceAttr>(this)->printPretty(OS, Policy);
49358 case attr::CUDADeviceBuiltinSurfaceType:
49359 return cast<CUDADeviceBuiltinSurfaceTypeAttr>(this)->printPretty(OS, Policy);
49360 case attr::CUDADeviceBuiltinTextureType:
49361 return cast<CUDADeviceBuiltinTextureTypeAttr>(this)->printPretty(OS, Policy);
49362 case attr::CUDAGlobal:
49363 return cast<CUDAGlobalAttr>(this)->printPretty(OS, Policy);
49364 case attr::CUDAGridConstant:
49365 return cast<CUDAGridConstantAttr>(this)->printPretty(OS, Policy);
49366 case attr::CUDAHost:
49367 return cast<CUDAHostAttr>(this)->printPretty(OS, Policy);
49368 case attr::CUDAInvalidTarget:
49369 return cast<CUDAInvalidTargetAttr>(this)->printPretty(OS, Policy);
49370 case attr::CUDALaunchBounds:
49371 return cast<CUDALaunchBoundsAttr>(this)->printPretty(OS, Policy);
49372 case attr::CUDAShared:
49373 return cast<CUDASharedAttr>(this)->printPretty(OS, Policy);
49374 case attr::CXX11NoReturn:
49375 return cast<CXX11NoReturnAttr>(this)->printPretty(OS, Policy);
49376 case attr::CXXAssume:
49377 return cast<CXXAssumeAttr>(this)->printPretty(OS, Policy);
49378 case attr::CallableWhen:
49379 return cast<CallableWhenAttr>(this)->printPretty(OS, Policy);
49380 case attr::Callback:
49381 return cast<CallbackAttr>(this)->printPretty(OS, Policy);
49382 case attr::CalledOnce:
49383 return cast<CalledOnceAttr>(this)->printPretty(OS, Policy);
49384 case attr::Capability:
49385 return cast<CapabilityAttr>(this)->printPretty(OS, Policy);
49386 case attr::CapturedRecord:
49387 return cast<CapturedRecordAttr>(this)->printPretty(OS, Policy);
49388 case attr::CarriesDependency:
49389 return cast<CarriesDependencyAttr>(this)->printPretty(OS, Policy);
49390 case attr::Cleanup:
49391 return cast<CleanupAttr>(this)->printPretty(OS, Policy);
49392 case attr::ClspvLibclcBuiltin:
49393 return cast<ClspvLibclcBuiltinAttr>(this)->printPretty(OS, Policy);
49394 case attr::CmseNSCall:
49395 return cast<CmseNSCallAttr>(this)->printPretty(OS, Policy);
49396 case attr::CmseNSEntry:
49397 return cast<CmseNSEntryAttr>(this)->printPretty(OS, Policy);
49398 case attr::CodeAlign:
49399 return cast<CodeAlignAttr>(this)->printPretty(OS, Policy);
49400 case attr::CodeModel:
49401 return cast<CodeModelAttr>(this)->printPretty(OS, Policy);
49402 case attr::CodeSeg:
49403 return cast<CodeSegAttr>(this)->printPretty(OS, Policy);
49404 case attr::Cold:
49405 return cast<ColdAttr>(this)->printPretty(OS, Policy);
49406 case attr::Common:
49407 return cast<CommonAttr>(this)->printPretty(OS, Policy);
49408 case attr::Const:
49409 return cast<ConstAttr>(this)->printPretty(OS, Policy);
49410 case attr::ConstInit:
49411 return cast<ConstInitAttr>(this)->printPretty(OS, Policy);
49412 case attr::Constructor:
49413 return cast<ConstructorAttr>(this)->printPretty(OS, Policy);
49414 case attr::Consumable:
49415 return cast<ConsumableAttr>(this)->printPretty(OS, Policy);
49416 case attr::ConsumableAutoCast:
49417 return cast<ConsumableAutoCastAttr>(this)->printPretty(OS, Policy);
49418 case attr::ConsumableSetOnRead:
49419 return cast<ConsumableSetOnReadAttr>(this)->printPretty(OS, Policy);
49420 case attr::Convergent:
49421 return cast<ConvergentAttr>(this)->printPretty(OS, Policy);
49422 case attr::CoroAwaitElidable:
49423 return cast<CoroAwaitElidableAttr>(this)->printPretty(OS, Policy);
49424 case attr::CoroAwaitElidableArgument:
49425 return cast<CoroAwaitElidableArgumentAttr>(this)->printPretty(OS, Policy);
49426 case attr::CoroDisableLifetimeBound:
49427 return cast<CoroDisableLifetimeBoundAttr>(this)->printPretty(OS, Policy);
49428 case attr::CoroLifetimeBound:
49429 return cast<CoroLifetimeBoundAttr>(this)->printPretty(OS, Policy);
49430 case attr::CoroOnlyDestroyWhenComplete:
49431 return cast<CoroOnlyDestroyWhenCompleteAttr>(this)->printPretty(OS, Policy);
49432 case attr::CoroReturnType:
49433 return cast<CoroReturnTypeAttr>(this)->printPretty(OS, Policy);
49434 case attr::CoroWrapper:
49435 return cast<CoroWrapperAttr>(this)->printPretty(OS, Policy);
49436 case attr::CountedBy:
49437 return cast<CountedByAttr>(this)->printPretty(OS, Policy);
49438 case attr::CountedByOrNull:
49439 return cast<CountedByOrNullAttr>(this)->printPretty(OS, Policy);
49440 case attr::DLLExport:
49441 return cast<DLLExportAttr>(this)->printPretty(OS, Policy);
49442 case attr::DLLExportStaticLocal:
49443 return cast<DLLExportStaticLocalAttr>(this)->printPretty(OS, Policy);
49444 case attr::DLLImport:
49445 return cast<DLLImportAttr>(this)->printPretty(OS, Policy);
49446 case attr::DLLImportStaticLocal:
49447 return cast<DLLImportStaticLocalAttr>(this)->printPretty(OS, Policy);
49448 case attr::Deprecated:
49449 return cast<DeprecatedAttr>(this)->printPretty(OS, Policy);
49450 case attr::Destructor:
49451 return cast<DestructorAttr>(this)->printPretty(OS, Policy);
49452 case attr::DiagnoseAsBuiltin:
49453 return cast<DiagnoseAsBuiltinAttr>(this)->printPretty(OS, Policy);
49454 case attr::DiagnoseIf:
49455 return cast<DiagnoseIfAttr>(this)->printPretty(OS, Policy);
49456 case attr::DisableSanitizerInstrumentation:
49457 return cast<DisableSanitizerInstrumentationAttr>(this)->printPretty(OS, Policy);
49458 case attr::DisableTailCalls:
49459 return cast<DisableTailCallsAttr>(this)->printPretty(OS, Policy);
49460 case attr::EmptyBases:
49461 return cast<EmptyBasesAttr>(this)->printPretty(OS, Policy);
49462 case attr::EnableIf:
49463 return cast<EnableIfAttr>(this)->printPretty(OS, Policy);
49464 case attr::EnforceTCB:
49465 return cast<EnforceTCBAttr>(this)->printPretty(OS, Policy);
49466 case attr::EnforceTCBLeaf:
49467 return cast<EnforceTCBLeafAttr>(this)->printPretty(OS, Policy);
49468 case attr::EnumExtensibility:
49469 return cast<EnumExtensibilityAttr>(this)->printPretty(OS, Policy);
49470 case attr::Error:
49471 return cast<ErrorAttr>(this)->printPretty(OS, Policy);
49472 case attr::ExcludeFromExplicitInstantiation:
49473 return cast<ExcludeFromExplicitInstantiationAttr>(this)->printPretty(OS, Policy);
49474 case attr::ExclusiveTrylockFunction:
49475 return cast<ExclusiveTrylockFunctionAttr>(this)->printPretty(OS, Policy);
49476 case attr::ExplicitInit:
49477 return cast<ExplicitInitAttr>(this)->printPretty(OS, Policy);
49478 case attr::ExternalSourceSymbol:
49479 return cast<ExternalSourceSymbolAttr>(this)->printPretty(OS, Policy);
49480 case attr::FallThrough:
49481 return cast<FallThroughAttr>(this)->printPretty(OS, Policy);
49482 case attr::FastCall:
49483 return cast<FastCallAttr>(this)->printPretty(OS, Policy);
49484 case attr::Final:
49485 return cast<FinalAttr>(this)->printPretty(OS, Policy);
49486 case attr::FlagEnum:
49487 return cast<FlagEnumAttr>(this)->printPretty(OS, Policy);
49488 case attr::Flatten:
49489 return cast<FlattenAttr>(this)->printPretty(OS, Policy);
49490 case attr::Format:
49491 return cast<FormatAttr>(this)->printPretty(OS, Policy);
49492 case attr::FormatArg:
49493 return cast<FormatArgAttr>(this)->printPretty(OS, Policy);
49494 case attr::FunctionReturnThunks:
49495 return cast<FunctionReturnThunksAttr>(this)->printPretty(OS, Policy);
49496 case attr::GNUInline:
49497 return cast<GNUInlineAttr>(this)->printPretty(OS, Policy);
49498 case attr::GuardedBy:
49499 return cast<GuardedByAttr>(this)->printPretty(OS, Policy);
49500 case attr::GuardedVar:
49501 return cast<GuardedVarAttr>(this)->printPretty(OS, Policy);
49502 case attr::HIPManaged:
49503 return cast<HIPManagedAttr>(this)->printPretty(OS, Policy);
49504 case attr::HLSLContainedType:
49505 return cast<HLSLContainedTypeAttr>(this)->printPretty(OS, Policy);
49506 case attr::HLSLControlFlowHint:
49507 return cast<HLSLControlFlowHintAttr>(this)->printPretty(OS, Policy);
49508 case attr::HLSLGroupSharedAddressSpace:
49509 return cast<HLSLGroupSharedAddressSpaceAttr>(this)->printPretty(OS, Policy);
49510 case attr::HLSLLoopHint:
49511 return cast<HLSLLoopHintAttr>(this)->printPretty(OS, Policy);
49512 case attr::HLSLNumThreads:
49513 return cast<HLSLNumThreadsAttr>(this)->printPretty(OS, Policy);
49514 case attr::HLSLPackOffset:
49515 return cast<HLSLPackOffsetAttr>(this)->printPretty(OS, Policy);
49516 case attr::HLSLParamModifier:
49517 return cast<HLSLParamModifierAttr>(this)->printPretty(OS, Policy);
49518 case attr::HLSLROV:
49519 return cast<HLSLROVAttr>(this)->printPretty(OS, Policy);
49520 case attr::HLSLRawBuffer:
49521 return cast<HLSLRawBufferAttr>(this)->printPretty(OS, Policy);
49522 case attr::HLSLResource:
49523 return cast<HLSLResourceAttr>(this)->printPretty(OS, Policy);
49524 case attr::HLSLResourceBinding:
49525 return cast<HLSLResourceBindingAttr>(this)->printPretty(OS, Policy);
49526 case attr::HLSLResourceClass:
49527 return cast<HLSLResourceClassAttr>(this)->printPretty(OS, Policy);
49528 case attr::HLSLSV_DispatchThreadID:
49529 return cast<HLSLSV_DispatchThreadIDAttr>(this)->printPretty(OS, Policy);
49530 case attr::HLSLSV_GroupID:
49531 return cast<HLSLSV_GroupIDAttr>(this)->printPretty(OS, Policy);
49532 case attr::HLSLSV_GroupIndex:
49533 return cast<HLSLSV_GroupIndexAttr>(this)->printPretty(OS, Policy);
49534 case attr::HLSLSV_GroupThreadID:
49535 return cast<HLSLSV_GroupThreadIDAttr>(this)->printPretty(OS, Policy);
49536 case attr::HLSLShader:
49537 return cast<HLSLShaderAttr>(this)->printPretty(OS, Policy);
49538 case attr::HLSLWaveSize:
49539 return cast<HLSLWaveSizeAttr>(this)->printPretty(OS, Policy);
49540 case attr::Hot:
49541 return cast<HotAttr>(this)->printPretty(OS, Policy);
49542 case attr::HybridPatchable:
49543 return cast<HybridPatchableAttr>(this)->printPretty(OS, Policy);
49544 case attr::IBAction:
49545 return cast<IBActionAttr>(this)->printPretty(OS, Policy);
49546 case attr::IBOutlet:
49547 return cast<IBOutletAttr>(this)->printPretty(OS, Policy);
49548 case attr::IBOutletCollection:
49549 return cast<IBOutletCollectionAttr>(this)->printPretty(OS, Policy);
49550 case attr::IFunc:
49551 return cast<IFuncAttr>(this)->printPretty(OS, Policy);
49552 case attr::InitPriority:
49553 return cast<InitPriorityAttr>(this)->printPretty(OS, Policy);
49554 case attr::InitSeg:
49555 return cast<InitSegAttr>(this)->printPretty(OS, Policy);
49556 case attr::IntelOclBicc:
49557 return cast<IntelOclBiccAttr>(this)->printPretty(OS, Policy);
49558 case attr::InternalLinkage:
49559 return cast<InternalLinkageAttr>(this)->printPretty(OS, Policy);
49560 case attr::LTOVisibilityPublic:
49561 return cast<LTOVisibilityPublicAttr>(this)->printPretty(OS, Policy);
49562 case attr::LayoutVersion:
49563 return cast<LayoutVersionAttr>(this)->printPretty(OS, Policy);
49564 case attr::Leaf:
49565 return cast<LeafAttr>(this)->printPretty(OS, Policy);
49566 case attr::LifetimeBound:
49567 return cast<LifetimeBoundAttr>(this)->printPretty(OS, Policy);
49568 case attr::LifetimeCaptureBy:
49569 return cast<LifetimeCaptureByAttr>(this)->printPretty(OS, Policy);
49570 case attr::Likely:
49571 return cast<LikelyAttr>(this)->printPretty(OS, Policy);
49572 case attr::LoaderUninitialized:
49573 return cast<LoaderUninitializedAttr>(this)->printPretty(OS, Policy);
49574 case attr::LockReturned:
49575 return cast<LockReturnedAttr>(this)->printPretty(OS, Policy);
49576 case attr::LocksExcluded:
49577 return cast<LocksExcludedAttr>(this)->printPretty(OS, Policy);
49578 case attr::LoopHint:
49579 return cast<LoopHintAttr>(this)->printPretty(OS, Policy);
49580 case attr::M68kInterrupt:
49581 return cast<M68kInterruptAttr>(this)->printPretty(OS, Policy);
49582 case attr::M68kRTD:
49583 return cast<M68kRTDAttr>(this)->printPretty(OS, Policy);
49584 case attr::MIGServerRoutine:
49585 return cast<MIGServerRoutineAttr>(this)->printPretty(OS, Policy);
49586 case attr::MSABI:
49587 return cast<MSABIAttr>(this)->printPretty(OS, Policy);
49588 case attr::MSAllocator:
49589 return cast<MSAllocatorAttr>(this)->printPretty(OS, Policy);
49590 case attr::MSConstexpr:
49591 return cast<MSConstexprAttr>(this)->printPretty(OS, Policy);
49592 case attr::MSInheritance:
49593 return cast<MSInheritanceAttr>(this)->printPretty(OS, Policy);
49594 case attr::MSNoVTable:
49595 return cast<MSNoVTableAttr>(this)->printPretty(OS, Policy);
49596 case attr::MSP430Interrupt:
49597 return cast<MSP430InterruptAttr>(this)->printPretty(OS, Policy);
49598 case attr::MSStruct:
49599 return cast<MSStructAttr>(this)->printPretty(OS, Policy);
49600 case attr::MSVtorDisp:
49601 return cast<MSVtorDispAttr>(this)->printPretty(OS, Policy);
49602 case attr::MaxFieldAlignment:
49603 return cast<MaxFieldAlignmentAttr>(this)->printPretty(OS, Policy);
49604 case attr::MayAlias:
49605 return cast<MayAliasAttr>(this)->printPretty(OS, Policy);
49606 case attr::MaybeUndef:
49607 return cast<MaybeUndefAttr>(this)->printPretty(OS, Policy);
49608 case attr::MicroMips:
49609 return cast<MicroMipsAttr>(this)->printPretty(OS, Policy);
49610 case attr::MinSize:
49611 return cast<MinSizeAttr>(this)->printPretty(OS, Policy);
49612 case attr::MinVectorWidth:
49613 return cast<MinVectorWidthAttr>(this)->printPretty(OS, Policy);
49614 case attr::Mips16:
49615 return cast<Mips16Attr>(this)->printPretty(OS, Policy);
49616 case attr::MipsInterrupt:
49617 return cast<MipsInterruptAttr>(this)->printPretty(OS, Policy);
49618 case attr::MipsLongCall:
49619 return cast<MipsLongCallAttr>(this)->printPretty(OS, Policy);
49620 case attr::MipsShortCall:
49621 return cast<MipsShortCallAttr>(this)->printPretty(OS, Policy);
49622 case attr::Mode:
49623 return cast<ModeAttr>(this)->printPretty(OS, Policy);
49624 case attr::MustTail:
49625 return cast<MustTailAttr>(this)->printPretty(OS, Policy);
49626 case attr::NSConsumed:
49627 return cast<NSConsumedAttr>(this)->printPretty(OS, Policy);
49628 case attr::NSConsumesSelf:
49629 return cast<NSConsumesSelfAttr>(this)->printPretty(OS, Policy);
49630 case attr::NSErrorDomain:
49631 return cast<NSErrorDomainAttr>(this)->printPretty(OS, Policy);
49632 case attr::NSReturnsAutoreleased:
49633 return cast<NSReturnsAutoreleasedAttr>(this)->printPretty(OS, Policy);
49634 case attr::NSReturnsNotRetained:
49635 return cast<NSReturnsNotRetainedAttr>(this)->printPretty(OS, Policy);
49636 case attr::NSReturnsRetained:
49637 return cast<NSReturnsRetainedAttr>(this)->printPretty(OS, Policy);
49638 case attr::NVPTXKernel:
49639 return cast<NVPTXKernelAttr>(this)->printPretty(OS, Policy);
49640 case attr::Naked:
49641 return cast<NakedAttr>(this)->printPretty(OS, Policy);
49642 case attr::NoAlias:
49643 return cast<NoAliasAttr>(this)->printPretty(OS, Policy);
49644 case attr::NoBuiltin:
49645 return cast<NoBuiltinAttr>(this)->printPretty(OS, Policy);
49646 case attr::NoCommon:
49647 return cast<NoCommonAttr>(this)->printPretty(OS, Policy);
49648 case attr::NoConvergent:
49649 return cast<NoConvergentAttr>(this)->printPretty(OS, Policy);
49650 case attr::NoDebug:
49651 return cast<NoDebugAttr>(this)->printPretty(OS, Policy);
49652 case attr::NoDeref:
49653 return cast<NoDerefAttr>(this)->printPretty(OS, Policy);
49654 case attr::NoDestroy:
49655 return cast<NoDestroyAttr>(this)->printPretty(OS, Policy);
49656 case attr::NoDuplicate:
49657 return cast<NoDuplicateAttr>(this)->printPretty(OS, Policy);
49658 case attr::NoEscape:
49659 return cast<NoEscapeAttr>(this)->printPretty(OS, Policy);
49660 case attr::NoInline:
49661 return cast<NoInlineAttr>(this)->printPretty(OS, Policy);
49662 case attr::NoInstrumentFunction:
49663 return cast<NoInstrumentFunctionAttr>(this)->printPretty(OS, Policy);
49664 case attr::NoMerge:
49665 return cast<NoMergeAttr>(this)->printPretty(OS, Policy);
49666 case attr::NoMicroMips:
49667 return cast<NoMicroMipsAttr>(this)->printPretty(OS, Policy);
49668 case attr::NoMips16:
49669 return cast<NoMips16Attr>(this)->printPretty(OS, Policy);
49670 case attr::NoProfileFunction:
49671 return cast<NoProfileFunctionAttr>(this)->printPretty(OS, Policy);
49672 case attr::NoRandomizeLayout:
49673 return cast<NoRandomizeLayoutAttr>(this)->printPretty(OS, Policy);
49674 case attr::NoReturn:
49675 return cast<NoReturnAttr>(this)->printPretty(OS, Policy);
49676 case attr::NoSanitize:
49677 return cast<NoSanitizeAttr>(this)->printPretty(OS, Policy);
49678 case attr::NoSpecializations:
49679 return cast<NoSpecializationsAttr>(this)->printPretty(OS, Policy);
49680 case attr::NoSpeculativeLoadHardening:
49681 return cast<NoSpeculativeLoadHardeningAttr>(this)->printPretty(OS, Policy);
49682 case attr::NoSplitStack:
49683 return cast<NoSplitStackAttr>(this)->printPretty(OS, Policy);
49684 case attr::NoStackProtector:
49685 return cast<NoStackProtectorAttr>(this)->printPretty(OS, Policy);
49686 case attr::NoThreadSafetyAnalysis:
49687 return cast<NoThreadSafetyAnalysisAttr>(this)->printPretty(OS, Policy);
49688 case attr::NoThrow:
49689 return cast<NoThrowAttr>(this)->printPretty(OS, Policy);
49690 case attr::NoTrivialAutoVarInit:
49691 return cast<NoTrivialAutoVarInitAttr>(this)->printPretty(OS, Policy);
49692 case attr::NoUniqueAddress:
49693 return cast<NoUniqueAddressAttr>(this)->printPretty(OS, Policy);
49694 case attr::NoUwtable:
49695 return cast<NoUwtableAttr>(this)->printPretty(OS, Policy);
49696 case attr::NonAllocating:
49697 return cast<NonAllocatingAttr>(this)->printPretty(OS, Policy);
49698 case attr::NonBlocking:
49699 return cast<NonBlockingAttr>(this)->printPretty(OS, Policy);
49700 case attr::NonNull:
49701 return cast<NonNullAttr>(this)->printPretty(OS, Policy);
49702 case attr::NotTailCalled:
49703 return cast<NotTailCalledAttr>(this)->printPretty(OS, Policy);
49704 case attr::OMPAllocateDecl:
49705 return cast<OMPAllocateDeclAttr>(this)->printPretty(OS, Policy);
49706 case attr::OMPAssume:
49707 return cast<OMPAssumeAttr>(this)->printPretty(OS, Policy);
49708 case attr::OMPCaptureKind:
49709 return cast<OMPCaptureKindAttr>(this)->printPretty(OS, Policy);
49710 case attr::OMPCaptureNoInit:
49711 return cast<OMPCaptureNoInitAttr>(this)->printPretty(OS, Policy);
49712 case attr::OMPDeclareSimdDecl:
49713 return cast<OMPDeclareSimdDeclAttr>(this)->printPretty(OS, Policy);
49714 case attr::OMPDeclareTargetDecl:
49715 return cast<OMPDeclareTargetDeclAttr>(this)->printPretty(OS, Policy);
49716 case attr::OMPDeclareVariant:
49717 return cast<OMPDeclareVariantAttr>(this)->printPretty(OS, Policy);
49718 case attr::OMPReferencedVar:
49719 return cast<OMPReferencedVarAttr>(this)->printPretty(OS, Policy);
49720 case attr::OMPThreadPrivateDecl:
49721 return cast<OMPThreadPrivateDeclAttr>(this)->printPretty(OS, Policy);
49722 case attr::OSConsumed:
49723 return cast<OSConsumedAttr>(this)->printPretty(OS, Policy);
49724 case attr::OSConsumesThis:
49725 return cast<OSConsumesThisAttr>(this)->printPretty(OS, Policy);
49726 case attr::OSReturnsNotRetained:
49727 return cast<OSReturnsNotRetainedAttr>(this)->printPretty(OS, Policy);
49728 case attr::OSReturnsRetained:
49729 return cast<OSReturnsRetainedAttr>(this)->printPretty(OS, Policy);
49730 case attr::OSReturnsRetainedOnNonZero:
49731 return cast<OSReturnsRetainedOnNonZeroAttr>(this)->printPretty(OS, Policy);
49732 case attr::OSReturnsRetainedOnZero:
49733 return cast<OSReturnsRetainedOnZeroAttr>(this)->printPretty(OS, Policy);
49734 case attr::ObjCBoxable:
49735 return cast<ObjCBoxableAttr>(this)->printPretty(OS, Policy);
49736 case attr::ObjCBridge:
49737 return cast<ObjCBridgeAttr>(this)->printPretty(OS, Policy);
49738 case attr::ObjCBridgeMutable:
49739 return cast<ObjCBridgeMutableAttr>(this)->printPretty(OS, Policy);
49740 case attr::ObjCBridgeRelated:
49741 return cast<ObjCBridgeRelatedAttr>(this)->printPretty(OS, Policy);
49742 case attr::ObjCClassStub:
49743 return cast<ObjCClassStubAttr>(this)->printPretty(OS, Policy);
49744 case attr::ObjCDesignatedInitializer:
49745 return cast<ObjCDesignatedInitializerAttr>(this)->printPretty(OS, Policy);
49746 case attr::ObjCDirect:
49747 return cast<ObjCDirectAttr>(this)->printPretty(OS, Policy);
49748 case attr::ObjCDirectMembers:
49749 return cast<ObjCDirectMembersAttr>(this)->printPretty(OS, Policy);
49750 case attr::ObjCException:
49751 return cast<ObjCExceptionAttr>(this)->printPretty(OS, Policy);
49752 case attr::ObjCExplicitProtocolImpl:
49753 return cast<ObjCExplicitProtocolImplAttr>(this)->printPretty(OS, Policy);
49754 case attr::ObjCExternallyRetained:
49755 return cast<ObjCExternallyRetainedAttr>(this)->printPretty(OS, Policy);
49756 case attr::ObjCGC:
49757 return cast<ObjCGCAttr>(this)->printPretty(OS, Policy);
49758 case attr::ObjCIndependentClass:
49759 return cast<ObjCIndependentClassAttr>(this)->printPretty(OS, Policy);
49760 case attr::ObjCInertUnsafeUnretained:
49761 return cast<ObjCInertUnsafeUnretainedAttr>(this)->printPretty(OS, Policy);
49762 case attr::ObjCKindOf:
49763 return cast<ObjCKindOfAttr>(this)->printPretty(OS, Policy);
49764 case attr::ObjCMethodFamily:
49765 return cast<ObjCMethodFamilyAttr>(this)->printPretty(OS, Policy);
49766 case attr::ObjCNSObject:
49767 return cast<ObjCNSObjectAttr>(this)->printPretty(OS, Policy);
49768 case attr::ObjCNonLazyClass:
49769 return cast<ObjCNonLazyClassAttr>(this)->printPretty(OS, Policy);
49770 case attr::ObjCNonRuntimeProtocol:
49771 return cast<ObjCNonRuntimeProtocolAttr>(this)->printPretty(OS, Policy);
49772 case attr::ObjCOwnership:
49773 return cast<ObjCOwnershipAttr>(this)->printPretty(OS, Policy);
49774 case attr::ObjCPreciseLifetime:
49775 return cast<ObjCPreciseLifetimeAttr>(this)->printPretty(OS, Policy);
49776 case attr::ObjCRequiresPropertyDefs:
49777 return cast<ObjCRequiresPropertyDefsAttr>(this)->printPretty(OS, Policy);
49778 case attr::ObjCRequiresSuper:
49779 return cast<ObjCRequiresSuperAttr>(this)->printPretty(OS, Policy);
49780 case attr::ObjCReturnsInnerPointer:
49781 return cast<ObjCReturnsInnerPointerAttr>(this)->printPretty(OS, Policy);
49782 case attr::ObjCRootClass:
49783 return cast<ObjCRootClassAttr>(this)->printPretty(OS, Policy);
49784 case attr::ObjCRuntimeName:
49785 return cast<ObjCRuntimeNameAttr>(this)->printPretty(OS, Policy);
49786 case attr::ObjCRuntimeVisible:
49787 return cast<ObjCRuntimeVisibleAttr>(this)->printPretty(OS, Policy);
49788 case attr::ObjCSubclassingRestricted:
49789 return cast<ObjCSubclassingRestrictedAttr>(this)->printPretty(OS, Policy);
49790 case attr::OpenCLAccess:
49791 return cast<OpenCLAccessAttr>(this)->printPretty(OS, Policy);
49792 case attr::OpenCLConstantAddressSpace:
49793 return cast<OpenCLConstantAddressSpaceAttr>(this)->printPretty(OS, Policy);
49794 case attr::OpenCLGenericAddressSpace:
49795 return cast<OpenCLGenericAddressSpaceAttr>(this)->printPretty(OS, Policy);
49796 case attr::OpenCLGlobalAddressSpace:
49797 return cast<OpenCLGlobalAddressSpaceAttr>(this)->printPretty(OS, Policy);
49798 case attr::OpenCLGlobalDeviceAddressSpace:
49799 return cast<OpenCLGlobalDeviceAddressSpaceAttr>(this)->printPretty(OS, Policy);
49800 case attr::OpenCLGlobalHostAddressSpace:
49801 return cast<OpenCLGlobalHostAddressSpaceAttr>(this)->printPretty(OS, Policy);
49802 case attr::OpenCLIntelReqdSubGroupSize:
49803 return cast<OpenCLIntelReqdSubGroupSizeAttr>(this)->printPretty(OS, Policy);
49804 case attr::OpenCLKernel:
49805 return cast<OpenCLKernelAttr>(this)->printPretty(OS, Policy);
49806 case attr::OpenCLLocalAddressSpace:
49807 return cast<OpenCLLocalAddressSpaceAttr>(this)->printPretty(OS, Policy);
49808 case attr::OpenCLPrivateAddressSpace:
49809 return cast<OpenCLPrivateAddressSpaceAttr>(this)->printPretty(OS, Policy);
49810 case attr::OpenCLUnrollHint:
49811 return cast<OpenCLUnrollHintAttr>(this)->printPretty(OS, Policy);
49812 case attr::OptimizeNone:
49813 return cast<OptimizeNoneAttr>(this)->printPretty(OS, Policy);
49814 case attr::Overloadable:
49815 return cast<OverloadableAttr>(this)->printPretty(OS, Policy);
49816 case attr::Override:
49817 return cast<OverrideAttr>(this)->printPretty(OS, Policy);
49818 case attr::Owner:
49819 return cast<OwnerAttr>(this)->printPretty(OS, Policy);
49820 case attr::Ownership:
49821 return cast<OwnershipAttr>(this)->printPretty(OS, Policy);
49822 case attr::Packed:
49823 return cast<PackedAttr>(this)->printPretty(OS, Policy);
49824 case attr::ParamTypestate:
49825 return cast<ParamTypestateAttr>(this)->printPretty(OS, Policy);
49826 case attr::Pascal:
49827 return cast<PascalAttr>(this)->printPretty(OS, Policy);
49828 case attr::PassObjectSize:
49829 return cast<PassObjectSizeAttr>(this)->printPretty(OS, Policy);
49830 case attr::PatchableFunctionEntry:
49831 return cast<PatchableFunctionEntryAttr>(this)->printPretty(OS, Policy);
49832 case attr::Pcs:
49833 return cast<PcsAttr>(this)->printPretty(OS, Policy);
49834 case attr::Pointer:
49835 return cast<PointerAttr>(this)->printPretty(OS, Policy);
49836 case attr::PragmaClangBSSSection:
49837 return cast<PragmaClangBSSSectionAttr>(this)->printPretty(OS, Policy);
49838 case attr::PragmaClangDataSection:
49839 return cast<PragmaClangDataSectionAttr>(this)->printPretty(OS, Policy);
49840 case attr::PragmaClangRelroSection:
49841 return cast<PragmaClangRelroSectionAttr>(this)->printPretty(OS, Policy);
49842 case attr::PragmaClangRodataSection:
49843 return cast<PragmaClangRodataSectionAttr>(this)->printPretty(OS, Policy);
49844 case attr::PragmaClangTextSection:
49845 return cast<PragmaClangTextSectionAttr>(this)->printPretty(OS, Policy);
49846 case attr::PreferredName:
49847 return cast<PreferredNameAttr>(this)->printPretty(OS, Policy);
49848 case attr::PreferredType:
49849 return cast<PreferredTypeAttr>(this)->printPretty(OS, Policy);
49850 case attr::PreserveAll:
49851 return cast<PreserveAllAttr>(this)->printPretty(OS, Policy);
49852 case attr::PreserveMost:
49853 return cast<PreserveMostAttr>(this)->printPretty(OS, Policy);
49854 case attr::PreserveNone:
49855 return cast<PreserveNoneAttr>(this)->printPretty(OS, Policy);
49856 case attr::PtGuardedBy:
49857 return cast<PtGuardedByAttr>(this)->printPretty(OS, Policy);
49858 case attr::PtGuardedVar:
49859 return cast<PtGuardedVarAttr>(this)->printPretty(OS, Policy);
49860 case attr::Ptr32:
49861 return cast<Ptr32Attr>(this)->printPretty(OS, Policy);
49862 case attr::Ptr64:
49863 return cast<Ptr64Attr>(this)->printPretty(OS, Policy);
49864 case attr::Pure:
49865 return cast<PureAttr>(this)->printPretty(OS, Policy);
49866 case attr::RISCVInterrupt:
49867 return cast<RISCVInterruptAttr>(this)->printPretty(OS, Policy);
49868 case attr::RISCVVectorCC:
49869 return cast<RISCVVectorCCAttr>(this)->printPretty(OS, Policy);
49870 case attr::RandomizeLayout:
49871 return cast<RandomizeLayoutAttr>(this)->printPretty(OS, Policy);
49872 case attr::ReadOnlyPlacement:
49873 return cast<ReadOnlyPlacementAttr>(this)->printPretty(OS, Policy);
49874 case attr::RegCall:
49875 return cast<RegCallAttr>(this)->printPretty(OS, Policy);
49876 case attr::Reinitializes:
49877 return cast<ReinitializesAttr>(this)->printPretty(OS, Policy);
49878 case attr::ReleaseCapability:
49879 return cast<ReleaseCapabilityAttr>(this)->printPretty(OS, Policy);
49880 case attr::ReleaseHandle:
49881 return cast<ReleaseHandleAttr>(this)->printPretty(OS, Policy);
49882 case attr::ReqdWorkGroupSize:
49883 return cast<ReqdWorkGroupSizeAttr>(this)->printPretty(OS, Policy);
49884 case attr::RequiresCapability:
49885 return cast<RequiresCapabilityAttr>(this)->printPretty(OS, Policy);
49886 case attr::Restrict:
49887 return cast<RestrictAttr>(this)->printPretty(OS, Policy);
49888 case attr::Retain:
49889 return cast<RetainAttr>(this)->printPretty(OS, Policy);
49890 case attr::ReturnTypestate:
49891 return cast<ReturnTypestateAttr>(this)->printPretty(OS, Policy);
49892 case attr::ReturnsNonNull:
49893 return cast<ReturnsNonNullAttr>(this)->printPretty(OS, Policy);
49894 case attr::ReturnsTwice:
49895 return cast<ReturnsTwiceAttr>(this)->printPretty(OS, Policy);
49896 case attr::SPtr:
49897 return cast<SPtrAttr>(this)->printPretty(OS, Policy);
49898 case attr::SYCLKernel:
49899 return cast<SYCLKernelAttr>(this)->printPretty(OS, Policy);
49900 case attr::SYCLKernelEntryPoint:
49901 return cast<SYCLKernelEntryPointAttr>(this)->printPretty(OS, Policy);
49902 case attr::SYCLSpecialClass:
49903 return cast<SYCLSpecialClassAttr>(this)->printPretty(OS, Policy);
49904 case attr::ScopedLockable:
49905 return cast<ScopedLockableAttr>(this)->printPretty(OS, Policy);
49906 case attr::Section:
49907 return cast<SectionAttr>(this)->printPretty(OS, Policy);
49908 case attr::SelectAny:
49909 return cast<SelectAnyAttr>(this)->printPretty(OS, Policy);
49910 case attr::Sentinel:
49911 return cast<SentinelAttr>(this)->printPretty(OS, Policy);
49912 case attr::SetTypestate:
49913 return cast<SetTypestateAttr>(this)->printPretty(OS, Policy);
49914 case attr::SharedTrylockFunction:
49915 return cast<SharedTrylockFunctionAttr>(this)->printPretty(OS, Policy);
49916 case attr::SizedBy:
49917 return cast<SizedByAttr>(this)->printPretty(OS, Policy);
49918 case attr::SizedByOrNull:
49919 return cast<SizedByOrNullAttr>(this)->printPretty(OS, Policy);
49920 case attr::SpeculativeLoadHardening:
49921 return cast<SpeculativeLoadHardeningAttr>(this)->printPretty(OS, Policy);
49922 case attr::StandaloneDebug:
49923 return cast<StandaloneDebugAttr>(this)->printPretty(OS, Policy);
49924 case attr::StdCall:
49925 return cast<StdCallAttr>(this)->printPretty(OS, Policy);
49926 case attr::StrictFP:
49927 return cast<StrictFPAttr>(this)->printPretty(OS, Policy);
49928 case attr::StrictGuardStackCheck:
49929 return cast<StrictGuardStackCheckAttr>(this)->printPretty(OS, Policy);
49930 case attr::Suppress:
49931 return cast<SuppressAttr>(this)->printPretty(OS, Policy);
49932 case attr::SwiftAsync:
49933 return cast<SwiftAsyncAttr>(this)->printPretty(OS, Policy);
49934 case attr::SwiftAsyncCall:
49935 return cast<SwiftAsyncCallAttr>(this)->printPretty(OS, Policy);
49936 case attr::SwiftAsyncContext:
49937 return cast<SwiftAsyncContextAttr>(this)->printPretty(OS, Policy);
49938 case attr::SwiftAsyncError:
49939 return cast<SwiftAsyncErrorAttr>(this)->printPretty(OS, Policy);
49940 case attr::SwiftAsyncName:
49941 return cast<SwiftAsyncNameAttr>(this)->printPretty(OS, Policy);
49942 case attr::SwiftAttr:
49943 return cast<SwiftAttrAttr>(this)->printPretty(OS, Policy);
49944 case attr::SwiftBridge:
49945 return cast<SwiftBridgeAttr>(this)->printPretty(OS, Policy);
49946 case attr::SwiftBridgedTypedef:
49947 return cast<SwiftBridgedTypedefAttr>(this)->printPretty(OS, Policy);
49948 case attr::SwiftCall:
49949 return cast<SwiftCallAttr>(this)->printPretty(OS, Policy);
49950 case attr::SwiftContext:
49951 return cast<SwiftContextAttr>(this)->printPretty(OS, Policy);
49952 case attr::SwiftError:
49953 return cast<SwiftErrorAttr>(this)->printPretty(OS, Policy);
49954 case attr::SwiftErrorResult:
49955 return cast<SwiftErrorResultAttr>(this)->printPretty(OS, Policy);
49956 case attr::SwiftImportAsNonGeneric:
49957 return cast<SwiftImportAsNonGenericAttr>(this)->printPretty(OS, Policy);
49958 case attr::SwiftImportPropertyAsAccessors:
49959 return cast<SwiftImportPropertyAsAccessorsAttr>(this)->printPretty(OS, Policy);
49960 case attr::SwiftIndirectResult:
49961 return cast<SwiftIndirectResultAttr>(this)->printPretty(OS, Policy);
49962 case attr::SwiftName:
49963 return cast<SwiftNameAttr>(this)->printPretty(OS, Policy);
49964 case attr::SwiftNewType:
49965 return cast<SwiftNewTypeAttr>(this)->printPretty(OS, Policy);
49966 case attr::SwiftObjCMembers:
49967 return cast<SwiftObjCMembersAttr>(this)->printPretty(OS, Policy);
49968 case attr::SwiftPrivate:
49969 return cast<SwiftPrivateAttr>(this)->printPretty(OS, Policy);
49970 case attr::SwiftVersionedAddition:
49971 return cast<SwiftVersionedAdditionAttr>(this)->printPretty(OS, Policy);
49972 case attr::SwiftVersionedRemoval:
49973 return cast<SwiftVersionedRemovalAttr>(this)->printPretty(OS, Policy);
49974 case attr::SysVABI:
49975 return cast<SysVABIAttr>(this)->printPretty(OS, Policy);
49976 case attr::TLSModel:
49977 return cast<TLSModelAttr>(this)->printPretty(OS, Policy);
49978 case attr::Target:
49979 return cast<TargetAttr>(this)->printPretty(OS, Policy);
49980 case attr::TargetClones:
49981 return cast<TargetClonesAttr>(this)->printPretty(OS, Policy);
49982 case attr::TargetVersion:
49983 return cast<TargetVersionAttr>(this)->printPretty(OS, Policy);
49984 case attr::TestTypestate:
49985 return cast<TestTypestateAttr>(this)->printPretty(OS, Policy);
49986 case attr::ThisCall:
49987 return cast<ThisCallAttr>(this)->printPretty(OS, Policy);
49988 case attr::Thread:
49989 return cast<ThreadAttr>(this)->printPretty(OS, Policy);
49990 case attr::TransparentUnion:
49991 return cast<TransparentUnionAttr>(this)->printPretty(OS, Policy);
49992 case attr::TrivialABI:
49993 return cast<TrivialABIAttr>(this)->printPretty(OS, Policy);
49994 case attr::TryAcquireCapability:
49995 return cast<TryAcquireCapabilityAttr>(this)->printPretty(OS, Policy);
49996 case attr::TypeNonNull:
49997 return cast<TypeNonNullAttr>(this)->printPretty(OS, Policy);
49998 case attr::TypeNullUnspecified:
49999 return cast<TypeNullUnspecifiedAttr>(this)->printPretty(OS, Policy);
50000 case attr::TypeNullable:
50001 return cast<TypeNullableAttr>(this)->printPretty(OS, Policy);
50002 case attr::TypeNullableResult:
50003 return cast<TypeNullableResultAttr>(this)->printPretty(OS, Policy);
50004 case attr::TypeTagForDatatype:
50005 return cast<TypeTagForDatatypeAttr>(this)->printPretty(OS, Policy);
50006 case attr::TypeVisibility:
50007 return cast<TypeVisibilityAttr>(this)->printPretty(OS, Policy);
50008 case attr::UPtr:
50009 return cast<UPtrAttr>(this)->printPretty(OS, Policy);
50010 case attr::Unavailable:
50011 return cast<UnavailableAttr>(this)->printPretty(OS, Policy);
50012 case attr::Uninitialized:
50013 return cast<UninitializedAttr>(this)->printPretty(OS, Policy);
50014 case attr::Unlikely:
50015 return cast<UnlikelyAttr>(this)->printPretty(OS, Policy);
50016 case attr::UnsafeBufferUsage:
50017 return cast<UnsafeBufferUsageAttr>(this)->printPretty(OS, Policy);
50018 case attr::Unused:
50019 return cast<UnusedAttr>(this)->printPretty(OS, Policy);
50020 case attr::UseHandle:
50021 return cast<UseHandleAttr>(this)->printPretty(OS, Policy);
50022 case attr::Used:
50023 return cast<UsedAttr>(this)->printPretty(OS, Policy);
50024 case attr::UsingIfExists:
50025 return cast<UsingIfExistsAttr>(this)->printPretty(OS, Policy);
50026 case attr::Uuid:
50027 return cast<UuidAttr>(this)->printPretty(OS, Policy);
50028 case attr::VTablePointerAuthentication:
50029 return cast<VTablePointerAuthenticationAttr>(this)->printPretty(OS, Policy);
50030 case attr::VecReturn:
50031 return cast<VecReturnAttr>(this)->printPretty(OS, Policy);
50032 case attr::VecTypeHint:
50033 return cast<VecTypeHintAttr>(this)->printPretty(OS, Policy);
50034 case attr::VectorCall:
50035 return cast<VectorCallAttr>(this)->printPretty(OS, Policy);
50036 case attr::Visibility:
50037 return cast<VisibilityAttr>(this)->printPretty(OS, Policy);
50038 case attr::WarnUnused:
50039 return cast<WarnUnusedAttr>(this)->printPretty(OS, Policy);
50040 case attr::WarnUnusedResult:
50041 return cast<WarnUnusedResultAttr>(this)->printPretty(OS, Policy);
50042 case attr::Weak:
50043 return cast<WeakAttr>(this)->printPretty(OS, Policy);
50044 case attr::WeakImport:
50045 return cast<WeakImportAttr>(this)->printPretty(OS, Policy);
50046 case attr::WeakRef:
50047 return cast<WeakRefAttr>(this)->printPretty(OS, Policy);
50048 case attr::WebAssemblyExportName:
50049 return cast<WebAssemblyExportNameAttr>(this)->printPretty(OS, Policy);
50050 case attr::WebAssemblyFuncref:
50051 return cast<WebAssemblyFuncrefAttr>(this)->printPretty(OS, Policy);
50052 case attr::WebAssemblyImportModule:
50053 return cast<WebAssemblyImportModuleAttr>(this)->printPretty(OS, Policy);
50054 case attr::WebAssemblyImportName:
50055 return cast<WebAssemblyImportNameAttr>(this)->printPretty(OS, Policy);
50056 case attr::WorkGroupSizeHint:
50057 return cast<WorkGroupSizeHintAttr>(this)->printPretty(OS, Policy);
50058 case attr::X86ForceAlignArgPointer:
50059 return cast<X86ForceAlignArgPointerAttr>(this)->printPretty(OS, Policy);
50060 case attr::XRayInstrument:
50061 return cast<XRayInstrumentAttr>(this)->printPretty(OS, Policy);
50062 case attr::XRayLogArgs:
50063 return cast<XRayLogArgsAttr>(this)->printPretty(OS, Policy);
50064 case attr::ZeroCallUsedRegs:
50065 return cast<ZeroCallUsedRegsAttr>(this)->printPretty(OS, Policy);
50066 }
50067 llvm_unreachable("Unexpected attribute kind!");
50068 }
50069